From nobody Wed Jun 12 18:58:03 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 4Vzvv115Ppz5NGQJ for ; Wed, 12 Jun 2024 18:58:05 +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 4Vzvv03rwmz53fF for ; Wed, 12 Jun 2024 18:58:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718218684; a=rsa-sha256; cv=none; b=h2t9M5vtN5IUf1E+Il2ET/Kb+bSArgscZk9IGg+jh/V+UgHNqINltQy/JXQXI1Pso4e+78 9DbV2jEk3+pSlEd8HQn+T9J8Wz8vQgZqf4hkztdeEXo/ZDQpLTt26a3S5wmdKEQJkh47+z m+oig+thqK1VItCrj+0aYZeGUffVO7uVkV3B300Pfx1kjifhlY1cWtRylawXaGELKMn2ra sMV8nmZruiMLSLaXh6UaSt+xUjBWmNLje+lnxKAq1OZyy1GXj8P+TtTk0agkjRkGyK+32J NKFbDZxYoVhwbqUZkWMc4GN7rZswQmx9x8dulm9Jg5KIjNAysDC8zd5Elff3JQ== 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=1718218684; 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=vhuAd8FXRtGbtyMxXwoI3BXj7bBvX/LprnijVRn1JQg=; b=j2wjX48k5zXve9ajztjj8IUEkrJ+psr3SIDfZaMYcZCRE34L5yEaISrSSL1aX52rx/9SIj LqDMdXCIkIbH6EzLvry1wXdGVnMdwK4bbCxQo2vFsH8KvjC4/t/uGh1q0PJmG8dprjzlR4 nQUEawd74yJGzHH8P+SzkQ6JubAf8sX16Ny4wzxH9rnbRGIQb911XQU4TCypKwkNP+B2wp L038RMRYtCgzH7ZvHcmxYcKWLosSQtNgygz9czs9MhVXE6SXYOHp+GQ2mh6/+5fpua8Wah fXADu/oArKBDA0kk6/xutXrEQ68Ve111CepBo3shn684U3/osf1HkhJBPsAR5Q== 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 4Vzvv03SD7z14fH for ; Wed, 12 Jun 2024 18:58:04 +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 45CIw4td020552 for ; Wed, 12 Jun 2024 18:58:04 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 45CIw4BN020551 for bugs@FreeBSD.org; Wed, 12 Jun 2024 18:58:04 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: Wed, 12 Jun 2024 18:58:03 +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: 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 #11 from Steve Kargl --- Someone smarter than me may need to look at this! With the original src/s_fma.c, I see dble (x,y,z): -0x1p+0 0x1p+0 0x1p+0 mpfr (x,y,z): -0x1p+0 0x1p+0 0x1p+0 mpfr libm RNDN: 0x0p+0 0x0p+0 RNDU: 0x0p+0 0x0p+0 RNDD: -0x0p+0 -0x0p+0 RNDZ: 0x0p+0 0x0p+0 dble (x,y,z): 0x1p+0 -0x1p+0 0x1p+0 mpfr (x,y,z): 0x1p+0 -0x1p+0 0x1p+0 mpfr libm RNDN: 0x0p+0 0x0p+0 RNDU: 0x0p+0 0x0p+0 RNDD: -0x0p+0 -0x0p+0 RNDZ: 0x0p+0 0x0p+0 dble (x,y,z): -0x1p+0 -0x1p+0 -0x1p+0 mpfr (x,y,z): -0x1p+0 -0x1p+0 -0x1p+0 mpfr libm RNDN: 0x0p+0 0x0p+0 RNDU: 0x0p+0 0x0p+0 RNDD: -0x0p+0 -0x0p+0 RNDZ: 0x0p+0 0x0p+0 dble (x,y,z): 0x1.ffffffffffff8p-501 0x1.0000000000004p-500 -0x1p-1000 mpfr (x,y,z): 0xf.fffffffffffcp-504 0x1.0000000000004p-500 -0x1p-1000 mpfr libm RNDN: -0x0p+0 0x0p+0 RNDU: -0x0p+0 0x0p+0 RNDD: -0x1p-1074 -0x1p-1074 RNDZ: -0x0p+0 0x0p+0 The first groups of three are fma(-1.,1.,1.), fma(1.,-1.,1.), and fma(-1.,-1.,-1.) with the four rounding modes. The group is Victor's examp= le where the rounding is wrong. If one looks in src/s_fma.c, there is a special case for addends that sum to zero. This is the 'if (r.hi =3D=3D 0.0) {}' block of code (lines 263-274). If I = comment=20 out this block, I get wrong results for fma(-1.,1.,1.), fma(1.,-1.,1.), and fma(-1.,-1.,-1.), but correct results for Victor's input. :( dble (x,y,z): -0x1p+0 0x1p+0 0x1p+0 mpfr (x,y,z): -0x1p+0 0x1p+0 0x1p+0 mpfr libm RNDN: 0x0p+0 0x0p+0 RNDU: 0x0p+0 0x0p+0 RNDD: -0x0p+0 0x0p+0 RNDZ: 0x0p+0 0x0p+0 dble (x,y,z): 0x1p+0 -0x1p+0 0x1p+0 mpfr (x,y,z): 0x1p+0 -0x1p+0 0x1p+0 mpfr libm RNDN: 0x0p+0 0x0p+0 RNDU: 0x0p+0 0x0p+0 RNDD: -0x0p+0 0x0p+0 RNDZ: 0x0p+0 0x0p+0 dble (x,y,z): -0x1p+0 -0x1p+0 -0x1p+0 mpfr (x,y,z): -0x1p+0 -0x1p+0 -0x1p+0 mpfr libm RNDN: 0x0p+0 0x0p+0 RNDU: 0x0p+0 0x0p+0 RNDD: -0x0p+0 0x0p+0 RNDZ: 0x0p+0 0x0p+0 dble (x,y,z): 0x1.ffffffffffff8p-501 0x1.0000000000004p-500 -0x1p-1000 mpfr (x,y,z): 0xf.fffffffffffcp-504 0x1.0000000000004p-500 -0x1p-1000 mpfr libm RNDN: -0x0p+0 -0x0p+0 RNDU: -0x0p+0 -0x0p+0 RNDD: -0x1p-1074 -0x1p-1074 RNDZ: -0x0p+0 -0x0p+0 --=20 You are receiving this mail because: You are the assignee for the bug.=