From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joern Rennecke To: pderbysh@usa.net (Paul Derbyshire) Cc: egcs@egcs.cygnus.com Subject: Re: Bug in libm or libstdc++. Date: Wed, 31 Mar 1999 23:46:00 -0000 Message-ID: <199903021637.QAA09606@phal.cygnus.co.uk> References: <3.0.6.32.19990302110405.00945870@pop.globalserve.net> X-SW-Source: 1999-03n/msg00069.html Message-ID: <19990331234600.Jgz6wlRkcqNqY1O7bpbopf83lPaGi9MqOfyOOBwUXs4@z> > Impossible, since I don't have the URL for any, and a Web search turned up > dry. (Again.) > Of course, printed, expensive ones are not a viable alternative, since I > have insufficient funds, no access to any vendor of such a product, and > moreover no information about how I would locate such a vendor given that I > did have the access and the three-figure amount of spare cash. Also, egcs > is a free software product run on an open development model, and so it is > not possible for them to require/expect a contributor to obtain expensive > items in order to contribute, without thereby violating their own charter. Oh, I bought one for a sum that, expresed in US dollars, would be one-figure. But never mind, you can go to one of these old-fashioned places called 'public libraries' or 'university libraries'. > A sqrt can be implemented quickly with Newton's method, converging in > O(log_2 # binary digits in mantissa) starting from a suitable guess. This > is O(log n)... I doubt it can be bettered. You have to keep in mind that multiplication itself is O(n^1.6). Moreover, XFmode and TFmode can be expressed in a small number of 32 / 64 bit values, so you have a lot of discretization noise in the actual precision - runtime function. And sqrt is supposed to be rounded EXACTLY for IEEE, i.e. for round to nearest, you should return that floating point value that most accurately describes the actual square root. > It's the trig, exponentials, and especially the logarithms that are the > nontrivial ones. :-) For these functions, the rounding requirements ar a lot more relaxed.