Skip to content

Instantly share code, notes, and snippets.

@simonbyrne
Created July 17, 2017 17:58
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 simonbyrne/0bb647059202d990c60d13d22db68a6d to your computer and use it in GitHub Desktop.
Save simonbyrne/0bb647059202d990c60d13d22db68a6d to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <gmp.h>
#include <mpfr.h>
int main (void)
{
unsigned int i;
mpfr_t u;
mpfr_init2(u, 7000000);
mpfr_const_pi(u, MPFR_RNDN);
mpfr_div_d (u, u, 6.0, MPFR_RNDN);
mpfr_sin (u, u, MPFR_RNDN);
mpfr_sub_d (u, u, 0.5, MPFR_RNDN);
printf ("Diff is ");
mpfr_out_str (stdout, 10, 50, u, MPFR_RNDN);
putchar ('\n');
mpfr_clear (u);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment