Average Error: 0.0 → 0.0
Time: 12.9s
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 r13773044 = x;
        double r13773045 = y;
        double r13773046 = r13773044 * r13773045;
        double r13773047 = 1.0;
        double r13773048 = r13773047 - r13773044;
        double r13773049 = z;
        double r13773050 = r13773048 * r13773049;
        double r13773051 = r13773046 + r13773050;
        return r13773051;
}

double f(double x, double y, double z) {
        double r13773052 = 1.0;
        double r13773053 = z;
        double r13773054 = r13773052 * r13773053;
        double r13773055 = x;
        double r13773056 = y;
        double r13773057 = r13773056 - r13773053;
        double r13773058 = r13773055 * r13773057;
        double r13773059 = r13773054 + r13773058;
        return r13773059;
}

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. Taylor expanded around inf 0.0

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

    \[\leadsto \color{blue}{1 \cdot z + x \cdot \left(y - z\right)}\]
  7. 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)))