Average Error: 24.8 → 10.6
Time: 43.8s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -8.256417904055176398799405656254786131067 \cdot 10^{123}:\\ \;\;\;\;\left(\frac{x}{\frac{t}{z}} - \frac{z}{\frac{t}{y}}\right) + y\\ \mathbf{elif}\;t \le 1.54202611814591130820462999265544238001 \cdot 10^{97}:\\ \;\;\;\;\left(y - x\right) \cdot \frac{z - t}{a - t} + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-z}{t}, y, \mathsf{fma}\left(z, \frac{x}{t}, y\right)\right)\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -8.256417904055176398799405656254786131067 \cdot 10^{123}:\\
\;\;\;\;\left(\frac{x}{\frac{t}{z}} - \frac{z}{\frac{t}{y}}\right) + y\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{t}, y, \mathsf{fma}\left(z, \frac{x}{t}, y\right)\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r597243 = x;
        double r597244 = y;
        double r597245 = r597244 - r597243;
        double r597246 = z;
        double r597247 = t;
        double r597248 = r597246 - r597247;
        double r597249 = r597245 * r597248;
        double r597250 = a;
        double r597251 = r597250 - r597247;
        double r597252 = r597249 / r597251;
        double r597253 = r597243 + r597252;
        return r597253;
}

double f(double x, double y, double z, double t, double a) {
        double r597254 = t;
        double r597255 = -8.256417904055176e+123;
        bool r597256 = r597254 <= r597255;
        double r597257 = x;
        double r597258 = z;
        double r597259 = r597254 / r597258;
        double r597260 = r597257 / r597259;
        double r597261 = y;
        double r597262 = r597254 / r597261;
        double r597263 = r597258 / r597262;
        double r597264 = r597260 - r597263;
        double r597265 = r597264 + r597261;
        double r597266 = 1.5420261181459113e+97;
        bool r597267 = r597254 <= r597266;
        double r597268 = r597261 - r597257;
        double r597269 = r597258 - r597254;
        double r597270 = a;
        double r597271 = r597270 - r597254;
        double r597272 = r597269 / r597271;
        double r597273 = r597268 * r597272;
        double r597274 = r597273 + r597257;
        double r597275 = -r597258;
        double r597276 = r597275 / r597254;
        double r597277 = r597257 / r597254;
        double r597278 = fma(r597258, r597277, r597261);
        double r597279 = fma(r597276, r597261, r597278);
        double r597280 = r597267 ? r597274 : r597279;
        double r597281 = r597256 ? r597265 : r597280;
        return r597281;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.8
Target9.3
Herbie10.6
\[\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 t < -8.256417904055176e+123

    1. Initial program 45.9

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Simplified22.0

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef22.0

      \[\leadsto \color{blue}{\frac{z - t}{a - t} \cdot \left(y - x\right) + x}\]
    5. Using strategy rm
    6. Applied div-inv22.1

      \[\leadsto \color{blue}{\left(\left(z - t\right) \cdot \frac{1}{a - t}\right)} \cdot \left(y - x\right) + x\]
    7. Taylor expanded around inf 25.4

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

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

    if -8.256417904055176e+123 < t < 1.5420261181459113e+97

    1. Initial program 13.1

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Simplified6.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef6.2

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

    if 1.5420261181459113e+97 < t

    1. Initial program 44.3

      \[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
    2. Simplified21.4

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef21.4

      \[\leadsto \color{blue}{\frac{z - t}{a - t} \cdot \left(y - x\right) + x}\]
    5. Using strategy rm
    6. Applied div-inv21.5

      \[\leadsto \color{blue}{\left(\left(z - t\right) \cdot \frac{1}{a - t}\right)} \cdot \left(y - x\right) + x\]
    7. Using strategy rm
    8. Applied add-cube-cbrt22.2

      \[\leadsto \color{blue}{\left(\sqrt[3]{\left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot \left(y - x\right)} \cdot \sqrt[3]{\left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot \left(y - x\right)}\right) \cdot \sqrt[3]{\left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot \left(y - x\right)}} + x\]
    9. Simplified22.2

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{z - t}{a - t} \cdot \left(y - x\right)} \cdot \sqrt[3]{\frac{z - t}{a - t} \cdot \left(y - x\right)}\right)} \cdot \sqrt[3]{\left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot \left(y - x\right)} + x\]
    10. Simplified22.2

      \[\leadsto \left(\sqrt[3]{\frac{z - t}{a - t} \cdot \left(y - x\right)} \cdot \sqrt[3]{\frac{z - t}{a - t} \cdot \left(y - x\right)}\right) \cdot \color{blue}{\sqrt[3]{\frac{z - t}{a - t} \cdot \left(y - x\right)}} + x\]
    11. Taylor expanded around inf 26.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -8.256417904055176398799405656254786131067 \cdot 10^{123}:\\ \;\;\;\;\left(\frac{x}{\frac{t}{z}} - \frac{z}{\frac{t}{y}}\right) + y\\ \mathbf{elif}\;t \le 1.54202611814591130820462999265544238001 \cdot 10^{97}:\\ \;\;\;\;\left(y - x\right) \cdot \frac{z - t}{a - t} + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-z}{t}, y, \mathsf{fma}\left(z, \frac{x}{t}, y\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019196 +o rules:numerics
(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))))