Average Error: 37.6 → 24.7
Time: 4.2s
Precision: binary64
\[\]
\[\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original37.6
Target25.7
Herbie24.7
\[\]

Derivation

  1. Split input into 3 regimes
  2. if x < -1.4682484161638135e132

    1. Initial program 60.1

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

      \[\leadsto \]
    3. Simplified14.8

      \[\leadsto \]

    if -1.4682484161638135e132 < x < 3.0752650640767227e117

    1. Initial program 28.6

      \[\]
    2. Taylor expanded around 0 28.6

      \[\leadsto \]
    3. Simplified28.6

      \[\leadsto \]

    if 3.0752650640767227e117 < x

    1. Initial program 57.0

      \[\]
    2. Using strategy rm
    3. Applied add-cube-cbrt57.0

      \[\leadsto \]
    4. Applied *-un-lft-identity57.0

      \[\leadsto \]
    5. Applied times-frac57.0

      \[\leadsto \]
    6. Applied sqrt-prod57.0

      \[\leadsto \]
    7. Simplified57.0

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

      \[\leadsto \]
    9. Simplified16.6

      \[\leadsto \]
  3. Recombined 3 regimes into one program.
  4. Final simplification24.7

    \[\leadsto \]

Reproduce

herbie shell --seed 2020180 
(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)))