Average Error: 11.1 → 0.5
Time: 23.2s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;t \le -3.710933688919529208657597337795679809259 \cdot 10^{-165} \lor \neg \left(t \le 3.743067837608515740991033703322625493327 \cdot 10^{-72}\right):\\ \;\;\;\;x + t \cdot \frac{y - z}{a - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
\mathbf{if}\;t \le -3.710933688919529208657597337795679809259 \cdot 10^{-165} \lor \neg \left(t \le 3.743067837608515740991033703322625493327 \cdot 10^{-72}\right):\\
\;\;\;\;x + t \cdot \frac{y - z}{a - z}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r438554 = x;
        double r438555 = y;
        double r438556 = z;
        double r438557 = r438555 - r438556;
        double r438558 = t;
        double r438559 = r438557 * r438558;
        double r438560 = a;
        double r438561 = r438560 - r438556;
        double r438562 = r438559 / r438561;
        double r438563 = r438554 + r438562;
        return r438563;
}

double f(double x, double y, double z, double t, double a) {
        double r438564 = t;
        double r438565 = -3.710933688919529e-165;
        bool r438566 = r438564 <= r438565;
        double r438567 = 3.7430678376085157e-72;
        bool r438568 = r438564 <= r438567;
        double r438569 = !r438568;
        bool r438570 = r438566 || r438569;
        double r438571 = x;
        double r438572 = y;
        double r438573 = z;
        double r438574 = r438572 - r438573;
        double r438575 = a;
        double r438576 = r438575 - r438573;
        double r438577 = r438574 / r438576;
        double r438578 = r438564 * r438577;
        double r438579 = r438571 + r438578;
        double r438580 = r438574 * r438564;
        double r438581 = r438580 / r438576;
        double r438582 = r438581 + r438571;
        double r438583 = r438570 ? r438579 : r438582;
        return r438583;
}

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

Original11.1
Target0.5
Herbie0.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. Split input into 2 regimes
  2. if t < -3.710933688919529e-165 or 3.7430678376085157e-72 < t

    1. Initial program 16.4

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

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

      \[\leadsto \mathsf{fma}\left(y - z, \color{blue}{\frac{1}{\frac{a - z}{t}}}, x\right)\]
    5. Using strategy rm
    6. Applied div-inv2.7

      \[\leadsto \mathsf{fma}\left(y - z, \frac{1}{\color{blue}{\left(a - z\right) \cdot \frac{1}{t}}}, x\right)\]
    7. Applied associate-/r*2.5

      \[\leadsto \mathsf{fma}\left(y - z, \color{blue}{\frac{\frac{1}{a - z}}{\frac{1}{t}}}, x\right)\]
    8. Using strategy rm
    9. Applied fma-udef2.5

      \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{\frac{1}{a - z}}{\frac{1}{t}} + x}\]
    10. Simplified0.7

      \[\leadsto \color{blue}{\left(\left(y - z\right) \cdot \frac{1}{a - z}\right) \cdot t} + x\]
    11. Using strategy rm
    12. Applied *-un-lft-identity0.7

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

      \[\leadsto \color{blue}{\left(\left(\left(y - z\right) \cdot \frac{1}{a - z}\right) \cdot 1\right) \cdot t} + x\]
    14. Simplified0.7

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

    if -3.710933688919529e-165 < t < 3.7430678376085157e-72

    1. Initial program 0.3

      \[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -3.710933688919529208657597337795679809259 \cdot 10^{-165} \lor \neg \left(t \le 3.743067837608515740991033703322625493327 \cdot 10^{-72}\right):\\ \;\;\;\;x + t \cdot \frac{y - z}{a - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\ \end{array}\]

Reproduce

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

  :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))))