Skip to content

Instantly share code, notes, and snippets.

@Gro-Tsen
Last active June 5, 2020 16:03
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 Gro-Tsen/fd1c7f4125f0403a1710b238107c43d8 to your computer and use it in GitHub Desktop.
Save Gro-Tsen/fd1c7f4125f0403a1710b238107c43d8 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <math.h>
int
main (void)
{
long double x = 2646693125139304345;
printf("input:\n\t%La = %.19Le\n", x, x);
long double t = 1.188488579586842482197671275325e-20L;
printf("mathematically correct value:\n\t%La = %.19Le\n", t, t);
long double y = sinl(x);
printf("computed by sinl:\n\t%La = %.19Le\n", y, y);
long double z;
asm("fsin" : "=t" (z) : "0" (x));
printf("computed by x87 fsin:\n\t%La = %.19Le\n", z, z);
return 0;
}
input:
0x9.2ebc57f85963e64p+58 = 2.6466931251393043450e+18
mathematically correct value:
0xe.07fc7fd31b3447ap-70 = 1.1884885795868424822e-20
computed by sinl:
0xe.07fc7fd31b3447ap-70 = 1.1884885795868424822e-20
computed by x87 fsin:
-0xd.f4e6f150a65fdf3p-12 = -3.4073849865677573455e-03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment