Average Error: 1.3 → 1.2
Time: 16.7s
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 r574622 = x;
        double r574623 = y;
        double r574624 = z;
        double r574625 = t;
        double r574626 = r574624 - r574625;
        double r574627 = a;
        double r574628 = r574627 - r574625;
        double r574629 = r574626 / r574628;
        double r574630 = r574623 * r574629;
        double r574631 = r574622 + r574630;
        return r574631;
}

double f(double x, double y, double z, double t, double a) {
        double r574632 = t;
        double r574633 = -1.1546844444676268e-171;
        bool r574634 = r574632 <= r574633;
        double r574635 = 5.3229241134025875e-104;
        bool r574636 = r574632 <= r574635;
        double r574637 = !r574636;
        bool r574638 = r574634 || r574637;
        double r574639 = y;
        double r574640 = z;
        double r574641 = r574640 - r574632;
        double r574642 = a;
        double r574643 = r574642 - r574632;
        double r574644 = r574641 / r574643;
        double r574645 = r574639 * r574644;
        double r574646 = x;
        double r574647 = r574645 + r574646;
        double r574648 = r574641 * r574639;
        double r574649 = r574648 / r574643;
        double r574650 = r574649 + r574646;
        double r574651 = r574638 ? r574647 : r574650;
        return r574651;
}

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