Average Error: 10.3 → 3.6
Time: 20.4s
Precision: 64
\[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\]
\[\frac{x \cdot \left(1 + y\right)}{z} - x\]
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\frac{x \cdot \left(1 + y\right)}{z} - x
double f(double x, double y, double z) {
        double r485162 = x;
        double r485163 = y;
        double r485164 = z;
        double r485165 = r485163 - r485164;
        double r485166 = 1.0;
        double r485167 = r485165 + r485166;
        double r485168 = r485162 * r485167;
        double r485169 = r485168 / r485164;
        return r485169;
}

double f(double x, double y, double z) {
        double r485170 = x;
        double r485171 = 1.0;
        double r485172 = y;
        double r485173 = r485171 + r485172;
        double r485174 = r485170 * r485173;
        double r485175 = z;
        double r485176 = r485174 / r485175;
        double r485177 = r485176 - r485170;
        return r485177;
}

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

Original10.3
Target0.4
Herbie3.6
\[\begin{array}{l} \mathbf{if}\;x \lt -2.714831067134359919650240696134672137284 \cdot 10^{-162}:\\ \;\;\;\;\left(1 + y\right) \cdot \frac{x}{z} - x\\ \mathbf{elif}\;x \lt 3.874108816439546156869494499878029491333 \cdot 10^{-197}:\\ \;\;\;\;\left(x \cdot \left(\left(y - z\right) + 1\right)\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + y\right) \cdot \frac{x}{z} - x\\ \end{array}\]

Derivation

  1. Initial program 10.3

    \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\]
  2. Taylor expanded around 0 3.6

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

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

    \[\leadsto \frac{x}{z} \cdot \color{blue}{{\left(1 + y\right)}^{1}} - x\]
  6. Applied pow11.6

    \[\leadsto \color{blue}{{\left(\frac{x}{z}\right)}^{1}} \cdot {\left(1 + y\right)}^{1} - x\]
  7. Applied pow-prod-down1.6

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

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

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

Reproduce

herbie shell --seed 2019306 
(FPCore (x y z)
  :name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
  :precision binary64

  :herbie-target
  (if (< x -2.7148310671343599e-162) (- (* (+ 1 y) (/ x z)) x) (if (< x 3.87410881643954616e-197) (* (* x (+ (- y z) 1)) (/ 1 z)) (- (* (+ 1 y) (/ x z)) x)))

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