Average Error: 23.9 → 13.5
Time: 31.2s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.82561293715626310786892129848132549499 \cdot 10^{-263} \lor \neg \left(a \le 6.1280098513761963509423724605638909966 \cdot 10^{-240}\right):\\ \;\;\;\;\mathsf{fma}\left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}, \frac{\sqrt[3]{y - x}}{a - t} \cdot \left(z - t\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -1.82561293715626310786892129848132549499 \cdot 10^{-263} \lor \neg \left(a \le 6.1280098513761963509423724605638909966 \cdot 10^{-240}\right):\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}, \frac{\sqrt[3]{y - x}}{a - t} \cdot \left(z - t\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;y\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r382264 = x;
        double r382265 = y;
        double r382266 = r382265 - r382264;
        double r382267 = z;
        double r382268 = t;
        double r382269 = r382267 - r382268;
        double r382270 = r382266 * r382269;
        double r382271 = a;
        double r382272 = r382271 - r382268;
        double r382273 = r382270 / r382272;
        double r382274 = r382264 + r382273;
        return r382274;
}

double f(double x, double y, double z, double t, double a) {
        double r382275 = a;
        double r382276 = -1.825612937156263e-263;
        bool r382277 = r382275 <= r382276;
        double r382278 = 6.128009851376196e-240;
        bool r382279 = r382275 <= r382278;
        double r382280 = !r382279;
        bool r382281 = r382277 || r382280;
        double r382282 = y;
        double r382283 = x;
        double r382284 = r382282 - r382283;
        double r382285 = cbrt(r382284);
        double r382286 = r382285 * r382285;
        double r382287 = t;
        double r382288 = r382275 - r382287;
        double r382289 = r382285 / r382288;
        double r382290 = z;
        double r382291 = r382290 - r382287;
        double r382292 = r382289 * r382291;
        double r382293 = fma(r382286, r382292, r382283);
        double r382294 = r382281 ? r382293 : r382282;
        return r382294;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original23.9
Target9.4
Herbie13.5
\[\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 2 regimes
  2. if a < -1.825612937156263e-263 or 6.128009851376196e-240 < a

    1. Initial program 23.5

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

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

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

      \[\leadsto \frac{y - x}{\color{blue}{1 \cdot \left(a - t\right)}} \cdot \left(z - t\right) + x\]
    7. Applied add-cube-cbrt14.5

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}\right) \cdot \sqrt[3]{y - x}}}{1 \cdot \left(a - t\right)} \cdot \left(z - t\right) + x\]
    8. Applied times-frac14.5

      \[\leadsto \color{blue}{\left(\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{1} \cdot \frac{\sqrt[3]{y - x}}{a - t}\right)} \cdot \left(z - t\right) + x\]
    9. Applied associate-*l*11.8

      \[\leadsto \color{blue}{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{1} \cdot \left(\frac{\sqrt[3]{y - x}}{a - t} \cdot \left(z - t\right)\right)} + x\]
    10. Using strategy rm
    11. Applied fma-def11.7

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{1}, \frac{\sqrt[3]{y - x}}{a - t} \cdot \left(z - t\right), x\right)}\]

    if -1.825612937156263e-263 < a < 6.128009851376196e-240

    1. Initial program 28.2

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y - x}{a - t}, z - t, x\right)}\]
    3. Taylor expanded around 0 32.9

      \[\leadsto \color{blue}{y}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification13.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.82561293715626310786892129848132549499 \cdot 10^{-263} \lor \neg \left(a \le 6.1280098513761963509423724605638909966 \cdot 10^{-240}\right):\\ \;\;\;\;\mathsf{fma}\left(\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}, \frac{\sqrt[3]{y - x}}{a - t} \cdot \left(z - t\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array}\]

Reproduce

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