Average Error: 0.1 → 0.0
Time: 5.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 r44759495 = 4.0;
        double r44759496 = x;
        double r44759497 = y;
        double r44759498 = r44759496 - r44759497;
        double r44759499 = z;
        double r44759500 = 0.5;
        double r44759501 = r44759499 * r44759500;
        double r44759502 = r44759498 - r44759501;
        double r44759503 = r44759495 * r44759502;
        double r44759504 = r44759503 / r44759499;
        return r44759504;
}

double f(double x, double y, double z) {
        double r44759505 = x;
        double r44759506 = y;
        double r44759507 = r44759505 - r44759506;
        double r44759508 = z;
        double r44759509 = r44759507 / r44759508;
        double r44759510 = 4.0;
        double r44759511 = r44759509 * r44759510;
        double r44759512 = 2.0;
        double r44759513 = r44759511 - r44759512;
        return r44759513;
}

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