[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Floating point problems



Hi!

On Sat, 28 Nov 1998, Johannes G.D. Hausmann wrote:
>> main() {
>>         double x = 1.0;
>>         x *= 1e-310;
>> }
>> 
>
>This is a denormal. From float.h:
>
>   /* Minimum normalised double */
>#undef DBL_MIN
>#define DBL_MIN 2.2250738585072014e-308

This does not seem to be the problem: I get the same results with
	double a = 1.0, b = 1e-310, c = a * b; printf("%lg\n", c):
This gives `1e-310' on intel, but an error on alpha.
OTOH, might it be related to storing the value? I get the same error
with { double a = 1e-310; float b = a; }, instead of zero like on
intel, but I get no error when I switch the values around in the
first example (didn't check wheter the compiler is cheating and
am away from my alpha at the moment).

MfG, Ulrich

--
"Never trust any ruler who puts his faith in tunnels and bunkers and escape
routes. The chances are that his heart isn't in the job."
                                           T. Pratchett, "Guards! Guards!"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []