Talk:Shape-Machine

From Rosetta Code

Um... So what's the point?

So what's the point of this "task"? How is this operation a "shape machine"? (references? links?) What is the desired precision of the output? Why is this a task and not a draft task? --Thundergnat (talk) 19:52, 5 July 2024 (UTC)

yes -User:Gaham
Yes to what? None of those question could sensibly be answered by "yes". Why is repeat spelled "reapeat"? And previous spelled "previos"? (at least, I assume what those are meant to be...) Why do none of the sentences have ending punctuation? Again: Why is this a task and not a draft task? --Thundergnat (talk) 20:03, 5 July 2024 (UTC)
1. That was supposed to mean that there is not point of the draft task. 2. Whoops -User:Gaham
There seems to be no point whatsoever. What does "after the number stops doing the second step" mean? The number isn't doing any steps. The example Python code loops indefinitely. Which "second step" should we pick? The reference link is just to another wiki which has the same seemingly pointless operation and which was written by you. Again; What makes this operation a shape machine? --Thundergnat (talk) 20:20, 5 July 2024 (UTC)
1.basicly means if the previous digit is the same as the current digit. 2.i can't really phrase that correctly. So I will just change that. 3.the second step on the list of tasks maybe? 4.One shorten word with a another word. OC stuff -User:Gaham
The generated numbers converge on 18.428571... for all the inputs I tried. Maybe that's the point ? --Tigerofdarkness (talk) 23:35, 5 July 2024 (UTC)
I guess that should be the reason -User:Gaham
...of course, the result will always converge to 18.428571... because the task boils down to iteratively finding a solution for 0.86(a+3) = a. --Tigerofdarkness (talk) 12:19, 6 July 2024 (UTC)

Towards a clearer and more useful task

To make the solutions to this task more informative, I would suggest modifying the task description so that it has three main parts: (1) writing the generator; (2) showing how the language in question makes it possible to limit the number of items produced by the generator; (3) modifying the generator so that it reports both the first generated value whose truncation is 18, and the index of that value in the stream of generated values. Peak (talk) 03:08, 6 July 2024 (UTC)

idk how to do that -User:Gaham

Precision

For languages that are using floating point, it seems that 64-bit with an input of 4 will converge in 231 iterations (see Wren, Algol 68...). With 32-bit, an input of 4 converges in 97 iterations - see the Oberion-07 and third Algol 68 sample.
Interestingly, with 32-bit, the result differs in the last digit depending on the input value - possibly this will happen with 64-bit as well with some values.
I think the Phix samples labeled 32-bit and 64-bit are most likely 64-bit and 80-bit, judging by the number of iterations for convergence and the number of digits displayed.
--Tigerofdarkness (talk) 18:19, 6 July 2024 (UTC)

Correct, "32-bit" Phix (and JavaScript/p2js output) uses 64-bit floats whereas "64-bit" Phix uses 80-bit floats - the latter so that MIN/MAXINT and similar values won't drop bits when moved in/out of a float. --Petelomax (talk) 12:00, 7 July 2024 (UTC)
There is probably some interesting reason why it converges to 18.{428571} with those 6 digits repeating forever, and of course you can use that to determine how accurate the final digits really are. --Petelomax (talk) 12:28, 7 July 2024 (UTC)
Aha - I misunderstood and thought the "32-bit" and "64-bit" were meant to refer to the size of floats used : ).
Yes, the value repeats the digits 428571 - I checked with 100 decimal places using a = 0.86 * 3 / 0.14.
0.86 * 3 / 0.14 is equivalent to 0.46 * 3 / 0.7 which is 4.6 * 3 / 7 and 1/7 is an infinitely repeating fraction in decimal. --Tigerofdarkness (talk) 13:38, 7 July 2024 (UTC)
It converges because is a fixed point (or an attractor) of the function . 43/50 is the rational form of 0.86. The fixed point is the solution of the equation , which is Laurence (talk) 19:02, 7 July 2024 (UTC)