Skip to content

Instantly share code, notes, and snippets.

@nikAizuddin
Created December 6, 2014 15:34
Show Gist options
  • Save nikAizuddin/43e9e56deb618962788d to your computer and use it in GitHub Desktop.
Save nikAizuddin/43e9e56deb618962788d to your computer and use it in GitHub Desktop.
C++ using x87 FSQRT instruction
#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