NetBSD Problem Report #58246

From www@netbsd.org  Sat May 11 21:24:54 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 62EF11A9247
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 11 May 2024 21:24:54 +0000 (UTC)
Message-Id: <20240511212453.83DA01A9249@mollari.NetBSD.org>
Date: Sat, 11 May 2024 21:24:53 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: asinf gives ~2ulp error when it should give <1ulp
X-Send-Pr-Version: www-1.0

>Number:         58246
>Category:       lib
>Synopsis:       asinf gives ~2ulp error when it should give <1ulp
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 11 21:25:00 +0000 2024
>Last-Modified:  Sat May 11 21:30:02 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, 8, ...
>Organization:
The NetBSD Foundasinf
>Environment:
>Description:
On amd64, asinf(0.5) gives 0x1.0c1528p-1, which is >2.1ulp away from the true answer pi/6.

Instead, it should give 0x1.0c1524p-1, which is <0.3ulp away from the true answer pi/6.
>How-To-Repeat:
#include <float.h>
#include <math.h>
#include <stdio.h>

volatile float f = 0.5;

int
main(void)
{
	printf("asinf(%a) = %a, expected %a\n", f, asinf(f), 0x1.0c1524p-1);
	printf("error ~ %f ulp, expected ~ %f ulp\n",
	    fabsf((M_PI/6 - asinf(f))/(M_PI/6))/FLT_EPSILON,
	    fabsf((M_PI/6 - 0x1.0c1524p-1)/(M_PI/6))/FLT_EPSILON);
	fflush(stdout);
	return ferror(stdout);
}

>Fix:
Yes, please!

>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58246 CVS commit: src/tests/lib/libm
Date: Sat, 11 May 2024 21:27:53 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Sat May 11 21:27:53 UTC 2024

 Modified Files:
 	src/tests/lib/libm: t_asin.c

 Log Message:
 tests/lib/libm/t_asin: Cite PR lib/58246.


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libm/t_asin.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.