Average Error: 24.6 → 11.6
Time: 22.9s
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 r1227058 = x;
        double r1227059 = y;
        double r1227060 = r1227059 - r1227058;
        double r1227061 = z;
        double r1227062 = t;
        double r1227063 = r1227061 - r1227062;
        double r1227064 = r1227060 * r1227063;
        double r1227065 = a;
        double r1227066 = r1227065 - r1227062;
        double r1227067 = r1227064 / r1227066;
        double r1227068 = r1227058 + r1227067;
        return r1227068;
}

double f(double x, double y, double z, double t, double a) {
        double r1227069 = a;
        double r1227070 = -4.009879037502059e-70;
        bool r1227071 = r1227069 <= r1227070;
        double r1227072 = x;
        double r1227073 = y;
        double r1227074 = r1227073 - r1227072;
        double r1227075 = t;
        double r1227076 = r1227069 - r1227075;
        double r1227077 = r1227074 / r1227076;
        double r1227078 = z;
        double r1227079 = r1227078 - r1227075;
        double r1227080 = r1227077 * r1227079;
        double r1227081 = r1227072 + r1227080;
        double r1227082 = 3.803402293530504e-125;
        bool r1227083 = r1227069 <= r1227082;
        double r1227084 = r1227072 * r1227078;
        double r1227085 = r1227084 / r1227075;
        double r1227086 = r1227073 + r1227085;
        double r1227087 = r1227078 * r1227073;
        double r1227088 = r1227087 / r1227075;
        double r1227089 = r1227086 - r1227088;
        double r1227090 = r1227076 / r1227079;
        double r1227091 = r1227074 / r1227090;
        double r1227092 = r1227072 + r1227091;
        double r1227093 = r1227083 ? r1227089 : r1227092;
        double r1227094 = r1227071 ? r1227081 : r1227093;
        return r1227094;
}

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