mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Produce IEEE compliant output from pow() despite platform deviations
src/cmd/ksh93/features/math.sh: - Specify ast_float.h within iffehdrs instead of math.h, so that iffe will pick up on macro substitutions within libast. This should make any future efforts to remedy floating point behavior easier as well. - Always include ast_float.h within the generated math header file, not just on IA64 platforms. src/cmd/ksh93/tests/arith.sh: - Test pow(1.0,-Inf) and pow(1.0,NaN) for IEEE compliance as well. - Test the exponentiation operator (**) in addition, as streval.c, which processes the same, calls pow() separately. src/lib/libast/features/float: - Test the IEEE compliance of the underlying math library's pow() function and substitute macros producing compliant behavior if necessary.
This commit is contained in:
parent
0f92d63823
commit
d5a94b3722
3 changed files with 25 additions and 2 deletions
|
@ -1230,3 +1230,16 @@ tst - -DSCAN=1 - -lm -DSTRTO=1 - -DMAC=1 - -DDIV=1 - -DEXP=1 - -DADD=1 - -DMPY=1
|
|||
return 0;
|
||||
}
|
||||
}end
|
||||
|
||||
tst ast_pow_ieee -lm note{ pow(1,inf) is IEEE compliant }end execute{
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
int main() { return pow(1.0, 1.0 / 0.0) != 1.0; }
|
||||
}end fail{
|
||||
echo '#define powf(x,y) (((x)==1.0)?1.0:powf((x),(y)))'
|
||||
echo '#define pow(x,y) (((x)==1.0)?1.0:pow((x),(y)))'
|
||||
echo '#define powl(x,y) (((x)==1.0)?1.0:powl((x),(y)))'
|
||||
}end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue