mpn_sqrtrem{1,2}

Adrien Prost-Boucle adrien.prost-boucle at laposte.net
Fri Mar 24 22:54:36 UTC 2017


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


On Fri, 2017-03-24 at 15:56 +0100, Torbjörn Granlund wrote:
> I haven't followed this thread carefully, but now I have some questions:
> 
> Are these instructions affected by rounding mode?  Are there variants
> where the instructions themselves specify the rounding mode?
> 
> The adjustment steps look a bit confusing, and perhaps sub-optimal.
> 
> Would it not be possible to set things up (with or without rounding
> control) such that the result is always at most one off and always in
> one direction?  Then a conditional increment (decrement) would suffice.
> 
> Why do you use IEEE single-precision sqrtss when limbs are 32 bits? It
> appears that sqrtsd would give a correct result always after conversion
> back to mp_limb_t, without any "adjustments".



More information about the gmp-devel mailing list