Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Mar 2004 23:21:41 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Stefan Farfeleder <stefan@fafoe.narf.at>
Cc:        bug-followup@freebsd.org
Subject:   Re: standards/56906: Several math(3) functions fail to set errno on a domain error
Message-ID:  <20040312230554.V10266@gamplex.bde.org>
In-Reply-To: <20030916130805.GD697@wombat.fafoe.narf.at>
References:  <20030915225329.95B30498@frog.fafoe.narf.at> <20030916130805.GD697@wombat.fafoe.narf.at>

next in thread | previous in thread | raw e-mail | index | archive | help
Long ago, on Tue, 16 Sep 2003, Stefan Farfeleder wrote:

> On Tue, Sep 16, 2003 at 11:42:44AM +1000, Bruce Evans wrote:
> > On Tue, 16 Sep 2003, Stefan Farfeleder wrote:
> > > >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.  ...
>
> 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?

Looks like not a large chance :-).  Old applications have somehow dealt
with FreeBSD's libm not having C90-conformant error handling for 10+
years, so fixing this doesn't seem urgent.

> 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.

Committed with minor reordering.  I wasn't sure about the C99 visibility
ifdef because my (draft) copy of C99 doesn't have MATH_ERRO, but
POSIX.1-2001 doesn't say that it is an extension and glibc uses the same
ifdef, so I assumed that the ifdef is correct.

David Schulz has <fenv.h> almost ready, but we are still missing both a
compiler that actually understands <fenv.h> and sources that set the
exception flags in a way that doesn't get optimized (FENV_ACCESS should
make the current code work, but is not supported by the compiler, and
changing all the flags-setting hacks like huge*huge to explicitly set
exception flags would require large changes).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040312230554.V10266>