Average Error: 24.3 → 10.9
Time: 31.1s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.264122689569453656842879868519212174824 \cdot 10^{-228}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 1.474978086208166197165144421451213606011 \cdot 10^{-72}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -1.264122689569453656842879868519212174824 \cdot 10^{-228}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r507497 = x;
        double r507498 = y;
        double r507499 = r507498 - r507497;
        double r507500 = z;
        double r507501 = t;
        double r507502 = r507500 - r507501;
        double r507503 = r507499 * r507502;
        double r507504 = a;
        double r507505 = r507504 - r507501;
        double r507506 = r507503 / r507505;
        double r507507 = r507497 + r507506;
        return r507507;
}

double f(double x, double y, double z, double t, double a) {
        double r507508 = a;
        double r507509 = -1.2641226895694537e-228;
        bool r507510 = r507508 <= r507509;
        double r507511 = x;
        double r507512 = y;
        double r507513 = r507512 - r507511;
        double r507514 = t;
        double r507515 = r507508 - r507514;
        double r507516 = z;
        double r507517 = r507516 - r507514;
        double r507518 = r507515 / r507517;
        double r507519 = r507513 / r507518;
        double r507520 = r507511 + r507519;
        double r507521 = 1.4749780862081662e-72;
        bool r507522 = r507508 <= r507521;
        double r507523 = r507511 * r507516;
        double r507524 = r507523 / r507514;
        double r507525 = r507512 + r507524;
        double r507526 = r507516 * r507512;
        double r507527 = r507526 / r507514;
        double r507528 = r507525 - r507527;
        double r507529 = r507517 / r507515;
        double r507530 = r507513 * r507529;
        double r507531 = r507511 + r507530;
        double r507532 = r507522 ? r507528 : r507531;
        double r507533 = r507510 ? r507520 : r507532;
        return r507533;
}

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.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 3 regimes
  2. if a < -1.2641226895694537e-228

    1. Initial program 23.4

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

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

    if -1.2641226895694537e-228 < a < 1.4749780862081662e-72

    1. Initial program 29.5

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

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

    if 1.4749780862081662e-72 < a

    1. Initial program 21.9

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity21.9

      \[\leadsto x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{\color{blue}{1 \cdot \left(a - t\right)}}\]
    4. Applied times-frac7.9

      \[\leadsto x + \color{blue}{\frac{y - x}{1} \cdot \frac{z - t}{a - t}}\]
    5. Simplified7.9

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

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

Reproduce

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