Average Error: 0.2 → 0.0
Time: 1.7s
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 r824165 = 4.0;
        double r824166 = x;
        double r824167 = y;
        double r824168 = r824166 - r824167;
        double r824169 = z;
        double r824170 = 0.5;
        double r824171 = r824169 * r824170;
        double r824172 = r824168 - r824171;
        double r824173 = r824165 * r824172;
        double r824174 = r824173 / r824169;
        return r824174;
}

double f(double x, double y, double z) {
        double r824175 = 4.0;
        double r824176 = x;
        double r824177 = y;
        double r824178 = r824176 - r824177;
        double r824179 = z;
        double r824180 = r824178 / r824179;
        double r824181 = r824175 * r824180;
        double r824182 = 2.0;
        double r824183 = -r824182;
        double r824184 = r824181 + r824183;
        return r824184;
}

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