News for hackers. Stuff that matters.
Re:Optimizations Enabled by -ffast-Math by stncls on Wednesday October 20, 2021 @08:33AM (#28929887)
An example use of Inf is bounds on a value. Say you want to express that x sometimes has upper and/or lower bounds. With Inf you can simply write

    l <= x <= u
accepting that l is sometimes -Inf and u is sometimes +Inf. Without Inf, you get four different cases to handle. This is particularly handy when operations get slightly more complex, like transforming

    l' <= x + b <= u'
into the canonical form above, for some finite b. With Inf you can simply write

    l = l' - b
    u = u' - b
and things will work as one expects. Again, without Inf, multiple cases to handle correctly.

There are no comments on this comment yet.