my first code using GMP!

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Wed May 30 20:09:18 CEST 2012


Ciao Pranav,

Il Mer, 30 Maggio 2012 12:22 pm, Pranav Jawale ha scritto:
> on the net and came up with this "solution". This it's first simple but
> useful code I wrote using GMP :)
>
> Any comments on the code are welcome!!
>
> ./gmpPow.o 2 18 30 E              prints
>
>  2 ** 18  =  262144E6
>  2 ** -18 =  3814697265625E-5

I expected

 2 ** 18  =  2.62144E5
 2 ** -18 =  3.814697265625E-6

Moreover:
$ ./gmpPow 1.1 2 10 E

 11 ** 2  =  121E1
 11 ** -2 =  826446281E0

I expected

 1.1 ** 2  =  1.21E0
 1.1 ** -2 =  8.26446281E-1

But the sequence of the digits is correct ;-) I.e. you used the library
function correctly... Don't you like the format gmp_printf uses?

Regards,
Marco

-- 
http://bodrato.it/softare/strassen.html



More information about the gmp-discuss mailing list