Average Error: 0.0 → 0.0
Time: 1.6s
Precision: 64
\[x \cdot y + \left(1 - x\right) \cdot z\]
\[x \cdot y + 1 \cdot \left(z - x \cdot z\right)\]
x \cdot y + \left(1 - x\right) \cdot z
x \cdot y + 1 \cdot \left(z - x \cdot z\right)
double f(double x, double y, double z) {
        double r281678 = x;
        double r281679 = y;
        double r281680 = r281678 * r281679;
        double r281681 = 1.0;
        double r281682 = r281681 - r281678;
        double r281683 = z;
        double r281684 = r281682 * r281683;
        double r281685 = r281680 + r281684;
        return r281685;
}

double f(double x, double y, double z) {
        double r281686 = x;
        double r281687 = y;
        double r281688 = r281686 * r281687;
        double r281689 = 1.0;
        double r281690 = z;
        double r281691 = r281686 * r281690;
        double r281692 = r281690 - r281691;
        double r281693 = r281689 * r281692;
        double r281694 = r281688 + r281693;
        return r281694;
}

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 flip3--12.1

    \[\leadsto x \cdot y + \color{blue}{\frac{{1}^{3} - {x}^{3}}{1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)}} \cdot z\]
  4. Applied associate-*l/14.0

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

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

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

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

Reproduce

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