From nobody Wed Jul 26 22:18:32 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RB7Zw4rlFz4ny9x for ; Wed, 26 Jul 2023 22:18:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RB7Zw2YBKz3LGn for ; Wed, 26 Jul 2023 22:18:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690409912; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gKjI2toJDhbiNKHsQt13ROj7z4XElGAVrm49LaEGzSo=; b=NfpChbR/OMBGLRAyQYbVGdR2EVCW1AL5td52fpmESw++/O8N94Y4SuB7xP0hyQ+4cI8tDA PUB9B2we/THsoDcf9p4Y19VIrym3FCFlOwK2ZBhWVhtWnTi1lda/K/VlBHbhIdF6638oy8 Q1dOwlenCqc5pe9+HxKNLwbkIU6olbMB5Ou99xuTAu7BsHtqgrN2gs6a346b30B09zonGx CtauEpYXUl5vmuMdh1Wp75Dg1bmN/rB+i8eqwI9DYt/SL3rfjxepSyTcIaiosGshkGMOJt 6v8OGDrn+GgUnBdI5DSbzDF0DVzGV3/IhCk/7LUiweoX+cugeMolQwTvZNl3JA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690409912; a=rsa-sha256; cv=none; b=Z97+AA7w9EdFYlueMogFB/0Q6pqymOO3PVmhTBYZQFJWNLbWFAUlNJTolQZk/nIP7M43Fw kyMX/QLzAKeohceLh2AaZHPa1Uo6UU/fIxy4vxNWZPGoANz2J2LgJ3xuw3tFRZ24qeaX0M MgOicCcHQ6GoctqF8jJ1jgpROCyhVfC988QMmEeGXEIkJ//aonRdcRW4DBv8ljfybnJA9g Uf9RmvJNW3jYpiCuKc/JxKBbI2501tJSJKMOoo1gzIKlWDXJBg4o0rICGduOZ/qlJiq2dF qV4Cm4u/XicJiKTDVCktbmbtsFUymirGQX8Lj9VzfJuhXcWyKbX0Szjh3pyRHw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RB7Zw1Y86z106H for ; Wed, 26 Jul 2023 22:18:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 36QMIWt0046486 for ; Wed, 26 Jul 2023 22:18:32 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 36QMIWKg046485 for bugs@FreeBSD.org; Wed, 26 Jul 2023 22:18:32 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 272742] Fixes for bugs in sinpi/cospi/tanpi Date: Wed, 26 Jul 2023 22:18:32 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: kargl@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272742 Bug ID: 272742 Summary: Fixes for bugs in sinpi/cospi/tanpi Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: kargl@FreeBSD.org Created attachment 243634 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D243634&action= =3Dedit patch to fix half-cycle trigonometric functions Paul Zimmermann, a MPFR developer, contacted me about large errors in the half-cycle trigonometric functions. I've have investigated these issues and developed the attached patch. The float, double, and ld80 (long double) cha= nges have been tested. Caveat emptor: The ld128 changes have not been compiled. The ld128 changes have not been tested. I do not have access to a system that uses ld128 floating point. Here is an itemized list of changes: * lib/msun/src/math_private.h: . Add fast floor macros to compute the integer part of |x| for 0 <=3D |x| 01xp(N-1), where N is the precision of the type of x. These macros are used in the half-cycle trigonometric functions (e.g., sinpi(x)). . The FFLOOR80 macros is used with the Intel 80-bit extended double functions. This macors corrects an off-by-one error, which led to enormous error for |x| > 0x1p32. * lib/msun/src/s_cospif.c: * lib/msun/src/s_cospi.c: * lib/msun/ld80/s_cospil.c: . Update Copyright years. . Use FFLOOR*() macro to get integer part of |x|. . Correct handle the range 0x1p(N-1) <=3D |x| < 0x1pN. Here, one needs to determine if the integral value of |x| is even or odd to choose +1 or -1. If |x| >=3D 0x1pN, always return +1. * lib/msun/src/s_sinpif.c: * lib/msun/src/s_sinpi.c: * lib/msun/ld80/s_sinpil.c: . Update Copyright years. . Use FFLOOR*() macro to get integer part of |x|. * lib/msun/src/s_tanpif.c: * lib/msun/src/s_tanpi.c: * lib/msun/ld80/s_tanpil.c: . Update Copyright years. . For +-0.5, return +-inf. Previously, tanpi[fl]() returned an NaN. . Use FFLOOR*() to get integer part of |x|. Need to determine if the integer part is even or odd. This is used to set +-0 for |x| integral and +-inf for (n+1/2).=20 . For 0x1p(N-1) <=3D |x| < 0x1pN need to determine if x is an even or odd integer to select +0 or -0. For |x| >=3D 0x1pN, it is always an even integer, select 0. . Note, tanpi[fl](x) is an odd function, so one needs to consider tanpi[fl](-|x|) =3D - tanpi[fl](|x|). * lib/msun/ld128/s_cospil.c: * lib/msun/ld128/s_sinpil.c: * lib/msun/ld128/s_tanpil.c: . Update Copyright years. . These routines use an FFLOOR128 macros, which likely should be replaced by a bit twiddling algorithm. . The same considerations above are applied to 0x1p112 <=3D |x| < 0x1p113, and |x| >=3D 0x1p113 cases. . Note, even and odd determination used fmodl(x,2.), which is likely slow. --=20 You are receiving this mail because: You are the assignee for the bug.=