Date: Mon, 9 Jun 1997 17:43:42 -0700 (PDT) Message-Id: <199706100043.RAA07809@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: tudor AT cam DOT org From: Nate Eldredge Subject: Re: Possible bug? Cc: djgpp AT delorie DOT com Precedence: bulk Vic wrote: >Philip Ibis wrote: >> It might be due to the fact that I'm using v2.00, if so, then, oops. >I'm using 2.01 . >> Anyways... The following program gives my system a wedgie. >On mine it crashes. Tracebacks attached to the mail. >> ---- snip snip --- >> #include >> #include >> int main(void) >> { >> double n; >> memset(&n,0xFF,sizeof(double)); /* contrived, sure */ >> printf("%f\n",n); >> } > I'd say it's a good guess that a double made of 0xFF's is not a valid floating point number. I don't claim to be an 80x87 guru but I know you can't just load any old garbage into a FPU register and expect it to work. The reason it crases inside printf is that printf was the unlucky one who had to do floating point stuff to it :) (Before it just hung around on the stack.) I can't see any reason why you'd want to have a double of 0xFF's. This is why you convert to doubles with = and not memset(). Floating point numbers are formatted all funny, with mantissas, exponents, and all that good stuff. :) If you want the largest allowable double, you have MAXDOUBLE from . If you're *really* interested, you could read some IEEE standards. (yeah, right.) So, in answer to the problem, "don't do that, then." ;-) -------------------- Nate Eldredge eldredge AT ap DOT net