1*44022SbosticThese routines were produced by someone who is not a great authority on 2*44022Sbosticfloating point, and may not be entirely correct. Where possible I tested 3*44022Sbosticthe special cases for routines. 4*44022Sbostic 5*44022SbosticThe directory testieee contains test programs for IEEE-format machines. 6*44022SbosticI took a stab at making them work on the vax, but gave up as dealing with 7*44022Sbosticexceptions (e.g. underflow, overflow, reserved operand) was just too tedious. 8*44022Sbostic 9*44022SbosticNote: it is possible to build a library with MACHINE=ieee but a couple 10*44022Sbosticof warnings: 11*44022Sbostic 12*44022Sbostic Be careful when compiling floor.c. These routines rely on 13*44022Sbostic certain variables being only double precision. If these 14*44022Sbostic variables are placed in 68881 registers, they will be extended 15*44022Sbostic precision and the routines will produce incorrect results. 16*44022Sbostic Unless your compiler does its own register allocation, this 17*44022Sbostic is not likely to be a problem as none of the variables in 18*44022Sbostic question are declared "register". If you are using GCC 19*44022Sbostic you can specify -ffloat-store to avoid this problem. 20*44022Sbostic 21*44022Sbostic The C version of drem() in ieee/support.c appears to compute 22*44022Sbostic the incorrect results for drem(+-1, +-2). It yields 1 when 23*44022Sbostic it should be -1 and -1 when it should be 1. "should be" is 24*44022Sbostic based on what the VAX version yields and by cranking through 25*44022Sbostic the formula. 26*44022Sbostic 27*44022SbosticIf you do build using MACHINE=ieee and run the tests in testieee you 28*44022Sbosticwill note that some routines return errors: 29*44022Sbostic 30*44022Sbostic floor/ceil/rint report that they got 0 when expecting -0. 31*44022Sbostic Don't really know which is correct, is floor(-0) == 0 or -0? 32*44022Sbostic For C it shouldn't really matter since 0 is the same as -0 33*44022Sbostic in comparisons. 34*44022Sbostic 35*44022Sbostic scalb(-1, -2100) returns 0 instead of -0. 2 ** -2100 is 36*44022Sbostic effectively 0 but -anything * 0 == -0 according to the 68881. 37*44022Sbostic Similarly for scalb(-pi, 2100). It returns INF instead 38*44022Sbostic of -INF. 2 ** 2100 is effectively INF but -anything * INF 39*44022Sbostic is -INF. What is correct? 40*44022Sbostic 41*44022Sbostic drem(+-1, +-2) fails as mentioned above. This is a real error. 42*44022Sbostic 43*44022Sbostic---- 44*44022SbosticMike Hibler 45*44022SbosticU of Utah CS Dept. 46*44022Sbosticmike@cs.utah.edu 47