From nobody Sun Jun 16 02:26:01 2024 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 4W1xhV2x3yz5Myxm for ; Sun, 16 Jun 2024 02:26:02 +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 4W1xhV1pVVz44Qm for ; Sun, 16 Jun 2024 02:26:02 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718504762; a=rsa-sha256; cv=none; b=gTBbThB8727cGR/fq9YLGj/wHALu5puZ2kQQq3qGzAOvA1m4UnQaV5MUyet0E1ABLWlo35 3Z9zXzdbFiByYv4kSLzEZSLklcuC7M34gi7xWR3zxT5NQ6sce6zX+KtWZ3SAK6h9VLvaXv ZM1Nh3/M78c7PbbPgtYFqttEdMD/bvst2Wp+oXVTHYdWm0Wn9oZaablPPzYcii1Q98yTxj zRw7V2IZF7yfmcQ5ozq5lCldEbu5qB7PehiJ1Q00ICqeRkYBAgIDveiioRmzf/SzXFnkRZ axCZTob5DuclKn+x7Adp0LQEijEao19VBYFaP+iGiV51DO4rNmHw1HU+v6JDtw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718504762; 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: in-reply-to:in-reply-to:references:references; bh=bbEeIJq9Hq1cg9hfQAUpBxMdrS5E9FugEdnC+FT9/hM=; b=HxJcGaDjjCEpVojSS0XlRnYjo1TT7iqIjyoM5pr+PTNeYQPn0Y9SJDQQgMRfBdg0ZJQ3Ng o2PVAONAXn2GVWCwozz9kfMABXHNCCvXWejny0mUPnwBvRstn6t6Fo+sbXwNzinHMpHFXz 5Syn1K8RyBpjRqmPa0wo5X+HutJfXurrGsUe6Br7uUkTrjvn9zKjOY/51HFWLM9pjUt17g z6HAaju1ex0NtbxCzdC3GpKpX6hDOCuKUSmeTMnPb2Fx6KC8ujhBwUt2SOCMzmfuiQa3cm 2wwQYAg9K3GHPnCUsNkvxzPITuo3z2N+X5hH97z0RyLkXCSLv5JV14RmCd9S6A== 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 4W1xhV1PLQzVc7 for ; Sun, 16 Jun 2024 02:26:02 +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 45G2Q2Vc007765 for ; Sun, 16 Jun 2024 02:26:02 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 45G2Q2RL007764 for bugs@FreeBSD.org; Sun, 16 Jun 2024 02:26:02 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 277783] libc fma() doesn't not return the correct zero sign Date: Sun, 16 Jun 2024 02:26:01 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 14.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: kargl@FreeBSD.org X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: 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=3D277783 --- Comment #14 from Steve Kargl --- Created attachment 251489 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D251489&action= =3Dedit New patch The code for fma() and fmal() contain a special case when the addends sum to zero, but it seems that it mishandles small low order bits especially if a subnormal condition occurs. One of the testcases in msun/tests (that I bro= ke with the original patch) is fma(-1.,1.,1.) with the intermediate results (x,y,z): -0x1p+0 0x1p+0 0x1p+0 xy =3D {-0x1p-2, 0x0p+0} r =3D {0x0p+0, 0x0p+0} spread =3D 2 zs =3D 0x1p-2 fma returns (xy.hi + zs +ldexp(xy.lo,spread)), which is fine. For the case that Victor submitted one has (x,y,z): 0x1.ffffffffffff8p-501 0x1.0000000000004p-500 -0x1p-1000 xy =3D {5.000000e-01, -3.944305e-31} r =3D {0.000000e+00 0.000000e+00} spread =3D -999=20 zs =3D -5.000000e-01 For the original code, the special leads to ldexp(xy.lo,spread)=3Dldexp(-3.944305e-31,-999), is not good. The new patch skips the special case if xy.lo !=3D 0. This then allows fma= () to call its add_and_denormalize() function. --=20 You are receiving this mail because: You are the assignee for the bug.=