Average Error: 1.4 → 0.7
Time: 18.1s
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 r391938 = x;
        double r391939 = y;
        double r391940 = z;
        double r391941 = t;
        double r391942 = r391940 - r391941;
        double r391943 = a;
        double r391944 = r391940 - r391943;
        double r391945 = r391942 / r391944;
        double r391946 = r391939 * r391945;
        double r391947 = r391938 + r391946;
        return r391947;
}

double f(double x, double y, double z, double t, double a) {
        double r391948 = y;
        double r391949 = -2.7460742492281516e+50;
        bool r391950 = r391948 <= r391949;
        double r391951 = 1.418757681676918e-99;
        bool r391952 = r391948 <= r391951;
        double r391953 = !r391952;
        bool r391954 = r391950 || r391953;
        double r391955 = x;
        double r391956 = z;
        double r391957 = t;
        double r391958 = r391956 - r391957;
        double r391959 = a;
        double r391960 = r391956 - r391959;
        double r391961 = r391958 / r391960;
        double r391962 = r391948 * r391961;
        double r391963 = r391955 + r391962;
        double r391964 = r391948 * r391958;
        double r391965 = r391964 / r391960;
        double r391966 = r391955 + r391965;
        double r391967 = r391954 ? r391963 : r391966;
        return r391967;
}

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 add-cube-cbrt2.4

      \[\leadsto x + \color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}\right)} \cdot \frac{z - t}{z - a}\]
    4. Applied associate-*l*2.4

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

      \[\leadsto x + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \color{blue}{\frac{\sqrt[3]{y} \cdot \left(z - t\right)}{z - a}}\]
    7. Applied associate-*r/1.1

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

      \[\leadsto x + \frac{\color{blue}{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 +o rules:numerics
(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)))))