Is rust's floating-point mechanism consistent across platforms? In java, if you wanted to guarantee the result of an operation's decimal-output was consistent across platforms, you would us strictfp in the method signature.
Disclaimer: I am not an expert in this area. If anyone reading this post has corrections or additions, please add them to the thread rather than notifying me directly.
One must separate consideration of the basic IEEE 754 floating-point operations from the libraries that implement functions such as
Most required operations: E.g.,
%, many others
These should return identical results on all modern platforms. Archaic Intel platforms that use x87 coprocessor chips may return slightly different results.
Some platforms might return results that differ. I don't know whether this is the case; if it is then older-architecture platforms, which may use less precision in their intermediate computations than modern platforms, are the ones more likely to introduce such variance. Platforms with software implementations of these operators may suffer similarly.
Transcendental functions and other recommended operations: E.g.,
tanh, and their inverses (
atan, etc); power and log operators such as ex,
ln x, etc.
These are usually library functions provided by the host system, so their results may differ depending on the host. Rust specifies the following source for these operations:
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.