lee@unmvax.cs.unm.edu (Lee Ward) (04/30/91)
I've not used IEEE floating point implementations much but it seems to me that HUGE should be a large POSITIVE number. Instead, it is negative Infinity. I checked and HUGE is positive everywhere else I've looked. -- --Lee (Ward) ...!unmvax!tochtli!lee is preferred, or lee@unmvax.cs.unm.edu
lee@unmvax.cs.unm.edu (Lee Ward) (04/30/91)
Well, I found just what is generating negative Infinity. It's the bloody compiler! When a number equal to or larger than MAXDOUBLE is presented as a constant it sets the literal to 99e999, a negative number. The definition for HUGE is correct in math.h. I cured this problem by editing pass 1 of the C compiler and C++ compiler. If you want to do this, it goes like this: Do a cc -v and make sure you are using: NeXT Release 2.0 (v31.1) -- GNU version 1.36 If not, don't do this to be on the safe side. become root cd to /lib copy cc1 and cc1++ to some other names. I used cc1.OLD and cc1++.OLD emacs cc1 type ^S (that's control-S) followed by "999". No quotes... Then hit the escape key. You are positioned at the end of one of the nasty literal, "99e999". Now, using the backarrow key place the cursor on the first two nines. Hit delete twice Type "01". Again, no quotes... Hit the downarrow key twice and you are on the line with the other 99e999. Make the same changes here. Now, type ^X^C (control-X then control-C) Do the same thing for cc1++. From now on the compiler will generate HUGE (+Infinity) from <math.h> for overly large numbers instead of -Infinity. -- --Lee (Ward) ...!unmvax!tochtli!lee is preferred, or lee@unmvax.cs.unm.edu
madler@nntp-server.caltech.edu (Mark Adler) (04/30/91)
This is fixed in 2.1 where HUGE is defined as (1e999). Mark Adler madler@pooh.caltech.edu