Average Error: 0.0 → 0.0
Time: 13.5s
Precision: 64
\[x \cdot y + \left(1 - x\right) \cdot z\]
\[z \cdot 1 + x \cdot \left(y - z\right)\]
x \cdot y + \left(1 - x\right) \cdot z
z \cdot 1 + x \cdot \left(y - z\right)
double f(double x, double y, double z) {
        double r12563026 = x;
        double r12563027 = y;
        double r12563028 = r12563026 * r12563027;
        double r12563029 = 1.0;
        double r12563030 = r12563029 - r12563026;
        double r12563031 = z;
        double r12563032 = r12563030 * r12563031;
        double r12563033 = r12563028 + r12563032;
        return r12563033;
}

double f(double x, double y, double z) {
        double r12563034 = z;
        double r12563035 = 1.0;
        double r12563036 = r12563034 * r12563035;
        double r12563037 = x;
        double r12563038 = y;
        double r12563039 = r12563038 - r12563034;
        double r12563040 = r12563037 * r12563039;
        double r12563041 = r12563036 + r12563040;
        return r12563041;
}

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

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

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

    \[\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}{z \cdot 1 + x \cdot \left(y - z\right)}\]
  8. Final simplification0.0

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

Reproduce

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