Average Error: 10.4 → 1.2
Time: 15.2s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[y \cdot \frac{z - t}{a - t} + x\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
y \cdot \frac{z - t}{a - t} + x
double f(double x, double y, double z, double t, double a) {
        double r359675 = x;
        double r359676 = y;
        double r359677 = z;
        double r359678 = t;
        double r359679 = r359677 - r359678;
        double r359680 = r359676 * r359679;
        double r359681 = a;
        double r359682 = r359681 - r359678;
        double r359683 = r359680 / r359682;
        double r359684 = r359675 + r359683;
        return r359684;
}

double f(double x, double y, double z, double t, double a) {
        double r359685 = y;
        double r359686 = z;
        double r359687 = t;
        double r359688 = r359686 - r359687;
        double r359689 = a;
        double r359690 = r359689 - r359687;
        double r359691 = r359688 / r359690;
        double r359692 = r359685 * r359691;
        double r359693 = x;
        double r359694 = r359692 + r359693;
        return r359694;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.4
Target1.1
Herbie1.2
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Initial program 10.4

    \[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
  2. Simplified3.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)}\]
  3. Using strategy rm
  4. Applied fma-udef3.0

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

    \[\leadsto \color{blue}{\left(y \cdot \frac{1}{a - t}\right)} \cdot \left(z - t\right) + x\]
  7. Applied associate-*l*1.2

    \[\leadsto \color{blue}{y \cdot \left(\frac{1}{a - t} \cdot \left(z - t\right)\right)} + x\]
  8. Simplified1.2

    \[\leadsto y \cdot \color{blue}{\frac{z - t}{a - t}} + x\]
  9. Final simplification1.2

    \[\leadsto y \cdot \frac{z - t}{a - t} + x\]

Reproduce

herbie shell --seed 2019304 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
  :precision binary64

  :herbie-target
  (+ x (/ y (/ (- a t) (- z t))))

  (+ x (/ (* y (- z t)) (- a t))))