Average Error: 0.0 → 0.0
Time: 17.3s
Precision: 64
\[x \cdot y + \left(1 - x\right) \cdot z\]
\[1 \cdot z + x \cdot \left(y - z\right)\]
x \cdot y + \left(1 - x\right) \cdot z
1 \cdot z + x \cdot \left(y - z\right)
double f(double x, double y, double z) {
        double r12066207 = x;
        double r12066208 = y;
        double r12066209 = r12066207 * r12066208;
        double r12066210 = 1.0;
        double r12066211 = r12066210 - r12066207;
        double r12066212 = z;
        double r12066213 = r12066211 * r12066212;
        double r12066214 = r12066209 + r12066213;
        return r12066214;
}

double f(double x, double y, double z) {
        double r12066215 = 1.0;
        double r12066216 = z;
        double r12066217 = r12066215 * r12066216;
        double r12066218 = x;
        double r12066219 = y;
        double r12066220 = r12066219 - r12066216;
        double r12066221 = r12066218 * r12066220;
        double r12066222 = r12066217 + r12066221;
        return r12066222;
}

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

    \[x \cdot y + \left(1 - x\right) \cdot z\]
  2. Using strategy rm
  3. Applied flip--8.0

    \[\leadsto x \cdot y + \color{blue}{\frac{1 \cdot 1 - x \cdot x}{1 + x}} \cdot z\]
  4. Applied associate-*l/10.2

    \[\leadsto x \cdot y + \color{blue}{\frac{\left(1 \cdot 1 - x \cdot x\right) \cdot z}{1 + x}}\]
  5. Simplified6.8

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

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

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

    \[\leadsto 1 \cdot z + x \cdot \left(y - z\right)\]

Reproduce

herbie shell --seed 2019171 
(FPCore (x y z)
  :name "Diagrams.Backend.Rasterific:$crender from diagrams-rasterific-1.3.1.3"
  (+ (* x y) (* (- 1.0 x) z)))