From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16733 invoked from network); 4 Sep 2022 21:59:44 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 4 Sep 2022 21:59:44 -0000 Received: (qmail 17912 invoked by uid 550); 4 Sep 2022 21:59:41 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 17880 invoked from network); 4 Sep 2022 21:59:40 -0000 Date: Sun, 4 Sep 2022 17:59:28 -0400 From: Rich Felker To: ardi Cc: musl@lists.openwall.com Message-ID: <20220904215927.GB9709@brightrain.aerifal.cx> References: <20220819031934.GH7074@brightrain.aerifal.cx> <20220823173020.GJ7074@brightrain.aerifal.cx> <20220830122627.GA16467@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] 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 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