From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RDNS_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 7116 invoked from network); 22 Mar 2020 17:40:34 -0000 Received-SPF: pass (mother.openwall.net: domain of lists.openwall.com designates 195.42.179.200 as permitted sender) receiver=inbox.vuxu.org; client-ip=195.42.179.200 envelope-from= Received: from unknown (HELO mother.openwall.net) (195.42.179.200) by inbox.vuxu.org with ESMTP; 22 Mar 2020 17:40:34 -0000 Received: (qmail 5364 invoked by uid 550); 22 Mar 2020 17:40:31 -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 5335 invoked from network); 22 Mar 2020 17:40:30 -0000 Date: Sun, 22 Mar 2020 20:40:19 +0300 (MSK) From: Alexander Monakov To: musl@lists.openwall.com In-Reply-To: <20200322011958.GM11469@brightrain.aerifal.cx> Message-ID: References: <20200114185058.GV23985@port70.net> <20200114185835.GG30412@brightrain.aerifal.cx> <20200206145156.GF1663@brightrain.aerifal.cx> <20200222195925.GK1663@brightrain.aerifal.cx> <20200223001942.GM1663@brightrain.aerifal.cx> <20200320181250.GC11469@brightrain.aerifal.cx> <20200322011958.GM11469@brightrain.aerifal.cx> User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [musl] Q: dealing with missing removal of excess precision On Sat, 21 Mar 2020, Rich Felker wrote: > With the fixups mentioned (included in attached patches), i386 and > x86_64 are passing libc-test and seem fine. OK if I merge them > (rebasing the fixups in as fixups)? With s/x86/x87/ naming? Ack for x87 naming, fabsf fix and sqrt +0x300 fix. Nack for sqrt 'unsigned short' fix, I recommend to consider 'unsigned fpsr = 0' and "+a" constraint, the resulting assembly is much better (GCC doesn't seem to do a good job optimizing the 'unsigned short' variant at all). I also would like to see i386/sqrtf.c to explain why double rounding is safe, either as a comment (my preference) or in the commit message. I would write something like the following: The long double result has sufficient precision so that second rounding to float still keeps the returned value correctly rounded, see Pierre Roux, "Innocuous Double Rounding of Basic Arithmetic Operations". (this paper elaborates the earlier [currently paywalled] paper by Figueroa) Actually, may I ask why the initial commit did not mention that it relies on this nontrivial property? Thanks. Alexander