Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 6 Dec 2017 12:17:40 +1100 (AEDT)
From: Damian McGuckin <>
Subject: Re: remquo - underlying logic

While my exploration with floating point numbers was less than stellar,
I did notice that when

 	ex - ey < p (where p is the digits in the significant)

you can use the


routine to compute some appropriately rounded/truncated version of the 
quotient for both remquo and fmod. And this appears to not loose any 
precision for the obvious reasons.

>From my limited testing, the speed gain for this extremely limited range 
of exponent difference is huge over the standard routine in MUSL. I will 
do some more testing and report in detail but it seems to be orders of 

Somebody might want to comment on that sort of approach.

In 99% of the floating point work I do, the calculations involve physical 
stresses and strains and loads and such within digital models. They differ 
in exponent range between 10^6 through to 10^12 unless I have screwed up 
in my model. This is a lot less than 2^52 for a double and mostly is still 
under the 2^23 for a float which is just above 10^6. So, in my sort of 
calculations, the speed gain can be quite significant.  The burden of the 
extra branch seems to be trivial, even for the cases where the FMA is not 

Regards - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.