Created
July 31, 2016 17:59
-
-
Save wilzbach/afbc2fffd770bfa98c6d353904df687a to your computer and use it in GitHub Desktop.
FP differences between 32 & 64-bit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> rdmd -unittest -main ele.d | |
-0x1.820d74p-3 | |
-0x1.820d74p-3 | |
> rdmd -unittest -main-m32 ele.d | |
-0x1.820d76p-3 | |
-0x1.820d74p-3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unittest | |
{ | |
import std.stdio; | |
alias S = float; | |
S c = -0x1.ccccccp-1; // -0.9 | |
S f0 = -0x1.1df702p-3; | |
S f1Val = -0x1.8p+0; | |
S f1New = f1Val * c * f0; | |
writefln("%a", f1New); | |
S f1Newb = f1Val; | |
f1Newb *= c; | |
f1Newb *= f0; | |
writefln("%a", f1Newb); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment