4 ms·
> What? ... > In other words, no, you don't run out of memory after 40 multiplications... So you think one case proves there is no set of 40 multiplications th
by ChrisLomont 6y ago
> What? ...
> In other words, no, you don't run out of memory after 40 multiplications...
So you think one case proves there is no set of 40 multiplications that overflows?
Since we're using a small starting value and only one operation per iteration, let's try 50 mults:
x = frac(7,8)
for i = 1 to 50
x = x * x
print(x) # as exact decimal fraction
Tell me how much ram and time this took you to evaluate with exact rational values. I'll wait :)
(Hint: you'll need approx 500 terabytes of ram to store these integers. I guess I didn't really need all 50 iterations! )
If you want only 40 mults, then using different starting values and adding a few additions will cause the same overflow. In fact, all sorts of common algorithms will overflow in very few operations using rationals. This is why numerical algorithms textbooks don't even cover it as a possibility - it's a terrible idea thrown out decades ago for precisely these reasons.
Your exact rational number idea has replaced predictable behavior on reasonable inputs with highly finicky unstable behavior, and a programmer will have no idea how to ensure things don't go off the rails for common uses.
In each reply you make fundamental math errors, provably incorrect claims, and don't stop to learn. I already gave a proof that such simple things will overflow - you ignored it, then tried to prove the converse with one toy example. It's not worth showing you more errors when you ignore evidence and continue disproven claims.
We're done. You're too stubborn to absorb relevant material.
- bjourne 6y ago> So you think one case proves there is no set of 40 multiplications that overflows? > Since we're using a small starting value and only one operation per iteration, let's try 50 mults: That is repeated exponentiation, not repeated multiplication and you are grasping for straws. Try the same code using an integer or a float greater than 1. Since the same thing will happen as when using rationals (you get an error) are you going to tell me that those number types are useless too? > In each reply you make fundamental math errors, provably incorrect claims, and don't stop to learn. Now I realize that you are most likely trolling me. Fine. Have a nice day! Bye!