# Effective Implementation of Edge-Preserving Filtering on CPU Microarchitectures
## 3 Floating Point Numbers and Denormalized Numbers in IEEE Standard 754  
The formats of floating point numbers are defined in IEEE Standard 754 [37]. The floating point number is composed of a set of normal numbers and four special numbers, which are _not a number (NaN), infinities, zeroes_ and _denormalized (or subnormal) numbers_. The normal numbers are represented as follows:  
\[(-1)^{sign}\times 2^{exponent-bias}\times 1.fraction. \tag{7}\]  
In a single-precision floating point number (float), parameters are as follows: bit length of \(exponent\) is 8 bit; that of \(fraction\) is 23 bit; \(bias=127\). In a single-precision floating point number (double), parameters are as follow: bit length of \(exponent\) is 11 bit; that of \(fraction\) is 52 bit; \(bias=1023\). In the normal number, \(exponent\) is neither zero nor the maximum value of \(exponent\). In the special numbers, \(exponent\) is zero or it has the maximum value of \(exponent\). When \(exponent\) and \(fraction\) are zero, the format represents zero. When \(exponent\) of a given number has the maximum value, the format represents infinity or NaN. In the case of the denormalized numbers, \(exponent\) is zero, but \(fraction\) is not zero. The denormalized numbers are represented as follows:  
\[(-1)^{sign}\times 2^{1-bias}\times 0.fraction. \tag{8}\]  
Note that \(exponent\) is set to zero for the special number flags, but \(exponent\) can be forcefully regarded as one even if the settled value is zero. The range of magnitudes of the denormalized numbers is smaller than that of the normal numbers. In terms of float, the range of magnitudes of the normal numbers is \(1.17549435\times 10^{-38}\leq|x|\leq 3.402823466\times 10^{38}\), while that of the denormalized numbers is \(1.40129846\times 10^{-45}\leq|x|\leq 1.17549421\times 10^{-38}\). Typical processing units are optimized for the normal numbers. Thus, the normal numbers are processed using specialized hardware. By contrast, the denormalized numbers are processed using general hardware. Therefore, the computational cost of handling the denormalized numbers is higher than that of the normal numbers. There are three built-in methods for suppressing the speed reduction caused by the denormalized numbers. The first approach is computation with high-precision numbers. A high-precision number format has a large range of magnitudes in a normal number. In float, most denormalized numbers are represented by normal numbers in double. However, the bit length of double is longer than that of float. Thus, computational performance degrades owing to the increased cost of memory write/read operations. The second approach is computation with the flush to zero (FTZ) and denormals are zero (DAZ) flags. These flags are implemented in most CPUs and GPUs. If the FTZ flag is enabled, the invalid result of an operation is set to zero. The invalid result is an underflow flag or a denormalized number. If the DAZ flag is enabled, an operand in assembly language is set to zero when the operand is already a denormalized number. When the computing results are denormalized numbers or operands are already denormalized numbers, the DAZ flag ensures the denormalized numbers are set to zero. These flags suppress the occurrence of denormalized numbers; thereby, computing is accelerated. However, computation with these flags has events that convert denormalized numbers to normal numbers. Hence, the calculation time with these flags is not the same as that without denormalized numbers. In the third approach, a denormalized number is converted into a normal number by a min or max operation. This approach forcibly clips a calculated value to a normal number in the calculation, whether the calculated value is a denormalized number or not. The approach suppresses the denormalized numbers after their occurrence. Thus, it is not optimal for accelerating computation.