From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id B0CE03858D33 for ; Thu, 27 Apr 2023 11:05:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B0CE03858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682593509; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=kLRgKa3eytvjTT0OjT/ETWjaOOV46fMllhvPBLpMXYs=; b=Iuiq1Ty2APjpE50B47p72Ro3flnNjqBGzfGVWrrxuKZPJqPFIkeOtbiIsDBHXeH3pPUjdJ simPvgqzhIMacDSyjM/g/CcEQza0W5kqecpDe7U425fD5srO5oJS8s567Pz/dIo25csWFl GFFFHva9Q/xH6bS7Vl38w0bctbGdmSA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-249-lgI7PR1pP_KMZgJ1-FIcgQ-1; Thu, 27 Apr 2023 07:05:07 -0400 X-MC-Unique: lgI7PR1pP_KMZgJ1-FIcgQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD9ED1C041AD; Thu, 27 Apr 2023 11:05:06 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.156]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D9D5404DC40; Thu, 27 Apr 2023 11:05:06 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 33RB52hl2757354 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 27 Apr 2023 13:05:03 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 33RB51GQ2757353; Thu, 27 Apr 2023 13:05:01 +0200 Date: Thu, 27 Apr 2023 13:05:00 +0200 From: Jakub Jelinek To: Michael Matz , Aldy Hernandez , Richard Biener , "Joseph S. Myers" , gcc-patches@gcc.gnu.org, Siddhesh Poyarekar , Andrew MacLeod Subject: Re: [PATCH] Add targetm.libm_function_max_error Message-ID: Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_MANYTO,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 Thu, Apr 27, 2023 at 10:59:47AM +0200, Jakub Jelinek via Gcc-patches wrote: > I guess I'll need to look at the IBM double double sinl/cosl results, > either it is some bug in my tester or the libm functions are useless. > But appart from the MODE_COMPOSITE_P cases, I think all the numbers are > within what the patch returns. > Even the sqrtl tonearest IBM double double case is larger than the libm ulps > (2.5 vs. 1). The first really large error I see is for sinl with x/2gx &val 0x748160ed90d9425b 0xefd8b811d6293294 i.e. 1.5926552660973502228303666578452949e+253 with most significant double being 1.5926552660973502e+253 and low double -5.9963639272208416e+230 Now, 0x748 - 0x6fd is 75, which is much larger than 53, so the number has precision larger than 106 bits. given is -0.4025472157704263326278375983156912 and expected (mpfr computed) -0.46994008859023245970759964236618727 But if I try on x86_64: #define _GNU_SOURCE #include int main () { _Float128 f, f2, f3, f4; double d, d2; f = 1.5926552660973502228303666578452949e+253f128; d = 1.5926552660973502e+253; f2 = d; f2 += -5.9963639272208416e+230; f3 = sinf128 (f); f4 = sinf128 (f2); d2 = sin (d); return 0; } where I think f2 is what matches most closely the 106 bit precision value, (gdb) p f $7 = 1.5926552660973502228303666578452949e+253 (gdb) p f2 $8 = 1.59265526609735022283036665784527174e+253 (gdb) p f3 $9 = -0.277062522218693980443596385112227247 (gdb) p f4 $10 = -0.402547215770426332627837598315693221 and f4 is much closer to the given than to expected. On the other side, GCC will really work only with the assumption the numbers have 106-bit precision, so shouldn't care much about exact precision in between the range boundaries. I think I'll for now just trust for IBM double double the ulps files rather than mpfr. Jakub