Average Error: 24.6 → 11.6
Time: 20.3s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.0098790375020589 \cdot 10^{-70}:\\ \;\;\;\;x + \frac{y - x}{a - t} \cdot \left(z - t\right)\\ \mathbf{elif}\;a \le 3.8034022935305039 \cdot 10^{-125}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -4.0098790375020589 \cdot 10^{-70}:\\
\;\;\;\;x + \frac{y - x}{a - t} \cdot \left(z - t\right)\\

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

\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r1283395 = x;
        double r1283396 = y;
        double r1283397 = r1283396 - r1283395;
        double r1283398 = z;
        double r1283399 = t;
        double r1283400 = r1283398 - r1283399;
        double r1283401 = r1283397 * r1283400;
        double r1283402 = a;
        double r1283403 = r1283402 - r1283399;
        double r1283404 = r1283401 / r1283403;
        double r1283405 = r1283395 + r1283404;
        return r1283405;
}

double f(double x, double y, double z, double t, double a) {
        double r1283406 = a;
        double r1283407 = -4.009879037502059e-70;
        bool r1283408 = r1283406 <= r1283407;
        double r1283409 = x;
        double r1283410 = y;
        double r1283411 = r1283410 - r1283409;
        double r1283412 = t;
        double r1283413 = r1283406 - r1283412;
        double r1283414 = r1283411 / r1283413;
        double r1283415 = z;
        double r1283416 = r1283415 - r1283412;
        double r1283417 = r1283414 * r1283416;
        double r1283418 = r1283409 + r1283417;
        double r1283419 = 3.803402293530504e-125;
        bool r1283420 = r1283406 <= r1283419;
        double r1283421 = r1283409 * r1283415;
        double r1283422 = r1283421 / r1283412;
        double r1283423 = r1283410 + r1283422;
        double r1283424 = r1283415 * r1283410;
        double r1283425 = r1283424 / r1283412;
        double r1283426 = r1283423 - r1283425;
        double r1283427 = r1283413 / r1283416;
        double r1283428 = r1283411 / r1283427;
        double r1283429 = r1283409 + r1283428;
        double r1283430 = r1283420 ? r1283426 : r1283429;
        double r1283431 = r1283408 ? r1283418 : r1283430;
        return r1283431;
}

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

Original24.6
Target9.1
Herbie11.6
\[\begin{array}{l} \mathbf{if}\;a \lt -1.6153062845442575 \cdot 10^{-142}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \lt 3.7744031700831742 \cdot 10^{-182}:\\ \;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if a < -4.009879037502059e-70

    1. Initial program 23.0

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Using strategy rm
    3. Applied associate-/l*8.1

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{a - t}{z - t}}}\]
    4. Using strategy rm
    5. Applied associate-/r/10.2

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

    if -4.009879037502059e-70 < a < 3.803402293530504e-125

    1. Initial program 29.2

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Taylor expanded around inf 16.9

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

    if 3.803402293530504e-125 < a

    1. Initial program 22.2

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Using strategy rm
    3. Applied associate-/l*8.2

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{a - t}{z - t}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification11.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -4.0098790375020589 \cdot 10^{-70}:\\ \;\;\;\;x + \frac{y - x}{a - t} \cdot \left(z - t\right)\\ \mathbf{elif}\;a \le 3.8034022935305039 \cdot 10^{-125}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020047 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< a -1.6153062845442575e-142) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t))))))

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