Average Error: 12.3 → 11.9
Time: 4.7s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\frac{x}{y} \cdot \left(y - z\right)\]
\frac{x \cdot \left(y - z\right)}{y}
\frac{x}{y} \cdot \left(y - z\right)
double f(double x, double y, double z) {
        double r544303 = x;
        double r544304 = y;
        double r544305 = z;
        double r544306 = r544304 - r544305;
        double r544307 = r544303 * r544306;
        double r544308 = r544307 / r544304;
        return r544308;
}

double f(double x, double y, double z) {
        double r544309 = x;
        double r544310 = y;
        double r544311 = r544309 / r544310;
        double r544312 = z;
        double r544313 = r544310 - r544312;
        double r544314 = r544311 * r544313;
        return r544314;
}

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.3
Target3.2
Herbie11.9
\[\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.3

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

    \[\leadsto \color{blue}{\frac{x}{\frac{y}{y - z}}}\]
  4. Using strategy rm
  5. Applied clear-num3.0

    \[\leadsto \color{blue}{\frac{1}{\frac{\frac{y}{y - z}}{x}}}\]
  6. Final simplification11.9

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

Reproduce

herbie shell --seed 1978988140 
(FPCore (x y z)
  :name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
  :precision binary64

  :herbie-target
  (if (< z -2.060202331921739e104) (- x (/ (* z x) y)) (if (< z 1.69397660138285259e213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))

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