NetBSD Problem Report #56234
From dholland@netbsd.org Fri Jun 4 18:32:52 2021
Return-Path: <dholland@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 7EAFB1A921F
for <gnats-bugs@gnats.NetBSD.org>; Fri, 4 Jun 2021 18:32:52 +0000 (UTC)
Message-Id: <20210604183251.D33DE84CE9@mail.netbsd.org>
Date: Fri, 4 Jun 2021 18:32:51 +0000 (UTC)
From: dholland@NetBSD.org
Reply-To: dholland@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: missing C99 frobs in <math.h>
X-Send-Pr-Version: 3.95
>Number: 56234
>Category: standards
>Synopsis: missing C99 frobs in <math.h>
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: standards-manager
>State: needs-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jun 04 18:35:00 +0000 2021
>Closed-Date:
>Last-Modified: Tue Sep 10 17:40:01 +0000 2024
>Originator: David A. Holland
>Release: NetBSD 9.99.83 (20210604)
>Organization:
>Environment:
System: n/a
Architecture: n/a
Machine: n/a
>Description:
Crosschecking <math.h> against C99 7.12 shows that we are missing the
following items. (These are documented at the top of math.h, but there
should be a PR as well.)
(1)
MATH_ERRNO (macro)
MATH_ERREXCEPT (macro)
math_errhandling (macro or constant)
This is supposed to document whether floating-point gaffes set errno
(MATH_ERRNO) or cause exceptions (MATH_ERREXCEPT) or both
(MATH_ERRNO|MATH_ERREXCEPT).
I would expect this to be machine-dependent; it probably makes sense
to put
#define MATH_ERRNO 1
#define MATH_ERREXCEPT 2
in math.h and a #define for math_errhandling in every machine/math.h,
but to actually do this we need to collect up the proper values for
each machine. It is probably a bad idea to add the macros for the
cases until we also have math_errhandling at least for major machines,
since if any code out there uses this logic at all (unclear) it's
probably guarded by #ifdef MATH_ERRNO.
(2)
FP_FAST_FMA
FP_FAST_FMAF
FP_FAST_FMAL
These are supposed to be defined if fma{,f,l}() (fused multiply-add)
is preferable (or comparable) to separate multiply and add. This is
machine-dependent, and also, it's an instruction-set thing that the
compiler doubtless already knows; do gcc and/or clang provide backend
support we could hook up to?
>How-To-Repeat:
n/a
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 09 Sep 2024 15:08:38 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-10 and pullup-9
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/56234 CVS commit: src/include
Date: Mon, 9 Sep 2024 15:05:51 +0000
Module Name: src
Committed By: riastradh
Date: Mon Sep 9 15:05:51 UTC 2024
Modified Files:
src/include: math.h
Log Message:
math.h: Define FP_FAST_FMA, FP_FAST_FMAF, FP_FAST_FMAL.
These are not strictly necessary to define, really, so we haven't
exactly been nonconformant. But they tell programs when they can
enable fast paths by using the fma(3) family of functions.
PR standards/56234: missing C99 frobs in <math.h>
To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/include/math.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/56234 CVS commit: src
Date: Mon, 9 Sep 2024 15:06:30 +0000
Module Name: src
Committed By: riastradh
Date: Mon Sep 9 15:06:29 UTC 2024
Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/include: math.h
src/tests/lib/libm: Makefile
Log Message:
math.h: Add math_errhandling, MATH_ERRNO, MATH_ERREXCEPT.
XXX Should maybe put a __math_errhandling in machine/math.h, but only
VAX uses MATH_ERRNO and that's not likely to change any time soon, so
this will serve for now with less churn.
PR standards/56234: missing C99 frobs in <math.h>
To generate a diff of this commit:
cvs rdiff -u -r1.447 -r1.448 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1336 -r1.1337 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.71 -r1.72 src/include/math.h
cvs rdiff -u -r1.49 -r1.50 src/tests/lib/libm/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/56234 CVS commit: src/tests/lib/libm
Date: Mon, 9 Sep 2024 15:08:23 +0000
Module Name: src
Committed By: riastradh
Date: Mon Sep 9 15:08:23 UTC 2024
Added Files:
src/tests/lib/libm: t_errhandling.c
Log Message:
math.h: Add missing file for math_errhandling test.
PR standards/56234: missing C99 frobs in <math.h>
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/lib/libm/t_errhandling.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
Cc:
Subject: Re: standards/56234 (missing C99 frobs in <math.h>)
Date: Tue, 10 Sep 2024 17:29:58 +0000
Missed a spot:
https://mail-index.netbsd.org/source-changes/2024/09/09/msg153242.html
Module Name: src
Committed By: jakllsch
Date: Mon Sep 9 17:03:09 UTC 2024
Modified Files:
src/tests/lib/libm: t_errhandling.c
Log Message:
Add __TEST_FENV define to fix vax build
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libm/t_errhandling.c
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/56234 CVS commit: src/tests/lib/libm
Date: Tue, 10 Sep 2024 17:36:12 +0000
Module Name: src
Committed By: riastradh
Date: Tue Sep 10 17:36:12 UTC 2024
Modified Files:
src/tests/lib/libm: t_errhandling.c
Log Message:
libm/t_errhandling.c: Put __TEST_FENV before any #includes.
This pattern avoids any potential problem with transitive inclusions
of fenv.h. (No change here because nothing else this file includes
transitively pulls in fenv.h, but being in the habit of doing it this
way avoids a class of problems.)
PR standards/56234: missing C99 frobs in <math.h>
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libm/t_errhandling.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(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.