‹ BackHN Continuity

Thread

Subnormal floating-point numbers are expensive on Intel processors

69 points · 54 comments · zdw

  1. khuey · · focus · HN ↗
    If you don't _need_ subnormals MXCSR.DAZ/FTZ (which you can get gcc to set via -mdaz-ftz) will let you ignore all of this.
    1. adrian_b · · focus · HN ↗
      Most people who believe that they do not need subnormals do not actually know whether they need or not subnormals and it is very likely that they need subnormals.

      The options mentioned above are guaranteed to generate big errors, so they are acceptable only when errors really do not matter, e.g. in graphics for games.

      The only correct option for avoiding subnormals is to enable the underflow exception and handle it in a manner that is considered more suitable for that application than the use of subnormals.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.