Skip to content

Instantly share code, notes, and snippets.

@wilzbach
Created July 31, 2016 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilzbach/afbc2fffd770bfa98c6d353904df687a to your computer and use it in GitHub Desktop.
Save wilzbach/afbc2fffd770bfa98c6d353904df687a to your computer and use it in GitHub Desktop.
FP differences between 32 & 64-bit
> rdmd -unittest -main ele.d
-0x1.820d74p-3
-0x1.820d74p-3
> rdmd -unittest -main-m32 ele.d
-0x1.820d76p-3
-0x1.820d74p-3
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