Average Error: 0.2 → 0.0
Time: 13.1s
Precision: 64
\[1.0 + \frac{4.0 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\]
\[\left(1.0 - \frac{\left(z - x\right) \cdot 4.0}{y}\right) + 0.75 \cdot 4.0\]
1.0 + \frac{4.0 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\left(1.0 - \frac{\left(z - x\right) \cdot 4.0}{y}\right) + 0.75 \cdot 4.0
double f(double x, double y, double z) {
        double r14220269 = 1.0;
        double r14220270 = 4.0;
        double r14220271 = x;
        double r14220272 = y;
        double r14220273 = 0.75;
        double r14220274 = r14220272 * r14220273;
        double r14220275 = r14220271 + r14220274;
        double r14220276 = z;
        double r14220277 = r14220275 - r14220276;
        double r14220278 = r14220270 * r14220277;
        double r14220279 = r14220278 / r14220272;
        double r14220280 = r14220269 + r14220279;
        return r14220280;
}

double f(double x, double y, double z) {
        double r14220281 = 1.0;
        double r14220282 = z;
        double r14220283 = x;
        double r14220284 = r14220282 - r14220283;
        double r14220285 = 4.0;
        double r14220286 = r14220284 * r14220285;
        double r14220287 = y;
        double r14220288 = r14220286 / r14220287;
        double r14220289 = r14220281 - r14220288;
        double r14220290 = 0.75;
        double r14220291 = r14220290 * r14220285;
        double r14220292 = r14220289 + r14220291;
        return r14220292;
}

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-rgt-in0.0

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

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

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

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

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