Average Error: 24.4 → 10.3
Time: 27.8s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.016343086506014793812944176513109884775 \cdot 10^{-131}:\\ \;\;\;\;x + \frac{y - x}{\left(a - t\right) \cdot \frac{1}{z - t}}\\ \mathbf{elif}\;a \le 2.779795427212611822493799416865580231368 \cdot 10^{-144}:\\ \;\;\;\;\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 -2.016343086506014793812944176513109884775 \cdot 10^{-131}:\\
\;\;\;\;x + \frac{y - x}{\left(a - t\right) \cdot \frac{1}{z - t}}\\

\mathbf{elif}\;a \le 2.779795427212611822493799416865580231368 \cdot 10^{-144}:\\
\;\;\;\;\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 r511242 = x;
        double r511243 = y;
        double r511244 = r511243 - r511242;
        double r511245 = z;
        double r511246 = t;
        double r511247 = r511245 - r511246;
        double r511248 = r511244 * r511247;
        double r511249 = a;
        double r511250 = r511249 - r511246;
        double r511251 = r511248 / r511250;
        double r511252 = r511242 + r511251;
        return r511252;
}

double f(double x, double y, double z, double t, double a) {
        double r511253 = a;
        double r511254 = -2.0163430865060148e-131;
        bool r511255 = r511253 <= r511254;
        double r511256 = x;
        double r511257 = y;
        double r511258 = r511257 - r511256;
        double r511259 = t;
        double r511260 = r511253 - r511259;
        double r511261 = 1.0;
        double r511262 = z;
        double r511263 = r511262 - r511259;
        double r511264 = r511261 / r511263;
        double r511265 = r511260 * r511264;
        double r511266 = r511258 / r511265;
        double r511267 = r511256 + r511266;
        double r511268 = 2.779795427212612e-144;
        bool r511269 = r511253 <= r511268;
        double r511270 = r511256 * r511262;
        double r511271 = r511270 / r511259;
        double r511272 = r511257 + r511271;
        double r511273 = r511262 * r511257;
        double r511274 = r511273 / r511259;
        double r511275 = r511272 - r511274;
        double r511276 = r511260 / r511263;
        double r511277 = r511258 / r511276;
        double r511278 = r511256 + r511277;
        double r511279 = r511269 ? r511275 : r511278;
        double r511280 = r511255 ? r511267 : r511279;
        return r511280;
}

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.4
Target9.6
Herbie10.3
\[\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 < -2.0163430865060148e-131

    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*9.1

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{a - t}{z - t}}}\]
    4. Using strategy rm
    5. Applied div-inv9.1

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

    if -2.0163430865060148e-131 < a < 2.779795427212612e-144

    1. Initial program 30.0

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

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

    if 2.779795427212612e-144 < a

    1. Initial program 23.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.016343086506014793812944176513109884775 \cdot 10^{-131}:\\ \;\;\;\;x + \frac{y - x}{\left(a - t\right) \cdot \frac{1}{z - t}}\\ \mathbf{elif}\;a \le 2.779795427212611822493799416865580231368 \cdot 10^{-144}:\\ \;\;\;\;\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 2019306 
(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.7744031700831742e-182) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t))))))

  (+ x (/ (* (- y x) (- z t)) (- a t))))