Average Error: 25.0 → 10.3
Time: 8.3s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.344676009041024767063435413969372278651 \cdot 10^{-176}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 4.650934300689651493049628385431993780051 \cdot 10^{-155}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -1.344676009041024767063435413969372278651 \cdot 10^{-176}:\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\

\mathbf{elif}\;a \le 4.650934300689651493049628385431993780051 \cdot 10^{-155}:\\
\;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r689227 = x;
        double r689228 = y;
        double r689229 = r689228 - r689227;
        double r689230 = z;
        double r689231 = t;
        double r689232 = r689230 - r689231;
        double r689233 = r689229 * r689232;
        double r689234 = a;
        double r689235 = r689234 - r689231;
        double r689236 = r689233 / r689235;
        double r689237 = r689227 + r689236;
        return r689237;
}

double f(double x, double y, double z, double t, double a) {
        double r689238 = a;
        double r689239 = -1.3446760090410248e-176;
        bool r689240 = r689238 <= r689239;
        double r689241 = x;
        double r689242 = y;
        double r689243 = r689242 - r689241;
        double r689244 = t;
        double r689245 = r689238 - r689244;
        double r689246 = z;
        double r689247 = r689246 - r689244;
        double r689248 = r689245 / r689247;
        double r689249 = r689243 / r689248;
        double r689250 = r689241 + r689249;
        double r689251 = 4.6509343006896515e-155;
        bool r689252 = r689238 <= r689251;
        double r689253 = r689241 * r689246;
        double r689254 = r689253 / r689244;
        double r689255 = r689242 + r689254;
        double r689256 = r689246 * r689242;
        double r689257 = r689256 / r689244;
        double r689258 = r689255 - r689257;
        double r689259 = r689247 / r689245;
        double r689260 = r689243 * r689259;
        double r689261 = r689241 + r689260;
        double r689262 = r689252 ? r689258 : r689261;
        double r689263 = r689240 ? r689250 : r689262;
        return r689263;
}

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

Original25.0
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 < -1.3446760090410248e-176

    1. Initial program 23.4

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

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

    if -1.3446760090410248e-176 < a < 4.6509343006896515e-155

    1. Initial program 29.8

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

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

    if 4.6509343006896515e-155 < a

    1. Initial program 24.1

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.344676009041024767063435413969372278651 \cdot 10^{-176}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \mathbf{elif}\;a \le 4.650934300689651493049628385431993780051 \cdot 10^{-155}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z - t}{a - t}\\ \end{array}\]

Reproduce

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