|
|
Message-ID: <8537c562-2a21-12c-1d40-bc16b99817@esi.com.au> Date: Mon, 7 Jul 2025 13:41:41 +1000 (AEST) From: Damian McGuckin <damianm@....com.au> To: MUSL <musl@...ts.openwall.com> Subject: Re: __expo2.c (and __expo2f.c) Hi Szabolcs, On Sun, 6 Jul 2025, Szabolcs Nagy wrote: > i think the comments should be clear, do you have something in mind? See below for my reason. > maybe it could say that sign is either +1.0 or -1.0. > > hyperbolic funcs need exp(x)/2 for large x where exp(x) would overflow Yes. But the solution here is superior to (and different from and more accurate (by two rounding errors) than the approach taken in most of the common mathematical libraries like those of GNU, OpenLIBM, and the BSDs). > hence the __expo2(x,sign) trickery. Not 'trickery', sophisticated mathematical techniques! I would suggest that it should also appear on ctanh() but I could be wrong. > instead of INSERT_WORDS nowadays i'd probably just write > > static const double scale = 0x1p1021; /* scale*scale = 2^(k-1) */ Yes. Hexadecimal floats are very very handy. I was looking to document the error analysis for a task related to the use of these routines with complex arguments. I needed to justify the choice of 'k' (which is the reason __expo2() works) and also that cancellation error is avoided with this algorithm for the practical domain. If some document already existed which went into the details and me from having to type things up myself, I was seeking such a thing out. But no matter that it does not exist. I suggest that a summary of these details going into the routines as comments might be a good idea in the long term. But I do not think it is urgent, as long as it is not forgetten. Thanks for your reply - Damian
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.