Troubles with Hewlett-Packard

Peter Shenkin uunet!still3.chem.columbia.edu!shenkin
Fri Mar 25 11:51:52 PST 1994


On Mar 24,  5:31pm, moleraMathWorks.Com wrote:
> Subject: Troubles with Hewlett-Packard

I had a similar problem on SGI.

I tried to generate a NaN at compile time by means of "y = 0.0L / 0.0L;"  
I got a compiler warning, and, when printing out y, it was equal to zero.

However:  the following code worked:

	double y, a=0, b=0;

	y = a / b;

	printf( "y= %lf\n", y );	/* correctly prints NaN */

Apparently, the compile-time arithmetic isn't up to snuff, though the
run-time stuff is fine.  I suspect that this is the problem you're 
encountering on HP.

I am always afraid that an optimizer will ruin the above fix, so one
needs a commandline flag to print the value of y (in this case) at
the start of a run, to see if it's right.

	-P.




More information about the Numeric-interest mailing list