Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b03ae0d7-3673-b2fa-44c-bd7e6a689bb6@esi.com.au>
Date: Fri, 21 Jun 2024 18:12:22 +1000 (AEST)
From: Damian McGuckin <damianm@....com.au>
To: MUSL <musl@...ts.openwall.com>
Subject: Re: roundf() (and round(), and ...)


There is an optimization in roundf() (and an equivalent in round())
which handles the case of numbers 0 < |x| < 0.5

     if (e < 0x7f-1) {
         return 0*u.f;
     }

If one has lots of numbers close to zero (as you would if you were testing 
even possible 32-bit floating point number or for any other reason), this
can mean a total run time is 5% faster overall (at the expense of the 
performance of cases for |x| >= 0.5.

Is such an optimization worth it? And yes, we re not talking about lots of
compute cycles here!

Thanks - Damian

Pacific Engineering Systems International ..... 20D Grose St, 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.