Average Error: 1.4 → 0.9
Time: 1.7m
Precision: 64
\[x + y \cdot \frac{z - t}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -8.67077881361882653139966745080892703956 \cdot 10^{65}:\\ \;\;\;\;x + y \cdot \left(\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{z}{z - a}\right)\right) - \frac{t}{z - a}\right)\\ \mathbf{elif}\;y \le 1.608510454426237945667870574249302593292 \cdot 10^{53}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{z}{z - a}\right)\right) - \frac{t}{z - a}\right)\\ \end{array}\]
x + y \cdot \frac{z - t}{z - a}
\begin{array}{l}
\mathbf{if}\;y \le -8.67077881361882653139966745080892703956 \cdot 10^{65}:\\
\;\;\;\;x + y \cdot \left(\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{z}{z - a}\right)\right) - \frac{t}{z - a}\right)\\

\mathbf{elif}\;y \le 1.608510454426237945667870574249302593292 \cdot 10^{53}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r28142488 = x;
        double r28142489 = y;
        double r28142490 = z;
        double r28142491 = t;
        double r28142492 = r28142490 - r28142491;
        double r28142493 = a;
        double r28142494 = r28142490 - r28142493;
        double r28142495 = r28142492 / r28142494;
        double r28142496 = r28142489 * r28142495;
        double r28142497 = r28142488 + r28142496;
        return r28142497;
}

double f(double x, double y, double z, double t, double a) {
        double r28142498 = y;
        double r28142499 = -8.670778813618827e+65;
        bool r28142500 = r28142498 <= r28142499;
        double r28142501 = x;
        double r28142502 = z;
        double r28142503 = a;
        double r28142504 = r28142502 - r28142503;
        double r28142505 = r28142502 / r28142504;
        double r28142506 = expm1(r28142505);
        double r28142507 = log1p(r28142506);
        double r28142508 = t;
        double r28142509 = r28142508 / r28142504;
        double r28142510 = r28142507 - r28142509;
        double r28142511 = r28142498 * r28142510;
        double r28142512 = r28142501 + r28142511;
        double r28142513 = 1.608510454426238e+53;
        bool r28142514 = r28142498 <= r28142513;
        double r28142515 = r28142502 - r28142508;
        double r28142516 = r28142498 * r28142515;
        double r28142517 = r28142516 / r28142504;
        double r28142518 = r28142501 + r28142517;
        double r28142519 = r28142514 ? r28142518 : r28142512;
        double r28142520 = r28142500 ? r28142512 : r28142519;
        return r28142520;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < -8.670778813618827e+65 or 1.608510454426238e+53 < y

    1. Initial program 0.7

      \[x + y \cdot \frac{z - t}{z - a}\]
    2. Using strategy rm
    3. Applied div-sub0.7

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{z}{z - a} - \frac{t}{z - a}\right)}\]
    4. Using strategy rm
    5. Applied log1p-expm1-u0.7

      \[\leadsto x + y \cdot \left(\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{z}{z - a}\right)\right)} - \frac{t}{z - a}\right)\]

    if -8.670778813618827e+65 < y < 1.608510454426238e+53

    1. Initial program 1.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -8.67077881361882653139966745080892703956 \cdot 10^{65}:\\ \;\;\;\;x + y \cdot \left(\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{z}{z - a}\right)\right) - \frac{t}{z - a}\right)\\ \mathbf{elif}\;y \le 1.608510454426237945667870574249302593292 \cdot 10^{53}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{z}{z - a}\right)\right) - \frac{t}{z - a}\right)\\ \end{array}\]

Reproduce

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

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

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