mpn_sqrtrem{1,2}

Marco Bodrato bodrato at mail.dm.unipi.it
Fri Mar 17 06:50:05 UTC 2017


Ciao,

Il Gio, 16 Marzo 2017 2:45 pm, Torbjörn Granlund ha scritto:
> We should probably not rely on FP arithmetic in GMP's generic code as it

But it can be useful on some platform. Say mpn/x86_64 ? or
mpn/x86_64/fast{sse,avx} ?

> is not predicatble enough.  Even if we do it just for IEEE 754, we can
> not control the rounding mode.  That means that e.g., sqrt(2)^2 will be
> greater that 2 sometimes, less than 2 sometimes.

All the algorithms I see implemented in GMP for sqrt give the wrong result
sometimes... that's why they all have a final check with possible
correction by 1. I'm sure that also this "sometimes" can be correctly
handled :-)

Best regards,
m

-- 
http://bodrato.it/papers/



More information about the gmp-devel mailing list