Average Error: 0.0 → 0.0
Time: 9.9s
Precision: 64
\[x \cdot y + \left(x - 1\right) \cdot z\]
\[\left(z + y\right) \cdot x + \left(-1\right) \cdot z\]
x \cdot y + \left(x - 1\right) \cdot z
\left(z + y\right) \cdot x + \left(-1\right) \cdot z
double f(double x, double y, double z) {
        double r100814 = x;
        double r100815 = y;
        double r100816 = r100814 * r100815;
        double r100817 = 1.0;
        double r100818 = r100814 - r100817;
        double r100819 = z;
        double r100820 = r100818 * r100819;
        double r100821 = r100816 + r100820;
        return r100821;
}

double f(double x, double y, double z) {
        double r100822 = z;
        double r100823 = y;
        double r100824 = r100822 + r100823;
        double r100825 = x;
        double r100826 = r100824 * r100825;
        double r100827 = 1.0;
        double r100828 = -r100827;
        double r100829 = r100828 * r100822;
        double r100830 = r100826 + r100829;
        return r100830;
}

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(x - 1\right) \cdot z\]
  2. Using strategy rm
  3. Applied *-commutative0.0

    \[\leadsto x \cdot y + \color{blue}{z \cdot \left(x - 1\right)}\]
  4. Using strategy rm
  5. Applied sub-neg0.0

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

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

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

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

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

Reproduce

herbie shell --seed 2019198 +o rules:numerics
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Drawing:drawTextsR from Chart-1.5.3"
  (+ (* x y) (* (- x 1.0) z)))