Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <23771268-ef99-871c-535e-addff914196d@bitwagon.com>
Date: Thu, 30 Nov 2017 13:16:01 -0800
From: John Reiser <jreiser@...wagon.com>
To: musl@...ts.openwall.com
Subject: Re: remquo - underlying logic

> I was asking the question in case anybody had done it before and found it useless,
> could think of major pitfalls, or had any pearls of wisdom before we started.

The range of a floating-point exponent will limit the applicability.
Packing and unpacking floating-point format (logb, scalb, etc.) are non-trivial costs,
as are mucking around with NaN, +inf, -inf, denormals, etc.

The "big-O" efficiency is the same: find the difference in exponents,
scale both operands to have the same exponent, perform "ordinary long division"
with the number of steps equal to the difference in exponents;
take care to preserve enough precision.  Floating-point division
of the scaled operands (perhaps using a narrower precision) can be a contender,
especially because mis-predicted branches in long division are VERY expensive
(typically: 70% of CPU pipeline depth [==> a dozen or more cycles].)
Newton-Raphson iteration can be a contender for some range of difference in exponents.

-- 

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.