Average Error: 0.2 → 0.0
Time: 3.3s
Precision: 64
\[\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}\]
\[4 \cdot \left(\frac{x - y}{z} - \frac{1}{2}\right)\]
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
4 \cdot \left(\frac{x - y}{z} - \frac{1}{2}\right)
double f(double x, double y, double z) {
        double r478241 = 4.0;
        double r478242 = x;
        double r478243 = y;
        double r478244 = r478242 - r478243;
        double r478245 = z;
        double r478246 = 0.5;
        double r478247 = r478245 * r478246;
        double r478248 = r478244 - r478247;
        double r478249 = r478241 * r478248;
        double r478250 = r478249 / r478245;
        return r478250;
}

double f(double x, double y, double z) {
        double r478251 = 4.0;
        double r478252 = x;
        double r478253 = y;
        double r478254 = r478252 - r478253;
        double r478255 = z;
        double r478256 = r478254 / r478255;
        double r478257 = 1.0;
        double r478258 = 2.0;
        double r478259 = r478257 / r478258;
        double r478260 = r478256 - r478259;
        double r478261 = r478251 * r478260;
        return r478261;
}

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. Using strategy rm
  3. Applied *-un-lft-identity0.2

    \[\leadsto \frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{\color{blue}{1 \cdot z}}\]
  4. Applied times-frac0.0

    \[\leadsto \color{blue}{\frac{4}{1} \cdot \frac{\left(x - y\right) - z \cdot 0.5}{z}}\]
  5. Simplified0.0

    \[\leadsto \color{blue}{4} \cdot \frac{\left(x - y\right) - z \cdot 0.5}{z}\]
  6. Simplified0.0

    \[\leadsto 4 \cdot \color{blue}{\frac{\left(x - y\right) - z \cdot \frac{1}{2}}{z}}\]
  7. Using strategy rm
  8. Applied clear-num0.2

    \[\leadsto 4 \cdot \color{blue}{\frac{1}{\frac{z}{\left(x - y\right) - z \cdot \frac{1}{2}}}}\]
  9. Taylor expanded around 0 0.0

    \[\leadsto 4 \cdot \color{blue}{\left(\frac{x}{z} - \left(\frac{y}{z} + 0.5\right)\right)}\]
  10. Simplified0.0

    \[\leadsto 4 \cdot \color{blue}{\left(\frac{x}{z} - \left(\frac{y}{z} + \frac{1}{2}\right)\right)}\]
  11. Final simplification0.0

    \[\leadsto 4 \cdot \left(\frac{x - y}{z} - \frac{1}{2}\right)\]

Reproduce

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