Question

In the standard, representation of NaN and INF is like this:

For NaN: exponent = emax+1 & mantissa != 0;

For INF: exponent = emax+1 & mantissa = 0;

Their are many ways and calculations resulting these two value.

But what ACTUALLY is NaN(INF)?

And HOW does the system "decide" or "judge" to store value as these one(two)?

Here may be a case seeming to be odd to me:

a = b = 1*2(emax);

then calculating c = a+b, the actual result is 1*2^(emax+1);

Now, c is not an available FP value according to the standard;

then how does the system store c in device?

Is it NaN?

If yes, how can this be even reasonable?

I mean, 1*2^(emax+1) IS(Should be) a Number...in a common sense...?

If this is the case, then how ACTUALLY does the standard think what a NaN is?

If not, then how do we deal with this???

I'm considering one like this:

let eM = emax+1;

then 1d.d...d * 2^(eM-1) = 1d.d...d * 2^(emax)

with 1d.d...d having legal number of digits by the system.

This is actually a way like that dealing with denormalized number.


The thing here is this:

Is the judgement posterior or prior to the completion of calculation?

If it's the former, the above may be a problem or not?

On the other hand, then the task seems undonable...

Is there anyone ever thinking about this issue?

Thx for considering it!!

Note: things for +-INF are also presented.

No correct solution

OTHER TIPS

From Wikipedia:

The five possible exceptions are:

  • Invalid operation (e.g., square root of a negative number) (returns qNaN by default).
  • Division by zero (an operation on finite operands gives an exact infinite result, e.g., 1/0 or log(0)) (returns ±infinity by default).
  • Overflow (a result is too large to be represented correctly) (returns ±infinity by default (for round-to-nearest mode)).
  • Underflow (a result is very small (outside the normal range) and is inexact) (returns a denormalized value by default).
  • ...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top