Average Error: 0.1 → 0.0
Time: 7.5s
Precision: 64
\[\frac{4.0 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}\]
\[\frac{x - y}{z} \cdot 4.0 - 2.0\]
\frac{4.0 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
\frac{x - y}{z} \cdot 4.0 - 2.0
double f(double x, double y, double z) {
        double r17834338 = 4.0;
        double r17834339 = x;
        double r17834340 = y;
        double r17834341 = r17834339 - r17834340;
        double r17834342 = z;
        double r17834343 = 0.5;
        double r17834344 = r17834342 * r17834343;
        double r17834345 = r17834341 - r17834344;
        double r17834346 = r17834338 * r17834345;
        double r17834347 = r17834346 / r17834342;
        return r17834347;
}

double f(double x, double y, double z) {
        double r17834348 = x;
        double r17834349 = y;
        double r17834350 = r17834348 - r17834349;
        double r17834351 = z;
        double r17834352 = r17834350 / r17834351;
        double r17834353 = 4.0;
        double r17834354 = r17834352 * r17834353;
        double r17834355 = 2.0;
        double r17834356 = r17834354 - r17834355;
        return r17834356;
}

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.0 \cdot \frac{x}{z} - \left(2.0 + 4.0 \cdot \frac{y}{z}\right)\]

Derivation

  1. Initial program 0.1

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

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

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

    \[\leadsto \frac{x - y}{z} \cdot 4.0 - 2.0\]

Reproduce

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