Average Error: 0.1 → 0.0
Time: 6.7s
Precision: 64
\[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}\]
\[4 \cdot \left(0.25 - \frac{z}{y}\right) + \left(\frac{x}{y} \cdot 4 + 1\right)\]
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
4 \cdot \left(0.25 - \frac{z}{y}\right) + \left(\frac{x}{y} \cdot 4 + 1\right)
double f(double x, double y, double z) {
        double r304554 = 1.0;
        double r304555 = 4.0;
        double r304556 = x;
        double r304557 = y;
        double r304558 = 0.25;
        double r304559 = r304557 * r304558;
        double r304560 = r304556 + r304559;
        double r304561 = z;
        double r304562 = r304560 - r304561;
        double r304563 = r304555 * r304562;
        double r304564 = r304563 / r304557;
        double r304565 = r304554 + r304564;
        return r304565;
}

double f(double x, double y, double z) {
        double r304566 = 4.0;
        double r304567 = 0.25;
        double r304568 = z;
        double r304569 = y;
        double r304570 = r304568 / r304569;
        double r304571 = r304567 - r304570;
        double r304572 = r304566 * r304571;
        double r304573 = x;
        double r304574 = r304573 / r304569;
        double r304575 = r304574 * r304566;
        double r304576 = 1.0;
        double r304577 = r304575 + r304576;
        double r304578 = r304572 + r304577;
        return r304578;
}

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

Derivation

  1. Initial program 0.1

    \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{4 \cdot \left(0.25 - \frac{z - x}{y}\right) + 1}\]
  3. Using strategy rm
  4. Applied div-sub0.0

    \[\leadsto 4 \cdot \left(0.25 - \color{blue}{\left(\frac{z}{y} - \frac{x}{y}\right)}\right) + 1\]
  5. Applied associate--r-0.0

    \[\leadsto 4 \cdot \color{blue}{\left(\left(0.25 - \frac{z}{y}\right) + \frac{x}{y}\right)} + 1\]
  6. Applied distribute-lft-in0.0

    \[\leadsto \color{blue}{\left(4 \cdot \left(0.25 - \frac{z}{y}\right) + 4 \cdot \frac{x}{y}\right)} + 1\]
  7. Applied associate-+l+0.0

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

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

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

Reproduce

herbie shell --seed 2020047 
(FPCore (x y z)
  :name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, C"
  :precision binary64
  (+ 1 (/ (* 4 (- (+ x (* y 0.25)) z)) y)))