Created
December 6, 2014 15:34
-
-
Save nikAizuddin/43e9e56deb618962788d to your computer and use it in GitHub Desktop.
C++ using x87 FSQRT instruction
This file contains hidden or 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
#include <iostream> | |
using namespace std; | |
double x = 1.25; | |
double result = 0.00; | |
int main() | |
{ | |
asm( | |
".intel_syntax noprefix;" | |
"finit;" | |
"fld qword ptr [x];" | |
"fsqrt;" | |
"fst qword ptr [result];" | |
); | |
cout.precision(16); | |
cout << result << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment