|
|
|
|
|
by celrod
2646 days ago
|
|
Here is a fascinating post by Stefan Karpinski, one of the creators of Julia:
https://discourse.julialang.org/t/array-ordering-and-naive-s... He shows off a function named "sumsto" which takes a single positive double precision floating point number "x" as an argument. "sumsto" always returns the same vector of 2046 floating point numbers -- just in an order so that naive left-to-right summation returns "x".
Just changing the order of that vector lets you sum to almost any positive double precision number. If you want to run the code, I didn't see where "realmax" was defined, but this works: realmax() = prevfloat(typemax(Float64)) |
|