View Single Post
Old 2nd December 2013, 02:42   #181  |  Link
SirLagsalot
Registered User
 
Join Date: Mar 2011
Posts: 10
Quote:
Originally Posted by LoRd_MuldeR
Well, as long as the encoder and the decoder need to do this step in the exactly same way, things could go still go wrong and break decoding, right?
No, the code and the inputs are identical, so the output will be identical as long as the same floating-point state (rounding mode and precision) are used.

Quote:
Originally Posted by LoRd_MuldeR
Hmm, to my knowledge there's at least the classical "x87" FPU with 80-Bit internal precision and the newer SIMD (MMX, SSE, etc) instructions with "only" 64-Bit precision. Even if all variables are 64-Bit (double) precision in memory, the compiler may still keep intermediate results in registers, which would then be either 80-Bit or 64-Bit. Furthermore, even if you don't use SIMD assembly/intrinsic explicitly, compilers may still generate such instructions when targeting CPU's with MMX/SSE support. Finally, there are various compiler settings that effect floating point math ("fast math" option, etc). So there's at least the danger of "portability" issues when the encoder/decoder are compiled with different compilers (compiler configuration).
Lagarith uses the 53-bit precision mode for floating point, so none of those variations in potential precision end up affecting the result. It also checks and sets the floating point state if need be, so even if Lagarith was compiled with the wrong settings by someone else, it would be corrected at run-time.
SirLagsalot is offline   Reply With Quote