Average Error: 0.2 → 0.0
Time: 21.6s
Precision: 64
\[1.0 + \frac{4.0 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\]
\[\left(1.0 - \frac{4.0 \cdot \left(z - x\right)}{y}\right) + 4.0 \cdot 0.75\]
1.0 + \frac{4.0 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\left(1.0 - \frac{4.0 \cdot \left(z - x\right)}{y}\right) + 4.0 \cdot 0.75
double f(double x, double y, double z) {
        double r26247614 = 1.0;
        double r26247615 = 4.0;
        double r26247616 = x;
        double r26247617 = y;
        double r26247618 = 0.75;
        double r26247619 = r26247617 * r26247618;
        double r26247620 = r26247616 + r26247619;
        double r26247621 = z;
        double r26247622 = r26247620 - r26247621;
        double r26247623 = r26247615 * r26247622;
        double r26247624 = r26247623 / r26247617;
        double r26247625 = r26247614 + r26247624;
        return r26247625;
}

double f(double x, double y, double z) {
        double r26247626 = 1.0;
        double r26247627 = 4.0;
        double r26247628 = z;
        double r26247629 = x;
        double r26247630 = r26247628 - r26247629;
        double r26247631 = r26247627 * r26247630;
        double r26247632 = y;
        double r26247633 = r26247631 / r26247632;
        double r26247634 = r26247626 - r26247633;
        double r26247635 = 0.75;
        double r26247636 = r26247627 * r26247635;
        double r26247637 = r26247634 + r26247636;
        return r26247637;
}

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.2

    \[1.0 + \frac{4.0 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{4.0 \cdot \left(0.75 - \frac{z - x}{y}\right) + 1.0}\]
  3. Using strategy rm
  4. Applied sub-neg0.0

    \[\leadsto 4.0 \cdot \color{blue}{\left(0.75 + \left(-\frac{z - x}{y}\right)\right)} + 1.0\]
  5. Applied distribute-lft-in0.0

    \[\leadsto \color{blue}{\left(4.0 \cdot 0.75 + 4.0 \cdot \left(-\frac{z - x}{y}\right)\right)} + 1.0\]
  6. Applied associate-+l+0.0

    \[\leadsto \color{blue}{4.0 \cdot 0.75 + \left(4.0 \cdot \left(-\frac{z - x}{y}\right) + 1.0\right)}\]
  7. Simplified0.0

    \[\leadsto 4.0 \cdot 0.75 + \color{blue}{\left(1.0 - \frac{4.0 \cdot \left(z - x\right)}{y}\right)}\]
  8. Final simplification0.0

    \[\leadsto \left(1.0 - \frac{4.0 \cdot \left(z - x\right)}{y}\right) + 4.0 \cdot 0.75\]

Reproduce

herbie shell --seed 2019158 
(FPCore (x y z)
  :name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A"
  (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))