Subject: Re: port-alpha/6634: divide by zero gives strange results on alpha
To: Tim Rightnour <>
From: Todd Vierling <>
List: netbsd-bugs
Date: 12/22/1998 16:06:47
On Tue, 22 Dec 1998, Tim Rightnour wrote:

: double i;
: float j;
: i = 12.0 / 0;
: printf("i: %f\n", i);
: j = 12.0 / 0;
: printf("j: %f\n", j);

This is not legal ANSI C, and "gcc -Wformat" should tell you about it.

The argument of %f is a double, not a float - what you end up with is a
double containing the bits of j and a float-sized array of random bits off
the stack.

The correct last statement should read:

printf("j: %f\n", (double)j);

-- Todd Vierling (Personal; Bus.