Created
August 1, 2016 05:57
-
-
Save wilzbach/ec7cc9464e4e8f97689637f23238d510 to your computer and use it in GitHub Desktop.
std.math.pow vs C pow
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
void main() | |
{ | |
alias S = float; | |
S s1 = 0x1.24c92ep+5; | |
S s2 = -0x1.1c71c8p+0; | |
import std.math : std_pow = pow; | |
import core.stdc.stdio : printf; | |
import core.stdc.math: powf; | |
printf("std: %a\n", std_pow(s1, s2)); | |
printf("pow: %a\n", s1 ^^ s2); | |
printf("pow: %a\n", powf(s1, s2)); | |
version(LDC) | |
{ | |
import ldc.intrinsics : llvm_pow; | |
printf("ldc: %a\n", llvm_pow(s1, s2)); | |
} | |
} |
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
std: 0x1.2c155ap-6 | |
pow: 0x1.2c155ap-6 | |
powf: 0x1.2c1558p-6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment