Average Error: 0.1 → 0.0
Time: 4.4s
Precision: 64
\[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}\]
\[4 \cdot \frac{x - y}{z} - 2\]
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
4 \cdot \frac{x - y}{z} - 2
double f(double x, double y, double z) {
        double r521264 = 4.0;
        double r521265 = x;
        double r521266 = y;
        double r521267 = r521265 - r521266;
        double r521268 = z;
        double r521269 = 0.5;
        double r521270 = r521268 * r521269;
        double r521271 = r521267 - r521270;
        double r521272 = r521264 * r521271;
        double r521273 = r521272 / r521268;
        return r521273;
}

double f(double x, double y, double z) {
        double r521274 = 4.0;
        double r521275 = x;
        double r521276 = y;
        double r521277 = r521275 - r521276;
        double r521278 = z;
        double r521279 = r521277 / r521278;
        double r521280 = r521274 * r521279;
        double r521281 = 2.0;
        double r521282 = r521280 - r521281;
        return r521282;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.1
Target0.0
Herbie0.0
\[4 \cdot \frac{x}{z} - \left(2 + 4 \cdot \frac{y}{z}\right)\]

Derivation

  1. Initial program 0.1

    \[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{4 \cdot \frac{x}{z} - \left(4 \cdot \frac{y}{z} + 2\right)}\]
  3. Simplified0.0

    \[\leadsto \color{blue}{4 \cdot \frac{x - y}{z} - 2}\]
  4. Final simplification0.0

    \[\leadsto 4 \cdot \frac{x - y}{z} - 2\]

Reproduce

herbie shell --seed 2019305 
(FPCore (x y z)
  :name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, B"
  :precision binary64

  :herbie-target
  (- (* 4 (/ x z)) (+ 2 (* 4 (/ y z))))

  (/ (* 4 (- (- x y) (* z 0.5))) z))