Average Error: 1.3 → 0.6
Time: 5.8s
Precision: 64
\[x + y \cdot \frac{z - t}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -7.90788715625825451 \cdot 10^{-48} \lor \neg \left(y \le 2.5371231932369919 \cdot 10^{-149}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{z - a}\\ \end{array}\]
x + y \cdot \frac{z - t}{z - a}
\begin{array}{l}
\mathbf{if}\;y \le -7.90788715625825451 \cdot 10^{-48} \lor \neg \left(y \le 2.5371231932369919 \cdot 10^{-149}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r558312 = x;
        double r558313 = y;
        double r558314 = z;
        double r558315 = t;
        double r558316 = r558314 - r558315;
        double r558317 = a;
        double r558318 = r558314 - r558317;
        double r558319 = r558316 / r558318;
        double r558320 = r558313 * r558319;
        double r558321 = r558312 + r558320;
        return r558321;
}

double f(double x, double y, double z, double t, double a) {
        double r558322 = y;
        double r558323 = -7.907887156258255e-48;
        bool r558324 = r558322 <= r558323;
        double r558325 = 2.537123193236992e-149;
        bool r558326 = r558322 <= r558325;
        double r558327 = !r558326;
        bool r558328 = r558324 || r558327;
        double r558329 = x;
        double r558330 = z;
        double r558331 = t;
        double r558332 = r558330 - r558331;
        double r558333 = a;
        double r558334 = r558330 - r558333;
        double r558335 = r558332 / r558334;
        double r558336 = r558322 * r558335;
        double r558337 = r558329 + r558336;
        double r558338 = r558322 * r558332;
        double r558339 = 1.0;
        double r558340 = r558339 / r558334;
        double r558341 = r558338 * r558340;
        double r558342 = r558329 + r558341;
        double r558343 = r558328 ? r558337 : r558342;
        return r558343;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < -7.907887156258255e-48 or 2.537123193236992e-149 < y

    1. Initial program 0.6

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

    if -7.907887156258255e-48 < y < 2.537123193236992e-149

    1. Initial program 2.6

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

      \[\leadsto x + y \cdot \color{blue}{\left(\left(z - t\right) \cdot \frac{1}{z - a}\right)}\]
    4. Applied associate-*r*0.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -7.90788715625825451 \cdot 10^{-48} \lor \neg \left(y \le 2.5371231932369919 \cdot 10^{-149}\right):\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{z - a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020100 
(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)))))