Average Error: 0.1 → 0.0
Time: 9.7s
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 r57731174 = 4.0;
        double r57731175 = x;
        double r57731176 = y;
        double r57731177 = r57731175 - r57731176;
        double r57731178 = z;
        double r57731179 = 0.5;
        double r57731180 = r57731178 * r57731179;
        double r57731181 = r57731177 - r57731180;
        double r57731182 = r57731174 * r57731181;
        double r57731183 = r57731182 / r57731178;
        return r57731183;
}

double f(double x, double y, double z) {
        double r57731184 = 4.0;
        double r57731185 = x;
        double r57731186 = y;
        double r57731187 = r57731185 - r57731186;
        double r57731188 = z;
        double r57731189 = r57731187 / r57731188;
        double r57731190 = r57731184 * r57731189;
        double r57731191 = 2.0;
        double r57731192 = r57731190 - r57731191;
        return r57731192;
}

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 2019174 
(FPCore (x y z)
  :name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, B"

  :herbie-target
  (- (* 4.0 (/ x z)) (+ 2.0 (* 4.0 (/ y z))))

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