mpf_set_d
Hee Jung Lee
heejung73 at yahoo.com
Fri Nov 21 17:10:23 CET 2003
hi guys!
this is probably a really basic question. but!
when i use mpf_set_d(), how do i make sure that
the copy is "exact"? for example, suppose my double
value is 0.897959184, i want my mpf_t to be
0.897959184000000000000000000000 and NOT
0.897959183999999965841709581582
src
===
#include <stdio.h>
#include <stdlib.h>
#include "gmp.h"
int main()
{
double d;
mpf_t m;
mpf_set_default_prec(400);
d = 0.897959184;
mpf_init(m);
mpf_set_d(m,d);
printf("\nd=%.16f", d);
gmp_printf("\nm=%.*Ffd",20,m);
mpf_clear(m);
}
output
======
d=0.8979591840000000
m=0.897959183999999965841709581582d
More information about the gmp-discuss
mailing list