Sun Studio 12: C User's Guide

F.2.7 Arithmetic Operations on Exceptional Values

This section describes the results derived from applying the basic arithmetic operations to combinations of exceptional and ordinary floating-point values. The information that follows assumes that no traps or any other exception actions are taken.

The following table explains the abbreviations:

Table F–16 Abbreviation Usage

Abbreviation 

Meaning  

Num 

Subnormal or normal number 

Inf 

Infinity (positive or negative) 

NaN 

Not a number 

Uno 

Unordered 

The following tables describe the types of values that result from arithmetic operations performed with combinations of different types of operands.

Table F–17 Addition and Subtraction Results

 

Right Operand: 0 

Right Operand: Num 

Right Operand: Inf 

Right Operand: NaN 

Left Operand: 0  

Num 

Inf 

NaN 

Left Operand: Num  

Num 

See [Num + Num could be Inf, rather than Num, when the result is too large (overflow). Inf + Inf = NaN when the infinities are of opposite sign.]

Inf 

NaN 

Left Operand: Inf  

Inf 

Inf 

See

NaN 

Left Operand: NaN  

NaN 

NaN 

NaN 

NaN 

Table F–18 Multiplication Results

 

Right Operand:0  

Right Operand:Num  

Right Operand:Inf  

Right Operand:NaN  

Left Operand:0  

NaN 

NaN 

Left Operand: Num  

Num 

Inf 

NaN 

Left Operand: Inf  

NaN 

Inf 

Inf 

NaN 

Left Operand: NaN  

NaN 

NaN 

NaN 

NaN 

Table F–19 Division Results

 

Right Operand:0  

Right Operand:Num  

Right Operand:Inf  

Right Operand:NaN  

Left Operand:0  

NaN 

NaN 

Left Operand: Num  

Inf 

Num 

NaN 

Left Operand: Inf  

Inf 

Inf 

NaN 

NaN 

Left Operand: NaN  

NaN 

NaN 

NaN 

NaN 

Table F–20 Comparison Results

 

Right Operand:0  

Right Operand:+Num  

Right Operand:+Inf  

Right Operand:+NaN  

Left Operand:0  

Uno 

Left Operand: +Num  

The result of the comparison 

Uno 

Left Operand: +Inf  

Uno 

Left Operand: +NaN  

Uno 

Uno 

Uno 

Uno 


Note –

NaN compared with NaN is unordered, and results in inequality. +0 compares equal to- 0.