Average Error: 24.2 → 9.9
Time: 19.2s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.558394661228404181494997262744088120973 \cdot 10^{-174}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 2.396751447149204532314564091926853753816 \cdot 10^{-172}:\\ \;\;\;\;\left(y + \frac{z \cdot x}{t}\right) - \frac{y \cdot z}{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 -3.558394661228404181494997262744088120973 \cdot 10^{-174}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

\mathbf{elif}\;a \le 2.396751447149204532314564091926853753816 \cdot 10^{-172}:\\
\;\;\;\;\left(y + \frac{z \cdot x}{t}\right) - \frac{y \cdot z}{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 r32106475 = x;
        double r32106476 = y;
        double r32106477 = r32106476 - r32106475;
        double r32106478 = z;
        double r32106479 = t;
        double r32106480 = r32106478 - r32106479;
        double r32106481 = r32106477 * r32106480;
        double r32106482 = a;
        double r32106483 = r32106482 - r32106479;
        double r32106484 = r32106481 / r32106483;
        double r32106485 = r32106475 + r32106484;
        return r32106485;
}

double f(double x, double y, double z, double t, double a) {
        double r32106486 = a;
        double r32106487 = -3.558394661228404e-174;
        bool r32106488 = r32106486 <= r32106487;
        double r32106489 = x;
        double r32106490 = y;
        double r32106491 = r32106490 - r32106489;
        double r32106492 = t;
        double r32106493 = r32106486 - r32106492;
        double r32106494 = z;
        double r32106495 = r32106494 - r32106492;
        double r32106496 = r32106493 / r32106495;
        double r32106497 = r32106491 / r32106496;
        double r32106498 = r32106489 + r32106497;
        double r32106499 = 2.3967514471492045e-172;
        bool r32106500 = r32106486 <= r32106499;
        double r32106501 = r32106494 * r32106489;
        double r32106502 = r32106501 / r32106492;
        double r32106503 = r32106490 + r32106502;
        double r32106504 = r32106490 * r32106494;
        double r32106505 = r32106504 / r32106492;
        double r32106506 = r32106503 - r32106505;
        double r32106507 = r32106500 ? r32106506 : r32106498;
        double r32106508 = r32106488 ? r32106498 : r32106507;
        return r32106508;
}

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.2
Target8.9
Herbie9.9
\[\begin{array}{l} \mathbf{if}\;a \lt -1.615306284544257464183904494091872805513 \cdot 10^{-142}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \lt 3.774403170083174201868024161554637965035 \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 2 regimes
  2. if a < -3.558394661228404e-174 or 2.3967514471492045e-172 < a

    1. Initial program 23.1

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{a - t}{z - t}}}\]

    if -3.558394661228404e-174 < a < 2.3967514471492045e-172

    1. Initial program 28.7

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

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

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

Reproduce

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

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

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