standards/56906: Several math(3) functions fail to set errno on
a domain error
Stefan Farfeleder
stefan at fafoe.narf.at
Tue Sep 16 06:10:22 PDT 2003
The following reply was made to PR standards/56906; it has been noted by GNATS.
From: Stefan Farfeleder <stefan at fafoe.narf.at>
To: Bruce Evans <bde at zeta.org.au>
Cc: bug-followup at freebsd.org, freebsd-standards at freebsd.org
Subject: Re: standards/56906: Several math(3) functions fail to set errno on a domain error
Date: Tue, 16 Sep 2003 15:08:07 +0200
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Tue, Sep 16, 2003 at 11:42:44AM +1000, Bruce Evans wrote:
> On Tue, 16 Sep 2003, Stefan Farfeleder wrote:
>
> > >Synopsis: Several math(3) functions fail to set errno on a domain error
>
> This is intentional.
>
> > >Description:
> > ISO C90 says that errno must be set to EDOM if a domain error occurs.
>
> As you probably know, C99 doesn't require this. FreeBSD, or at least I,
> decided not to support C90's relatively feeble and broken specification
> of floating point and wait for C99 to get it right. The wait is long
> over and the nonstandardness is now a little different.
Hm, having a conforming C90 environment would be nice despite C99's
existence as older compliant applications may depend on the former
behaviour and don't become magically C99 conformant. Is there a chance
to have a separated C90 compliant libm?
Anyway, here's a patch to give C99 application at least the possibility
to notice that errno doesn't get set for these functions. Because we
don't have <fenv.h> to access the floating point status flags, I'm
setting math_errhandling to 0.
Stefan
--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="math_errhandling.diff"
Index: src/lib/msun/src/math.h
===================================================================
RCS file: /usr/home/ncvs/src/lib/msun/src/math.h,v
retrieving revision 1.26
diff -u -r1.26 math.h
--- src/lib/msun/src/math.h 22 May 2003 17:07:57 -0000 1.26
+++ src/lib/msun/src/math.h 16 Sep 2003 12:31:42 -0000
@@ -339,4 +339,10 @@
#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
__END_DECLS
+#if __ISO_C_VISIBLE >= 1999
+#define MATH_ERRNO 1
+#define MATH_ERREXCEPT 2
+#define math_errhandling 0
+#endif
+
#endif /* !_MATH_H_ */
--tThc/1wpZn/ma/RB--
More information about the freebsd-standards
mailing list