Date: Sun, 4 Sep 2022 17:59: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 Sun, Sep 04, 2022 at 09:52:35PM +0200, ardi wrote: > 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. It's not about the exponent size but the mantissa size, and the numbers 64 and 120 are completely arbitrary except for being larger than the number of mantissa bits and small enough not to overflow (so at most a little under twice the max exponent). Hope this helps. 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.