Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Mar 2002 19:20:13 -0800
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: Removing CSRG libm?
Message-ID:  <20020320192013.A42351@troutmask.apl.washington.edu>
In-Reply-To: <20020321121625.K12290-100000@gamplex.bde.org>; from bde@zeta.org.au on Thu, Mar 21, 2002 at 12:33:45PM %2B1100
References:  <20020320153229.A41158@troutmask.apl.washington.edu> <20020321121625.K12290-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 21, 2002 at 12:33:45PM +1100, Bruce Evans wrote:
> On Wed, 20 Mar 2002, Steve Kargl wrote:
> 
> I forgot about the missing __pure2 in <math.h>.  (It prevents gcc
> doing optimizations like moving sqrt(2) out of loops.) There is
> another thread on freebsd-standards about _MULTI_LIBM support.  I

I'm not subscribed to freebsd-standards.  Too many list, too
little time.  I guess I'll go browse the archive.

> want the errno support completely removed so that we have a chance
> of declaring math functions as __pure2 unconditionally.  But maybe
> we can't do this anyway, because math functions normally have the
> side effect of setting IEEE exception flags.  Can we do things like
> 
> #ifpragma STDC FENV_ACCESS ON
> double sqrt(double);
> #else
> double sqrt(double) __pure2;
> #endif
> 
> ?

I don't know.  I forgot about the libm PR until last
week when someone else posted about paranoi.c failing
several tests.  I decided to check into the quality
of libm and work on improvements.  I still have a lot to
learn.

I think we'll only be able to add __pure2 on a case 
by case basis.  For example, the POSIX sqrt(3) manpage states 

   An application wishing to check for error situations should set
   errno to zero and call feclearexcept(FE_ALL_EXCEPT) before calling
   these functions.  On return, if errno is non-zero or
   fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW |FE_UNDERFLOW)
   is non-zero, an error has occurred.

> 
> > Also, are functions missing in libm with respect to the
> > C99 standard?  I would be willing to work on implementing
> > these functions.
> 
> Most are missing, if you count long double and complex support.  Only
> a few are, for double support.  I noticed some easy ones like
> isnormal() when I scanned the C99 draft standard today to check the
> status if infnan.3.

Garrett pointed me to the Open Group's docs.  I didn't know
the docs were available on-line.  Complex functions are
confined to complex.h.  I suppose we need to implement 
complex.h, but I'll probably concentrate on math.h.

-- 
Steve

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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