Average Error: 1.3 → 1.2
Time: 17.0s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.154684444467626765295585477093744108351 \cdot 10^{-171} \lor \neg \left(t \le 5.322924113402587513824909997004777783123 \cdot 10^{-104}\right):\\ \;\;\;\;y \cdot \frac{z - t}{a - t} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t} + x\\ \end{array}\]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -1.154684444467626765295585477093744108351 \cdot 10^{-171} \lor \neg \left(t \le 5.322924113402587513824909997004777783123 \cdot 10^{-104}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a - t} + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r464711 = x;
        double r464712 = y;
        double r464713 = z;
        double r464714 = t;
        double r464715 = r464713 - r464714;
        double r464716 = a;
        double r464717 = r464716 - r464714;
        double r464718 = r464715 / r464717;
        double r464719 = r464712 * r464718;
        double r464720 = r464711 + r464719;
        return r464720;
}

double f(double x, double y, double z, double t, double a) {
        double r464721 = t;
        double r464722 = -1.1546844444676268e-171;
        bool r464723 = r464721 <= r464722;
        double r464724 = 5.3229241134025875e-104;
        bool r464725 = r464721 <= r464724;
        double r464726 = !r464725;
        bool r464727 = r464723 || r464726;
        double r464728 = y;
        double r464729 = z;
        double r464730 = r464729 - r464721;
        double r464731 = a;
        double r464732 = r464731 - r464721;
        double r464733 = r464730 / r464732;
        double r464734 = r464728 * r464733;
        double r464735 = x;
        double r464736 = r464734 + r464735;
        double r464737 = r464730 * r464728;
        double r464738 = r464737 / r464732;
        double r464739 = r464738 + r464735;
        double r464740 = r464727 ? r464736 : r464739;
        return r464740;
}

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

Original1.3
Target0.4
Herbie1.2
\[\begin{array}{l} \mathbf{if}\;y \lt -8.508084860551241069024247453646278348229 \cdot 10^{-17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \lt 2.894426862792089097262541964056085749132 \cdot 10^{-49}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if t < -1.1546844444676268e-171 or 5.3229241134025875e-104 < t

    1. Initial program 0.5

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

    if -1.1546844444676268e-171 < t < 5.3229241134025875e-104

    1. Initial program 3.5

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

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

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

Reproduce

herbie shell --seed 2019194 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"

  :herbie-target
  (if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))

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