From nobody Mon Mar 18 21:06:29 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 4Tz6pt16zJz5F1GN for ; Mon, 18 Mar 2024 21:06:30 +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 4Tz6ps5KzVz4Qbt for ; Mon, 18 Mar 2024 21:06:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710795989; a=rsa-sha256; cv=none; b=bdou18SvrzP83Y4MsOklA5Rke4EdKzOzsk/PhhsfuO97xiPi3QWmZP6BMn5S/nWkemkWTf UmTDRcw+CqGxWP/gZnP0PJrjpWvfyHDUzvduuxED2zFruWd9ugZEj++10zrVH1k7Pha2fh URGavLNUdBcIl/aOIqe9Tiwg+zV2wYg/JBYRHYUdlaLrZDZlsi2F/VI4fMhfCdLNjTTsze IVL5Rb956eT8Q3y5HRMUYv0fDTdDo4ihFhpU/ErzyNRI9D5F/2OR3AMTmbgs37Tlv5LxbG ZyeFAo9WFLfVal+kaS2ex3xH9pjcUcMo53fkNiMI7PD4COw/fo3VsHQ+W5ZL3Q== 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=1710795989; 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=7v473YO893D1dyXrkRJDlgqNk0m+RPwXTcvzxTpMBVs=; b=ptCpSELHMa5khMPKoMhHBvuZtxOiYSabRu2773aktAC4K0POqIjZYyYqChXUFAk8L7J/wa k2WnYHOjYc1uALql+HReC4o42dLRe2FdtDcuUj8Qb5qDlTvVewVHxojqgSvlm7x4SxfDfA uVti32YwCcjzvzgZMCUZQDJ7wrBAnXQiefnns3xrlcz7d5ipG2NrGrpnjQ9w9m2nxm1dBu kx4uLYECYR4pQ2D8CwfgOuyeTCKoksFmLSI/ks+TsXvIYfrHC48dQTUykgP9tVPKctIIxO Pf/b7qBfltdCYWsUzsbqVw4qGvi+b0eIb1krZ7lr1EJ+jVtoCTuuZTnA+FNyfg== 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 4Tz6ps4xxczf7l for ; Mon, 18 Mar 2024 21:06:29 +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 42IL6TQo042601 for ; Mon, 18 Mar 2024 21:06:29 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 42IL6T6Q042600 for bugs@FreeBSD.org; Mon, 18 Mar 2024 21:06:29 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: Mon, 18 Mar 2024 21:06:29 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 14.0-RELEASE 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: 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 #4 from Steve Kargl --- Ok, with the given input to fma, one arrives at line 271 return (xy.hi + vzs + ldexp(xy.lo, spread)); (gdb) p vzs $12 =3D -0.5 (gdb) p xy.hi $13 =3D 0.5 (gdb) p xy.lo $14 =3D -3.944304526105059e-31 (gdb) p spread $15 =3D -999 Turns out that ldexp(3.944304526105059e-31, -999) =3D -0x0p+0. So, you have 0.5 - 0.5 - 0. =3D 0. - 0. =3D +0 So, a pessimestic patch is Index: src/s_fma.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- src/s_fma.c (revision 2834) +++ src/s_fma.c (working copy) @@ -267,7 +267,9 @@ */ fesetround(oround); volatile double vzs =3D zs; /* XXX gcc CSE bug workaround */ - return (xy.hi + vzs + ldexp(xy.lo, spread)); + xs =3D ldexp(xy.lo, spread); + xy.hi +=3D vzs; + return (xy.hi =3D=3D 0 ? xs : xy.hi + xs); } if (oround !=3D FE_TONEAREST) { --=20 You are receiving this mail because: You are the assignee for the bug.=