0.7 / 1.0 ?= 0.52

János Kukoda kukodajanos at gmail.com
Thu Jun 14 20:40:32 CEST 2012


Hey!

I have a 5.0.4 GMP downloaded, installed from MacPort. I use it with the newest Xcode, updated just now.

gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

The division produce a funny bug. What do you think?

    mpf_t a;
    mpf_init(a);
    mpf_set_d(a, 0.7);
    mpf_t b;
    mpf_init(b);
    mpf_set_d(b, 1.0);
    mpf_t l;
    mpf_init(l);
    
    gmp_printf ("%.*Ff \n", 5, a);		--- 0.70000
    gmp_printf ("%.*Ff \n", 5, b);		--- 1.00000
    
    mpf_div(l, a, b);
    gmp_printf ("%.*Ff", 5, l);			--- 0.52502

Regards, János


More information about the gmp-bugs mailing list