📜 ⬆️ ⬇️

What is -1. # IND and -1. # J?


Any experienced programmer knows that the standard for representing floating-point values ​​( IEEE 754 ) leaves several reserved values ​​corresponding to non-numbers (NaN, not-a-number). The Visual C standard library prints non-numbers like this:
PrintedMeans
1.#INFPositive infinity
-1.#INFNegative infinity
1.#SNANPositive signal non-number (signaling NaN)
-1.#SNANNegative signal non-number (signaling NaN)
1.#QNANPositive non-signal non-number (quiet NaN)
-1.#QNANNegative non-signal non-number (quiet NaN)
1.#INDPositive uncertainty
-1.#INDNegative uncertainty
Positive and negative infinity can be obtained when overflow occurs as a result of arithmetic - for example, when dividing by zero, or when taking the logarithm from a positive zero. (According to the IEEE standard, any floating point value has a definite sign - not only non-numbers exist in positive and negative variants, but also two zeros.)

Signal and non-signal non-numbers, as a rule, are not obtained as a result of calculations, but are generated by the program intentionally - for example, in C ++ you can get them by calling the signaling_NaN() or quiet_NaN() methods of the std::numeric_limits. , -- " ", " " .. - -, .. , .

- , runtime- Visual C , . , , , : , 1.#INF -1.#INF , . , -, -- . , . x86 - , .

(. .: , x86 -1.#INF , -- -1.#IND )

, - .
, 1.#J :
double z = 0; printf("%.2f", 1/z);
1.#INF , runtime- - . , - " 1. " -- , . , " #I ", "" -- " N " -- 5, "" " J ".

-- J, I, ?

- ; , , -- , , 1.#J .

, () I Ü . 1.#INF 1.#Ü , über-.
std::numeric_limits. , -- " ", " " .. - -, .. , .

- , runtime- Visual C , . , , , : , 1.#INF
-1.#INF , . , -, -- . , . x86 - , .

(. .: , x86 -1.#INF , -- -1.#IND )

, - .
, 1.#J :
double z = 0; printf("%.2f", 1/z);
1.#INF , runtime- - . , - " 1. " -- , . , " #I ", "" -- " N " -- 5, "" " J ".

-- J, I, ?

- ; , , -- , , 1.#J .

, () I Ü . 1.#INF 1.#Ü , über-.
 std::numeric_limits. ,                -- " ", " "  ..     -    -, ..       ,      . 

- , runtime- Visual C , . , , , : , 1.#INF
-1.#INF , . , -, -- . , . x86 - , .

(. .: , x86 -1.#INF , -- -1.#IND )

, - .
, 1.#J :
double z = 0; printf("%.2f", 1/z);
1.#INF , runtime- - . , - " 1. " -- , . , " #I ", "" -- " N " -- 5, "" " J ".

-- J, I, ?

- ; , , -- , , 1.#J .

, () I Ü . 1.#INF 1.#Ü , über-.
std::numeric_limits. , -- " ", " " .. - -, .. , .

- , runtime- Visual C , . , , , : , 1.#INF
-1.#INF , . , -, -- . , . x86 - , .

(. .: , x86 -1.#INF , -- -1.#IND )

, - .
, 1.#J :
double z = 0; printf("%.2f", 1/z);
1.#INF , runtime- - . , - " 1. " -- , . , " #I ", "" -- " N " -- 5, "" " J ".

-- J, I, ?

- ; , , -- , , 1.#J .

, () I Ü . 1.#INF 1.#Ü , über-.

')

Source: https://habr.com/ru/post/171203/


All Articles