Average Error: 10.6 → 1.5
Time: 25.6s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[\frac{1}{\frac{a - z}{y - z}} \cdot t + x\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\frac{1}{\frac{a - z}{y - z}} \cdot t + x
double f(double x, double y, double z, double t, double a) {
        double r577161 = x;
        double r577162 = y;
        double r577163 = z;
        double r577164 = r577162 - r577163;
        double r577165 = t;
        double r577166 = r577164 * r577165;
        double r577167 = a;
        double r577168 = r577167 - r577163;
        double r577169 = r577166 / r577168;
        double r577170 = r577161 + r577169;
        return r577170;
}

double f(double x, double y, double z, double t, double a) {
        double r577171 = 1.0;
        double r577172 = a;
        double r577173 = z;
        double r577174 = r577172 - r577173;
        double r577175 = y;
        double r577176 = r577175 - r577173;
        double r577177 = r577174 / r577176;
        double r577178 = r577171 / r577177;
        double r577179 = t;
        double r577180 = r577178 * r577179;
        double r577181 = x;
        double r577182 = r577180 + r577181;
        return r577182;
}

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.6
Target0.6
Herbie1.5
\[\begin{array}{l} \mathbf{if}\;t \lt -1.068297449017406694366747246993994850729 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t \lt 3.911094988758637497591020599238553861375 \cdot 10^{-141}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \end{array}\]

Derivation

  1. Initial program 10.6

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

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

    \[\leadsto \color{blue}{\frac{y - z}{a - z} \cdot t + x}\]
  5. Using strategy rm
  6. Applied clear-num1.5

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

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

Reproduce

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

  :herbie-target
  (if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))

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