Average Error: 0.2 → 0.0
Time: 1.5s
Precision: 64
\[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\]
\[\left(1 + 0.75 \cdot 4\right) + \left(\frac{x}{y} - \frac{z}{y}\right) \cdot 4\]
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\left(1 + 0.75 \cdot 4\right) + \left(\frac{x}{y} - \frac{z}{y}\right) \cdot 4
double f(double x, double y, double z) {
        double r304299 = 1.0;
        double r304300 = 4.0;
        double r304301 = x;
        double r304302 = y;
        double r304303 = 0.75;
        double r304304 = r304302 * r304303;
        double r304305 = r304301 + r304304;
        double r304306 = z;
        double r304307 = r304305 - r304306;
        double r304308 = r304300 * r304307;
        double r304309 = r304308 / r304302;
        double r304310 = r304299 + r304309;
        return r304310;
}

double f(double x, double y, double z) {
        double r304311 = 1.0;
        double r304312 = 0.75;
        double r304313 = 4.0;
        double r304314 = r304312 * r304313;
        double r304315 = r304311 + r304314;
        double r304316 = x;
        double r304317 = y;
        double r304318 = r304316 / r304317;
        double r304319 = z;
        double r304320 = r304319 / r304317;
        double r304321 = r304318 - r304320;
        double r304322 = r304321 * r304313;
        double r304323 = r304315 + r304322;
        return r304323;
}

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 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}\]
  2. Simplified0.0

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

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

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

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

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

Reproduce

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