Average Error: 0.2 → 0.0
Time: 1.4s
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 r828290 = 4.0;
        double r828291 = x;
        double r828292 = y;
        double r828293 = r828291 - r828292;
        double r828294 = z;
        double r828295 = 0.5;
        double r828296 = r828294 * r828295;
        double r828297 = r828293 - r828296;
        double r828298 = r828290 * r828297;
        double r828299 = r828298 / r828294;
        return r828299;
}

double f(double x, double y, double z) {
        double r828300 = 4.0;
        double r828301 = x;
        double r828302 = y;
        double r828303 = r828301 - r828302;
        double r828304 = z;
        double r828305 = r828303 / r828304;
        double r828306 = r828300 * r828305;
        double r828307 = 2.0;
        double r828308 = -r828307;
        double r828309 = r828306 + r828308;
        return r828309;
}

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 2020021 
(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))