Created
August 1, 2016 15:08
-
-
Save wilzbach/ed5033e5be08b09dc181972a4f56fb7c to your computer and use it in GitHub Desktop.
FP magic fun on 32-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
S fun(S)(in S x) | |
{ | |
return -1 / x; | |
} | |
void main() | |
{ | |
alias S = double; // same for float | |
S i = fun!S(3); | |
assert(i == S(-1) / 3); // this lines passes | |
assert(fun!S(3) == S(-1) / 3); // error | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment