Average Error: 10.9 → 0.9
Time: 15.5s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -3.333121669551157994362509217149128294058 \cdot 10^{-155} \lor \neg \left(y \le 1.287949566750880373322938289200549836114 \cdot 10^{56}\right):\\ \;\;\;\;y \cdot \frac{z - t}{z - a} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{z - a} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
\mathbf{if}\;y \le -3.333121669551157994362509217149128294058 \cdot 10^{-155} \lor \neg \left(y \le 1.287949566750880373322938289200549836114 \cdot 10^{56}\right):\\
\;\;\;\;y \cdot \frac{z - t}{z - a} + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r368800 = x;
        double r368801 = y;
        double r368802 = z;
        double r368803 = t;
        double r368804 = r368802 - r368803;
        double r368805 = r368801 * r368804;
        double r368806 = a;
        double r368807 = r368802 - r368806;
        double r368808 = r368805 / r368807;
        double r368809 = r368800 + r368808;
        return r368809;
}

double f(double x, double y, double z, double t, double a) {
        double r368810 = y;
        double r368811 = -3.333121669551158e-155;
        bool r368812 = r368810 <= r368811;
        double r368813 = 1.2879495667508804e+56;
        bool r368814 = r368810 <= r368813;
        double r368815 = !r368814;
        bool r368816 = r368812 || r368815;
        double r368817 = z;
        double r368818 = t;
        double r368819 = r368817 - r368818;
        double r368820 = a;
        double r368821 = r368817 - r368820;
        double r368822 = r368819 / r368821;
        double r368823 = r368810 * r368822;
        double r368824 = x;
        double r368825 = r368823 + r368824;
        double r368826 = r368819 * r368810;
        double r368827 = r368826 / r368821;
        double r368828 = r368827 + r368824;
        double r368829 = r368816 ? r368825 : r368828;
        return r368829;
}

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
Target1.4
Herbie0.9
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -3.333121669551158e-155 or 1.2879495667508804e+56 < y

    1. Initial program 19.2

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

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

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

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

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

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

    if -3.333121669551158e-155 < y < 1.2879495667508804e+56

    1. Initial program 0.9

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

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

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

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

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

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

Reproduce

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

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

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