Exception when converting float to double...
Posted on 2000-05-17
(this problem is similar to the previous "So what IS the range of double?")
float F = 1.0E-44;
double D = (double)F;
Running through this code results in a "Float invalid operation" exception. Notice that F receives an "unsafe" float value (i.e. outside of the designated range).
Thing is, F receives it's value as a result of some *legal* calculations. What is going on here, should one test the value of a float for legality after each float calculation? Something is obviously weird here... please advise!