Average Error: 37.8 → 25.6
Time: 5.0s
Precision: binary64
\[\]
\[\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original37.8
Target25.5
Herbie25.6
\[\]

Derivation

  1. Split input into 3 regimes
  2. if x < -3.04950141066242941e153

    1. Initial program 63.9

      \[\]
    2. Taylor expanded around -inf 15.0

      \[\leadsto \]
    3. Simplified15.0

      \[\leadsto \]

    if -3.04950141066242941e153 < x < 1.2356342879637884e50

    1. Initial program 28.9

      \[\]
    2. Taylor expanded around 0 28.9

      \[\leadsto \]
    3. Simplified28.9

      \[\leadsto \]

    if 1.2356342879637884e50 < x

    1. Initial program 48.7

      \[\]
    2. Using strategy rm
    3. Applied add-cube-cbrt48.7

      \[\leadsto \]
    4. Applied *-un-lft-identity48.7

      \[\leadsto \]
    5. Applied times-frac48.7

      \[\leadsto \]
    6. Applied sqrt-prod48.8

      \[\leadsto \]
    7. Simplified48.8

      \[\leadsto \]
    8. Taylor expanded around inf 21.9

      \[\leadsto \]
    9. Simplified21.9

      \[\leadsto \]
  3. Recombined 3 regimes into one program.
  4. Final simplification25.6

    \[\leadsto \]

Reproduce

herbie shell --seed 2020191 
(FPCore (x y z)
  :name "Data.Array.Repa.Algorithms.Pixel:doubleRmsOfRGB8 from repa-algorithms-3.4.0.1"
  :precision binary64

  :herbie-target
  (if (< z -6.396479394109776e+136) (/ (neg z) (sqrt 3.0)) (if (< z 7.320293694404182e+117) (/ (sqrt (+ (+ (* z z) (* x x)) (* y y))) (sqrt 3.0)) (* (sqrt 0.3333333333333333) z)))

  (sqrt (/ (+ (+ (* x x) (* y y)) (* z z)) 3.0)))