mpq_get_d() rounding for different platforms?

Vincent Lefevre vincent at vinc17.org
Wed Mar 18 14:19:14 CET 2009


On 2009-03-17 14:41:02 -0700, K Shen wrote:
> I ran the same code on all systems:
> 
> main () {
>   double i, j, k;
>   mpq_t rat;
>  
>   printf("hi\n");
>   mpq_init(rat);
>   mpq_set_ui(rat, 4, 5);
>   k = mpq_get_d(rat);
>   printf("rat is %.17f\n", k);
>  
> }
> 
> and I built from the same GMP source. 

But if there are x86 machines, the different results can be due to
the extended precision. This can depend on the OS, on the compiler
(including its version) and on the compiler options.

-- 
Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


More information about the gmp-discuss mailing list