Average Error: 10.6 → 0.6
Time: 5.4s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;t \le -4.43291389633853575 \cdot 10^{32}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)\\ \mathbf{elif}\;t \le 8.70690080533521418 \cdot 10^{-48}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{1}{\frac{y - z}{a - z}}}, t, x\right)\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
\mathbf{if}\;t \le -4.43291389633853575 \cdot 10^{32}:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{1}{\frac{y - z}{a - z}}}, t, x\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r553646 = x;
        double r553647 = y;
        double r553648 = z;
        double r553649 = r553647 - r553648;
        double r553650 = t;
        double r553651 = r553649 * r553650;
        double r553652 = a;
        double r553653 = r553652 - r553648;
        double r553654 = r553651 / r553653;
        double r553655 = r553646 + r553654;
        return r553655;
}

double f(double x, double y, double z, double t, double a) {
        double r553656 = t;
        double r553657 = -4.432913896338536e+32;
        bool r553658 = r553656 <= r553657;
        double r553659 = 1.0;
        double r553660 = y;
        double r553661 = z;
        double r553662 = r553660 - r553661;
        double r553663 = a;
        double r553664 = r553663 - r553661;
        double r553665 = r553662 / r553664;
        double r553666 = x;
        double r553667 = fma(r553665, r553656, r553666);
        double r553668 = r553659 * r553667;
        double r553669 = 8.706900805335214e-48;
        bool r553670 = r553656 <= r553669;
        double r553671 = r553662 * r553656;
        double r553672 = r553671 / r553664;
        double r553673 = r553666 + r553672;
        double r553674 = r553659 / r553665;
        double r553675 = r553659 / r553674;
        double r553676 = fma(r553675, r553656, r553666);
        double r553677 = r553670 ? r553673 : r553676;
        double r553678 = r553658 ? r553668 : r553677;
        return r553678;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original10.6
Target0.6
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;t \lt -1.0682974490174067 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t \lt 3.9110949887586375 \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 3 regimes
  2. if t < -4.432913896338536e+32

    1. Initial program 25.3

      \[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity25.3

      \[\leadsto x + \color{blue}{1 \cdot \frac{\left(y - z\right) \cdot t}{a - z}}\]
    4. Applied *-un-lft-identity25.3

      \[\leadsto \color{blue}{1 \cdot x} + 1 \cdot \frac{\left(y - z\right) \cdot t}{a - z}\]
    5. Applied distribute-lft-out25.3

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

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

    if -4.432913896338536e+32 < t < 8.706900805335214e-48

    1. Initial program 0.5

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

    if 8.706900805335214e-48 < t

    1. Initial program 19.2

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{1}{\color{blue}{\frac{1}{\frac{y - z}{a - z}}}}, t, x\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -4.43291389633853575 \cdot 10^{32}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)\\ \mathbf{elif}\;t \le 8.70690080533521418 \cdot 10^{-48}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{1}{\frac{y - z}{a - z}}}, t, x\right)\\ \end{array}\]

Reproduce

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