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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 04 18:35:00 +0000 2021
>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:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.