From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from antelope.elm.relay.mailchannels.net (antelope.elm.relay.mailchannels.net [23.83.212.4]) by sourceware.org (Postfix) with ESMTPS id 225823858D37 for ; Thu, 20 Apr 2023 17:58:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 225823858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 62D645424C0; Thu, 20 Apr 2023 17:58:00 +0000 (UTC) Received: from pdx1-sub0-mail-a304.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id C49EF541AB5; Thu, 20 Apr 2023 17:57:57 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1682013480; a=rsa-sha256; cv=none; b=EGJxvvn4QaW2PnzdQMP6L+P4sg+wjncrafRej7e/Qg8tsH0VWOb9ZBAVaGmFDm+JpZuCWz R/X6xXO0foZGie4dNSUT+CF4ySFj3AhWOHyEEOjRzhKgCROMefcrHHnDxJtw57ZyToMdRU RQxk8bqdjYZwaZ2zTMPDo+pRRwePUATYnoeTPgTk92SVan5lbHWuHLJeAuL6bkbHQNgFRJ CZgNNt7DXksSgUM+ZBS/9MsS+enJ9OI342aLoBEMe2wjtFNyIGhmic7xUouJAiO7AVLVU+ hsuZ/WidsB938JavUWekwaL4bl4Vp09AHp7+VsIhreYMh+5wjWzCOHC65j9sEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1682013480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/PUKhPY6HfDcqMfqE+OwXIJhY2tH8gN3eo76sCGqVIg=; b=HcZ/9ADstCC9Wjm40W/BA96lfRp2EfbC3wMfWxwbbBjklo0uBfJobQQtlZmRpnWZ3KQHnj dz8ZI6m7J66rk/CkZs+eBVdEedZtGaY3kcBsjm0PdHHHmOEzm9sgkg4K+sSPc7iqldvUM8 lEe+Zq51YS/6g32qrz6X2IvXT+qngoWf72/g+yg1Bdz+oy1nE6Y+Bo7x6M0ZRCu5MpzMYu LNqsJ7+c/yKKIzd+L+hDXXw6XnC4uTXHZYS0mC54P1KbLKZP39jTt2bq8fsukT1ZaIf+HG O3wDPToZXDfpovsl+SS/NT2asFfzpZJJ6OWwkAzEho5VBno2OJTFGD1RJDiG4Q== ARC-Authentication-Results: i=1; rspamd-7f66b7b68c-zn4rt; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Left-Oafish: 225a477e0155180d_1682013480206_3097351899 X-MC-Loop-Signature: 1682013480206:3840238157 X-MC-Ingress-Time: 1682013480206 Received: from pdx1-sub0-mail-a304.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.101.8.65 (trex/6.7.2); Thu, 20 Apr 2023 17:58:00 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-09-174-91-45-80.dsl.bell.ca [174.91.45.80]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a304.dreamhost.com (Postfix) with ESMTPSA id 4Q2QP061Zsz3Y; Thu, 20 Apr 2023 10:57:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1682013477; bh=/PUKhPY6HfDcqMfqE+OwXIJhY2tH8gN3eo76sCGqVIg=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=AWcSKc3/+ls7nsnlKqHLKuz2GXIzcAm6KE6O/V3HAcMwHaDpnCZ/xFZfQkVdjFR1s YZE38OZ/92rNzgFXOEHPWeMUZE/qskYWHrtZZvJVf3DRqvsBQjMfEb3iFOcCIHyspx 5h25i038//x9cinKSNFgkDw5vclcDStmls7r78i1BG28tVvecoDy15K3b+XFSk1T8e M9h4PBMjCn6l2fCJRLUtQE8Sw5W+fu1/y7S6pB1wDHJZUHStgCq4yEiY5lQVPqa+uf C5I4X0E5vmTSCOlajumxJ6ObgFWaS8mdEdTZeqh2uf2wCFLh3pid1f0Iyg+ltrjjzv EU3c1S9raFiYw== Message-ID: <64abfdef-8eae-9ce9-af62-c57c14c9ffbb@gotplt.org> Date: Thu, 20 Apr 2023 13:57:55 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] Implement range-op entry for sin/cos. Content-Language: en-US To: Jakub Jelinek Cc: Aldy Hernandez , "Joseph S. Myers" , GCC patches , Andrew MacLeod References: <20230418131250.310916-1-aldyh@redhat.com> From: Siddhesh Poyarekar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3032.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-04-20 11:52, Jakub Jelinek wrote: > Why? Unless an implementation guarantees <= 0.5ulps errors, it can be one > or more ulps off, why is an error at or near 1.0 or -1.0 error any worse > than similar errors for other values? In a general sense, maybe not, but in the sense of breaching the bounds of admissible values, especially when it can be reasonably corrected, it seems worse IMO to let the error slide. > Similarly for other functions which have other ranges, perhaps not with so > nice round numbers. Say asin has [-pi/2, pi/2] range, those numbers aren't > exactly representable, but is it any worse to round those values to -inf or > +inf or worse give something 1-5 ulps further from that interval comparing > to other 1-5ulps errors? I agree the argument in favour of allowing errors breaching the mathematical bounds is certainly stronger for bounds that are not exactly representable. I just feel like the implementation ought to take the additional effort when the bounds are representable and make it easier for the compiler. For bounds that aren't representable, one could get error bounds from libm-test-ulps data in glibc, although I reckon those won't be exhaustive. From a quick peek at the sin/cos data, the arc target seems to be among the worst performers at about 7ulps, although if you include the complex routines we get close to 13 ulps. The very worst imprecision among all math routines (that's gamma) is at 16 ulps for power in glibc tests, so maybe allowing about 25-30 ulps error in bounds might work across the board. But yeah, it's probably going to be guesswork. Thanks, Sid