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 r960433 = x;
        double r960434 = y;
        double r960435 = r960434 - r960433;
        double r960436 = z;
        double r960437 = t;
        double r960438 = r960436 - r960437;
        double r960439 = r960435 * r960438;
        double r960440 = a;
        double r960441 = r960440 - r960437;
        double r960442 = r960439 / r960441;
        double r960443 = r960433 + r960442;
        return r960443;
}

double f(double x, double y, double z, double t, double a) {
        double r960444 = a;
        double r960445 = -4.009879037502059e-70;
        bool r960446 = r960444 <= r960445;
        double r960447 = x;
        double r960448 = y;
        double r960449 = r960448 - r960447;
        double r960450 = t;
        double r960451 = r960444 - r960450;
        double r960452 = r960449 / r960451;
        double r960453 = z;
        double r960454 = r960453 - r960450;
        double r960455 = r960452 * r960454;
        double r960456 = r960447 + r960455;
        double r960457 = 3.803402293530504e-125;
        bool r960458 = r960444 <= r960457;
        double r960459 = r960447 * r960453;
        double r960460 = r960459 / r960450;
        double r960461 = r960448 + r960460;
        double r960462 = r960453 * r960448;
        double r960463 = r960462 / r960450;
        double r960464 = r960461 - r960463;
        double r960465 = r960451 / r960454;
        double r960466 = r960449 / r960465;
        double r960467 = r960447 + r960466;
        double r960468 = r960458 ? r960464 : r960467;
        double r960469 = r960446 ? r960456 : r960468;
        return r960469;
}

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))))