Floating Point Math In Python / Numpy Not Reproducible Across Machines
Solution 1:
Floating point calculations are not always reproducible.
You may get reproducible results for floating calculations across different machines if you use the same executable image, inputs, libraries built with the same compiler and identical compiler settings (switches).
However if you use a dynamically linked library you may get different results, because of numerous reasons. First of all, as Veedrac pointed in comments it might use different algorithms for its routines on different architectures. Second, a compiler might produce different code depending on switches (various optimizations, control settings). Even a+b+c
yields non-deterministic results across machines and compilers, because we can not be sure about order of evaluation, precision in intermediate calculations.
Read here why it is not guaranteed to get identical results on different IEEE 754-1985
implementations. New standard (IEEE 754-2008
) tries to go further, but it still doesn't guarantee identical results among different implementations, because for example it allows implementers to choose when tinyness (underflow exception) is detected
More information about floating point determinism can be found in this article.
Post a Comment for "Floating Point Math In Python / Numpy Not Reproducible Across Machines"