The C ++ standard does not specify any details about floating point types other than range limits, and it is possible that some of the math functions (e.g., sine and exponential) must be correct to a certain level of accuracy.
Also, at this level of generality, you really can't rely on anything else!
However, it is entirely possible that you will not really need bidirectional calculations on each platform, and that the accuracy and precision of the float or double types will actually be sufficient for modeling purposes.
Note that you cannot even create a reliable algebraic expression result inside your own program when you change the order of evaluation of subexpressions, so the request for the required reproducibility may be a little unrealistic anyway. If you want real precision and floating point precision, you might be better off with an arbitrary precision library with the right rounding, like MPFR - but that seems unrealistic for the game.
Serializing floats is a completely different story, and you will need to have an idea of ββthe representations used by your target platforms. If IEEE 754 floats of 32 or 64 bit size were used on all platforms, you could simply exchange the binary representation directly (modulo endianness). If you have other platforms, you will have to come up with your own serialization scheme.
source share