Average Error: 23.1 → 11.3
Time: 11.9s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -5.3888449508600594 \cdot 10^{+250}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{1}{a - t} \cdot \left(z - t\right)\right) \cdot \left(y - x\right)\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -5.3888449508600594 \cdot 10^{+250}:\\
\;\;\;\;y\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r12796561 = x;
        double r12796562 = y;
        double r12796563 = r12796562 - r12796561;
        double r12796564 = z;
        double r12796565 = t;
        double r12796566 = r12796564 - r12796565;
        double r12796567 = r12796563 * r12796566;
        double r12796568 = a;
        double r12796569 = r12796568 - r12796565;
        double r12796570 = r12796567 / r12796569;
        double r12796571 = r12796561 + r12796570;
        return r12796571;
}

double f(double x, double y, double z, double t, double a) {
        double r12796572 = t;
        double r12796573 = -5.3888449508600594e+250;
        bool r12796574 = r12796572 <= r12796573;
        double r12796575 = y;
        double r12796576 = x;
        double r12796577 = 1.0;
        double r12796578 = a;
        double r12796579 = r12796578 - r12796572;
        double r12796580 = r12796577 / r12796579;
        double r12796581 = z;
        double r12796582 = r12796581 - r12796572;
        double r12796583 = r12796580 * r12796582;
        double r12796584 = r12796575 - r12796576;
        double r12796585 = r12796583 * r12796584;
        double r12796586 = r12796576 + r12796585;
        double r12796587 = r12796574 ? r12796575 : r12796586;
        return r12796587;
}

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

Original23.1
Target9.3
Herbie11.3
\[\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.774403170083174 \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 t < -5.3888449508600594e+250

    1. Initial program 51.1

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{a - t}{z - t}}}\]
    4. Taylor expanded around 0 20.2

      \[\leadsto \color{blue}{y}\]

    if -5.3888449508600594e+250 < t

    1. Initial program 21.5

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

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

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

      \[\leadsto x + \color{blue}{\left(y - x\right)} \cdot \frac{z - t}{a - t}\]
    6. Using strategy rm
    7. Applied div-inv10.8

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

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

Reproduce

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