Date: Sun, 4 Sep 2022 21:52:35 +0200 From: ardi <ardillasdelmonte@...il.com> To: Rich Felker <dalias@...c.org> Cc: musl@...ts.openwall.com Subject: Re: Do you recommend using fmt_fp() and On Tue, Aug 30, 2022 at 2:26 PM Rich Felker <dalias@...c.org> wrote: > > 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. I've left as it is, it seems to work fine. Aside from that, and as you pointed out, I needed a frexp() implementation for SoftFloat, and, because I want to have all things as complete as possible, I'm writing frexp() for all the types in SoftFloat (binary16, binary32 aka float, binary64 aka double, extended 80bit, and binary128). I'm just adapting the musl implementation so that it accesses the SoftFloat structs/unions. I'm having a hard time trying to understand the code block for "if(!ee)", specifically the decrement amount for the exponent. frexpl() decrements by 120 for both 80bit and binary128 long doubles. It makes sense because both types have the same exponent size. Then frexp() decrements by 64. It also seems to make sense because the exponent is smaller in binary64. However, frexpf() also decrements by 64. Why? And what's the reason for choosing 64 and 120? I couldn't find from where they come. For binary16 I'm replicating all the same logic, but no idea on the amount for decrementing the exponent on "if(!ee)". If I can understand how 64 and 120 where chosen for the other types, I'll be able to find it for binary16. Thanks again, César
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.