|
Message-ID: <20220830122627.GA16467@brightrain.aerifal.cx> Date: Tue, 30 Aug 2022 08:26:28 -0400 From: Rich Felker <dalias@...c.org> To: ardi <ardillasdelmonte@...il.com> Cc: musl@...ts.openwall.com Subject: Re: Do you recommend using fmt_fp() and On Tue, Aug 30, 2022 at 12:17:50PM +0200, ardi wrote: > On Tue, Aug 23, 2022 at 7:30 PM Rich Felker <dalias@...c.org> wrote: > > > > See how strtod.c uses sh_fromstring and how sh_fromstring does not > > define any io callbacks (so that calling __uflow would necessarily > > result in a call to a null or ununitialized function pointer). From > > that, it's clear that it must not be reachable (or the existing code > > in musl would be broken). > > Thanks a lot. Understood. While in the process of adapting the code, > I came across the implementation of scalbnl(), and I'm not sure if > I found a mistake or if it's correct: lines 23 to 27 of src/math/scalbnl.c > use MANT_DIG but hardcode it as 113 both when long double is > binary128 and when it's 80bit extended (where MANT_DIG is 64). > > By comparison, looking at the source of the scalbn() versions for > float and double, I'd say there's a mistake in the long double version, > but I've never written that function myself, so I'm not in a position > to affirm it for sure. > > Kind regards, and thanks a lot, I think the scaling just needs to be large enough to ensure we get out of the subnormal range but not so large as to overflow. Since it's conditioned on starting out with a negative exponent in the subnormal range, you'd need an exponent much larger than the max positive exponent for scaling to overflow, so 113 is safe and the only point of the number being 113 is that it's sufficient for both formats. That's just my quick reading of what's going on, so if anyone thinks I'm wrong about it, please speak up. Rich
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.