Average Error: 10.9 → 0.4
Time: 30.7s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(y - z\right) \cdot t}{a - z} = -\infty:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot t}{a - z} \le 3.62552744786625132430806750402668623781 \cdot 10^{272}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
\mathbf{if}\;\frac{\left(y - z\right) \cdot t}{a - z} = -\infty:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\

\mathbf{elif}\;\frac{\left(y - z\right) \cdot t}{a - z} \le 3.62552744786625132430806750402668623781 \cdot 10^{272}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r24783712 = x;
        double r24783713 = y;
        double r24783714 = z;
        double r24783715 = r24783713 - r24783714;
        double r24783716 = t;
        double r24783717 = r24783715 * r24783716;
        double r24783718 = a;
        double r24783719 = r24783718 - r24783714;
        double r24783720 = r24783717 / r24783719;
        double r24783721 = r24783712 + r24783720;
        return r24783721;
}

double f(double x, double y, double z, double t, double a) {
        double r24783722 = y;
        double r24783723 = z;
        double r24783724 = r24783722 - r24783723;
        double r24783725 = t;
        double r24783726 = r24783724 * r24783725;
        double r24783727 = a;
        double r24783728 = r24783727 - r24783723;
        double r24783729 = r24783726 / r24783728;
        double r24783730 = -inf.0;
        bool r24783731 = r24783729 <= r24783730;
        double r24783732 = x;
        double r24783733 = r24783725 / r24783728;
        double r24783734 = r24783724 * r24783733;
        double r24783735 = r24783732 + r24783734;
        double r24783736 = 3.6255274478662513e+272;
        bool r24783737 = r24783729 <= r24783736;
        double r24783738 = r24783729 + r24783732;
        double r24783739 = r24783737 ? r24783738 : r24783735;
        double r24783740 = r24783731 ? r24783735 : r24783739;
        return r24783740;
}

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.9
Target0.6
Herbie0.4
\[\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 (/ (* (- y z) t) (- a z)) < -inf.0 or 3.6255274478662513e+272 < (/ (* (- y z) t) (- a z))

    1. Initial program 61.4

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

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

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

    if -inf.0 < (/ (* (- y z) t) (- a z)) < 3.6255274478662513e+272

    1. Initial program 0.3

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

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

      \[\leadsto \color{blue}{\left(y - z\right) \cdot \frac{t}{a - z} + x}\]
    5. Using strategy rm
    6. Applied associate-*r/0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(y - z\right) \cdot t}{a - z} = -\infty:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot t}{a - z} \le 3.62552744786625132430806750402668623781 \cdot 10^{272}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot t}{a - z} + x\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019200 +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))))