
MessageID: <alpine.LRH.2.02.1712041657080.4717@key0.esi.com.au> Date: Mon, 4 Dec 2017 19:10:17 +1100 (AEDT) From: Damian McGuckin <damianm@....com.au> To: musl@...ts.openwall.com Subject: Re: remquo  underlying logic Floats are not going to be faster for remquo(x, y, &q) except for a very small range where 1 < x / y < 1000 (or so) But I was hoping for only a moderate overhead. And John Reiser mentioned > The range of a floatingpoint exponent will limit the applicability. No. > Packing and unpacking floatingpoint format (logb, scalb, etc.) are > nontrivial costs, as are mucking around with NaN, +inf, inf, > denormals, etc. Not really. > The "bigO" efficiency is the same: find the difference in exponents, > scale both operands to have the same exponent, The above are trivial compared to the operation where you > perform "ordinary long division" with the number of steps equal to the > difference in exponents; take care to preserve enough precision. This is the killer. On a Xeon, the floating point alternative is generally a factor of 46 worse. Actually, in the domain y * 2^(p) < x < 2^(w1) where w is the word size in bits, the penalty is higher still, about 10. but after that it drops down to a factor of 4 and increases slowly to a factor of 6 where the difference in exponents is the same as the bias of the exponent. I must admit that I found the penalty incredible. A bit scary that faking floating point is so much faster, although admittedly with quite simple operations. The only thing is that the code is infinitely more readable, an important but not the dominant concern. An interesting exercise, albiet a bit fruitless. Regards  Damian Pacific Engineering Systems International, 277279 Broadway, Glebe NSW 2037 Ph:+61285710847 .. Fx:+61296929623  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.