From owner-freebsd-standards@FreeBSD.ORG Tue Sep 16 06:08:12 2003 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 34C5916A4B3; Tue, 16 Sep 2003 06:08:12 -0700 (PDT) Received: from fafoe.narf.at (chello212186121237.14.vie.surfer.at [212.186.121.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2132243FA3; Tue, 16 Sep 2003 06:08:11 -0700 (PDT) (envelope-from stefan@fafoe.narf.at) Received: from wombat.fafoe.narf.at (wombat.fafoe.narf.at [192.168.2.102]) by fafoe.narf.at (Postfix) with ESMTP id 22364411E; Tue, 16 Sep 2003 15:08:08 +0200 (CEST) Received: by wombat.fafoe.narf.at (Postfix, from userid 1001) id D2602D1; Tue, 16 Sep 2003 15:08:07 +0200 (CEST) Date: Tue, 16 Sep 2003 15:08:07 +0200 From: Stefan Farfeleder To: Bruce Evans Message-ID: <20030916130805.GD697@wombat.fafoe.narf.at> References: <20030915225329.95B30498@frog.fafoe.narf.at> <20030916104414.H2924@gamplex.bde.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="tThc/1wpZn/ma/RB" Content-Disposition: inline In-Reply-To: <20030916104414.H2924@gamplex.bde.org> User-Agent: Mutt/1.5.4i cc: freebsd-standards@freebsd.org cc: bug-followup@freebsd.org Subject: Re: standards/56906: Several math(3) functions fail to set errno on a domain error X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Sep 2003 13:08:12 -0000 --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 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--