This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/64677] incorrect result with complex division?


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64677

Mikhail Maltsev <maltsevm at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maltsevm at gmail dot com

--- Comment #3 from Mikhail Maltsev <maltsevm at gmail dot com> ---
Probably calculating with higher precision will give correct result. Output of
Wolfram Alpha:

-O0:
convert -0.0083223357032193145 to binary
-1.00010000101101001100111111010101111110001111010101101111110000100111001001000000101110010001111111000010000110010110110001111..._2Ã2^-7
| hexadecimal value
IEEE double-precision number | 578f5ffd4c0b81bf 
(assuming little-endian byte ordering)

-O1:
convert -0.0083223357032193128 to binary
-1.00010000101101001100111111010101111110001111010101100000000101000110111101001110010111111111111111010110100111010111010010011..._2Ã2^-7
| hexadecimal value
IEEE double-precision number | 568f5ffd4c0b81bf 
(assuming little-endian byte ordering)

Wolfram Alpha's calculation:
binary(re(1/(-61.887073591767951 -60.052083270252012i)))
-1.0001000010110100110011111101010111111000111101010110000111101100101010111110001101011011011011010000000101100000101111101111..._2Ã2^-7
| hexadecimal value
IEEE double-precision number | 568f5ffd4c0b81bf 
(assuming little-endian byte ordering)

So, compile-time result is more precise. BTW, what does the disassembly look
like?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]