Average Error: 24.9 → 10.4
Time: 1.1m
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.0992302550196416 \cdot 10^{-121}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 1.67399626509228 \cdot 10^{-135}:\\ \;\;\;\;\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 -1.0992302550196416 \cdot 10^{-121}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

\mathbf{elif}\;a \le 1.67399626509228 \cdot 10^{-135}:\\
\;\;\;\;\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 r30905813 = x;
        double r30905814 = y;
        double r30905815 = r30905814 - r30905813;
        double r30905816 = z;
        double r30905817 = t;
        double r30905818 = r30905816 - r30905817;
        double r30905819 = r30905815 * r30905818;
        double r30905820 = a;
        double r30905821 = r30905820 - r30905817;
        double r30905822 = r30905819 / r30905821;
        double r30905823 = r30905813 + r30905822;
        return r30905823;
}

double f(double x, double y, double z, double t, double a) {
        double r30905824 = a;
        double r30905825 = -1.0992302550196416e-121;
        bool r30905826 = r30905824 <= r30905825;
        double r30905827 = x;
        double r30905828 = y;
        double r30905829 = r30905828 - r30905827;
        double r30905830 = t;
        double r30905831 = r30905824 - r30905830;
        double r30905832 = z;
        double r30905833 = r30905832 - r30905830;
        double r30905834 = r30905831 / r30905833;
        double r30905835 = r30905829 / r30905834;
        double r30905836 = r30905827 + r30905835;
        double r30905837 = 1.67399626509228e-135;
        bool r30905838 = r30905824 <= r30905837;
        double r30905839 = r30905832 * r30905827;
        double r30905840 = r30905839 / r30905830;
        double r30905841 = r30905828 + r30905840;
        double r30905842 = r30905828 * r30905832;
        double r30905843 = r30905842 / r30905830;
        double r30905844 = r30905841 - r30905843;
        double r30905845 = r30905838 ? r30905844 : r30905836;
        double r30905846 = r30905826 ? r30905836 : r30905845;
        return r30905846;
}

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.9
Target9.1
Herbie10.4
\[\begin{array}{l} \mathbf{if}\;a \lt -1.6153062845442575 \cdot 10^{-142}:\\ \;\;\;\;x + \frac{y - x}{1.0} \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.0} \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if a < -1.0992302550196416e-121 or 1.67399626509228e-135 < a

    1. Initial program 22.9

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

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

    if -1.0992302550196416e-121 < a < 1.67399626509228e-135

    1. Initial program 30.8

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

      \[\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.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.0992302550196416 \cdot 10^{-121}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 1.67399626509228 \cdot 10^{-135}:\\ \;\;\;\;\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 2019165 
(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))))