Subnormal numbers to zero
Subnormal numbers cause a significant slowdown on modern CPUs. Worse, this may be hard to track down because these performance problems can occur only when the inputs take certain values. For the same algorithm, the problem may manifest as unexplained, intermittent slowdowns. Computations are fast for some inputs, but slow for other values of inputs.
One solution would be to force all subnormal numbers to be treated as zero. This will set a CPU flag that discards all the subnormal numbers and uses zeros in its place. While this solves the performance problem, it should be used with care, as it may cause accuracy and numerical stability problems. In particular, it is no longer true that x-y = 0 => x = y, as we can ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access