Average Error: 24.3 → 10.8
Time: 19.0s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.875824772447241737051070660174537380931 \cdot 10^{-80}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 8.815256163235809252800222120819323493177 \cdot 10^{-151}:\\ \;\;\;\;\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 -2.875824772447241737051070660174537380931 \cdot 10^{-80}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

\mathbf{elif}\;a \le 8.815256163235809252800222120819323493177 \cdot 10^{-151}:\\
\;\;\;\;\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 r29269516 = x;
        double r29269517 = y;
        double r29269518 = r29269517 - r29269516;
        double r29269519 = z;
        double r29269520 = t;
        double r29269521 = r29269519 - r29269520;
        double r29269522 = r29269518 * r29269521;
        double r29269523 = a;
        double r29269524 = r29269523 - r29269520;
        double r29269525 = r29269522 / r29269524;
        double r29269526 = r29269516 + r29269525;
        return r29269526;
}

double f(double x, double y, double z, double t, double a) {
        double r29269527 = a;
        double r29269528 = -2.8758247724472417e-80;
        bool r29269529 = r29269527 <= r29269528;
        double r29269530 = x;
        double r29269531 = y;
        double r29269532 = r29269531 - r29269530;
        double r29269533 = t;
        double r29269534 = r29269527 - r29269533;
        double r29269535 = z;
        double r29269536 = r29269535 - r29269533;
        double r29269537 = r29269534 / r29269536;
        double r29269538 = r29269532 / r29269537;
        double r29269539 = r29269530 + r29269538;
        double r29269540 = 8.815256163235809e-151;
        bool r29269541 = r29269527 <= r29269540;
        double r29269542 = r29269535 * r29269530;
        double r29269543 = r29269542 / r29269533;
        double r29269544 = r29269531 + r29269543;
        double r29269545 = r29269531 * r29269535;
        double r29269546 = r29269545 / r29269533;
        double r29269547 = r29269544 - r29269546;
        double r29269548 = r29269541 ? r29269547 : r29269539;
        double r29269549 = r29269529 ? r29269539 : r29269548;
        return r29269549;
}

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.3
Target9.5
Herbie10.8
\[\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 < -2.8758247724472417e-80 or 8.815256163235809e-151 < a

    1. Initial program 22.7

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

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

    if -2.8758247724472417e-80 < a < 8.815256163235809e-151

    1. Initial program 28.3

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

      \[\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 simplification10.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.875824772447241737051070660174537380931 \cdot 10^{-80}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 8.815256163235809252800222120819323493177 \cdot 10^{-151}:\\ \;\;\;\;\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 2019192 
(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))))