Average Error: 1.4 → 0.7
Time: 15.2s
Precision: 64
\[x + y \cdot \frac{z - t}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.746074249228151569538649090498367339648 \cdot 10^{50} \lor \neg \left(y \le 1.418757681676918073121488025318816901988 \cdot 10^{-99}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\ \end{array}\]
x + y \cdot \frac{z - t}{z - a}
\begin{array}{l}
\mathbf{if}\;y \le -2.746074249228151569538649090498367339648 \cdot 10^{50} \lor \neg \left(y \le 1.418757681676918073121488025318816901988 \cdot 10^{-99}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r518740 = x;
        double r518741 = y;
        double r518742 = z;
        double r518743 = t;
        double r518744 = r518742 - r518743;
        double r518745 = a;
        double r518746 = r518742 - r518745;
        double r518747 = r518744 / r518746;
        double r518748 = r518741 * r518747;
        double r518749 = r518740 + r518748;
        return r518749;
}

double f(double x, double y, double z, double t, double a) {
        double r518750 = y;
        double r518751 = -2.7460742492281516e+50;
        bool r518752 = r518750 <= r518751;
        double r518753 = 1.418757681676918e-99;
        bool r518754 = r518750 <= r518753;
        double r518755 = !r518754;
        bool r518756 = r518752 || r518755;
        double r518757 = x;
        double r518758 = z;
        double r518759 = t;
        double r518760 = r518758 - r518759;
        double r518761 = a;
        double r518762 = r518758 - r518761;
        double r518763 = r518760 / r518762;
        double r518764 = r518750 * r518763;
        double r518765 = r518757 + r518764;
        double r518766 = r518750 * r518760;
        double r518767 = r518766 / r518762;
        double r518768 = r518757 + r518767;
        double r518769 = r518756 ? r518765 : r518768;
        return r518769;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < -2.7460742492281516e+50 or 1.418757681676918e-99 < y

    1. Initial program 0.6

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

    if -2.7460742492281516e+50 < y < 1.418757681676918e-99

    1. Initial program 2.1

      \[x + y \cdot \frac{z - t}{z - a}\]
    2. Using strategy rm
    3. Applied associate-*r/0.7

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

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

Reproduce

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

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

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