Re: Removing CSRG libm?
On Wed, 20 Mar 2002, Steve Kargl wrote: On Thu, Mar 21, 2002 at 12:33:45PM +1100, Bruce Evans wrote: 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. The documenation for FENV_ACCESS is clear enough. We can do things like this: - default to FENV_ACCESS OFF - do optimizations like the above except in those few programs that actually understand this stuff and set FENV_ACCESS to ON before they use the IEEE flags. - to work right, FENV_ACCESS ON must somehow turn off many of the optimizations related to floating point. Compilers will need special support just to turn off their own optimization. E.g., constant expressions can only be fully computed at compile time if the result (including the IEEE flag settings) doesn't depending on the environment. I think we'll only be able to add __pure2 on a case by case basis. For example, the POSIX sqrt(3) manpage states glibc (an old version -- 2.1.3) only uses (the equivalent of) it for functions like isinf() which are guaranteed not to change the IEEE flags. 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, the program must set FENV_ACCESS to ON in relevant parts of the code if it wishes to test the flags. Bruce To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: Removing CSRG libm?
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 [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: Removing CSRG libm?
On Sat, 16 Mar 2002, Steve Kargl wrote: A long time ago I submitted PR misc/17848 which removes CSRG libm sources. The audit trail shows some commentary, but AFAICT nothing much has been done based on that commentary. With the upcoming release of of 5.0, I think we should consider the removal od CSRG libm and the repo copying of msun to libm; otherwise we'll drag CSRG libm around until 6.0. OK, I will remove libm after repo-copying the interesting parts of it to libm. I'm not sure about repo-copying msun back to libm. It would would only create a small mess because they have only one file in common (the top-level Makefile). In general, repo-copying back can't be done without creating a large mess, because copying would clobber all the old history. Bruce To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: Removing CSRG libm?
On Thu, Mar 21, 2002 at 10:19:13AM +1100, Bruce Evans wrote: On Sat, 16 Mar 2002, Steve Kargl wrote: A long time ago I submitted PR misc/17848 which removes CSRG libm sources. The audit trail shows some commentary, but AFAICT nothing much has been done based on that commentary. With the upcoming release of of 5.0, I think we should consider the removal od CSRG libm and the repo copying of msun to libm; otherwise we'll drag CSRG libm around until 6.0. OK, I will remove libm after repo-copying the interesting parts of it to libm. I'm not sure about repo-copying msun back to libm. It would would only create a small mess because they have only one file in common (the top-level Makefile). In general, repo-copying back can't be done without creating a large mess, because copying would clobber all the old history. Bruce, I re-read the audit trail of the PR. You list two items: gamma() should become tgamma(); and, (lack of) the use of __pure2. I was planning to compare our msun against NetBSD and merge any appropriate changes (if any exists). Do you have any patches for msun that you might commit in the future? Also, are functions missing in libm with respect to the C99 standard? I would be willing to work on implementing these functions. -- Steve To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: Removing CSRG libm?
On Wed, 20 Mar 2002, Steve Kargl wrote: I re-read the audit trail of the PR. You list two items: gamma() should become tgamma(); and, (lack of) the use of __pure2. I was planning to compare our msun against NetBSD and merge any appropriate changes (if any exists). Do you have any patches for msun that you might commit in the future? I created tgamma() from the BSD gamma() and will commit after a repo-copy. The changes are simple, and clean enough except gamma.c needs parts of exp.c and log.c. 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 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 ? 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. Bruce To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message
Re: Removing CSRG libm?
In message [EMAIL PROTECTED], Steve Kargl wr ites: A long time ago I submitted PR misc/17848 which removes CSRG libm sources. The audit trail shows some commentary, but AFAICT nothing much has been done based on that commentary. With the upcoming release of of 5.0, I think we should consider the removal od CSRG libm and the repo copying of msun to libm; otherwise we'll drag CSRG libm around until 6.0. Good idea. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 [EMAIL PROTECTED] | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-current in the body of the message