mpn_sqrtrem{1,2} - rounding mode

Adrien Prost-Boucle adrien.prost-boucle at laposte.net
Sat Mar 25 20:01:58 UTC 2017


> Il Ven, 24 Marzo 2017 11:54 pm, Adrien Prost-Boucle ha scritto:
> > This page, at the end, tends to discourage playing with rounding mode too
> > frequently:
> > https://www.gnu.org/software/libc/manual/html_node/Rounding.html
> 
> This page is about writing portable code using libc, here we have a quite
> specific hardware: CPUs supporting SSE/SSE2.

Yes, this needs some benchmarking.
I tested with a function that repeatedly sets all rounding modes.
The result is: 995413 calls to fesetround() per second on my laptop
That's extremely slow given the speed of the sqrt function!

So, I think that for these floating-point investigations,
we have to keep rounding mode set by the user (or default),
and do all necessary corrections to work under any rounding mode.

Adrien



More information about the gmp-devel mailing list