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 r899844 = 4.0;
        double r899845 = x;
        double r899846 = y;
        double r899847 = r899845 - r899846;
        double r899848 = z;
        double r899849 = 0.5;
        double r899850 = r899848 * r899849;
        double r899851 = r899847 - r899850;
        double r899852 = r899844 * r899851;
        double r899853 = r899852 / r899848;
        return r899853;
}

double f(double x, double y, double z) {
        double r899854 = 4.0;
        double r899855 = x;
        double r899856 = y;
        double r899857 = r899855 - r899856;
        double r899858 = z;
        double r899859 = r899857 / r899858;
        double r899860 = r899854 * r899859;
        double r899861 = 2.0;
        double r899862 = -r899861;
        double r899863 = r899860 + r899862;
        return r899863;
}

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