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

## Advertising

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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message