Average Error: 0.2 → 0.0
Time: 1.3s
Precision: 64
\[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}\]
\[4 \cdot \frac{x - y}{z} + \left(-2\right)\]
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
4 \cdot \frac{x - y}{z} + \left(-2\right)
double f(double x, double y, double z) {
        double r734451 = 4.0;
        double r734452 = x;
        double r734453 = y;
        double r734454 = r734452 - r734453;
        double r734455 = z;
        double r734456 = 0.5;
        double r734457 = r734455 * r734456;
        double r734458 = r734454 - r734457;
        double r734459 = r734451 * r734458;
        double r734460 = r734459 / r734455;
        return r734460;
}

double f(double x, double y, double z) {
        double r734461 = 4.0;
        double r734462 = x;
        double r734463 = y;
        double r734464 = r734462 - r734463;
        double r734465 = z;
        double r734466 = r734464 / r734465;
        double r734467 = r734461 * r734466;
        double r734468 = 2.0;
        double r734469 = -r734468;
        double r734470 = r734467 + r734469;
        return r734470;
}

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.2
Target0.0
Herbie0.0
\[4 \cdot \frac{x}{z} - \left(2 + 4 \cdot \frac{y}{z}\right)\]

Derivation

  1. Initial program 0.2

    \[\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} + \left(-2\right)}\]
  4. Final simplification0.0

    \[\leadsto 4 \cdot \frac{x - y}{z} + \left(-2\right)\]

Reproduce

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