Average Error: 12.9 → 3.1
Time: 37.6s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\frac{x}{\frac{-y}{z + \left(-y\right)}}\]
\frac{x \cdot \left(y - z\right)}{y}
\frac{x}{\frac{-y}{z + \left(-y\right)}}
double f(double x, double y, double z) {
        double r37409938 = x;
        double r37409939 = y;
        double r37409940 = z;
        double r37409941 = r37409939 - r37409940;
        double r37409942 = r37409938 * r37409941;
        double r37409943 = r37409942 / r37409939;
        return r37409943;
}

double f(double x, double y, double z) {
        double r37409944 = x;
        double r37409945 = y;
        double r37409946 = -r37409945;
        double r37409947 = z;
        double r37409948 = r37409947 + r37409946;
        double r37409949 = r37409946 / r37409948;
        double r37409950 = r37409944 / r37409949;
        return r37409950;
}

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

Target

Original12.9
Target2.9
Herbie3.1
\[\begin{array}{l} \mathbf{if}\;z \lt -2.060202331921739024383612783691266533098 \cdot 10^{104}:\\ \;\;\;\;x - \frac{z \cdot x}{y}\\ \mathbf{elif}\;z \lt 1.693976601382852594702773997610248441465 \cdot 10^{213}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\ \end{array}\]

Derivation

  1. Initial program 12.9

    \[\frac{x \cdot \left(y - z\right)}{y}\]
  2. Using strategy rm
  3. Applied associate-/l*3.1

    \[\leadsto \color{blue}{\frac{x}{\frac{y}{y - z}}}\]
  4. Using strategy rm
  5. Applied frac-2neg3.1

    \[\leadsto \frac{x}{\color{blue}{\frac{-y}{-\left(y - z\right)}}}\]
  6. Simplified3.1

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

    \[\leadsto \frac{x}{\frac{-y}{z + \left(-y\right)}}\]

Reproduce

herbie shell --seed 2019168 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"

  :herbie-target
  (if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))

  (/ (* x (- y z)) y))