Average Error: 23.9 → 13.5
Time: 30.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 r413181 = x;
        double r413182 = y;
        double r413183 = r413182 - r413181;
        double r413184 = z;
        double r413185 = t;
        double r413186 = r413184 - r413185;
        double r413187 = r413183 * r413186;
        double r413188 = a;
        double r413189 = r413188 - r413185;
        double r413190 = r413187 / r413189;
        double r413191 = r413181 + r413190;
        return r413191;
}

double f(double x, double y, double z, double t, double a) {
        double r413192 = a;
        double r413193 = -1.825612937156263e-263;
        bool r413194 = r413192 <= r413193;
        double r413195 = 6.128009851376196e-240;
        bool r413196 = r413192 <= r413195;
        double r413197 = !r413196;
        bool r413198 = r413194 || r413197;
        double r413199 = y;
        double r413200 = x;
        double r413201 = r413199 - r413200;
        double r413202 = cbrt(r413201);
        double r413203 = r413202 * r413202;
        double r413204 = t;
        double r413205 = r413192 - r413204;
        double r413206 = r413202 / r413205;
        double r413207 = z;
        double r413208 = r413207 - r413204;
        double r413209 = r413206 * r413208;
        double r413210 = fma(r413203, r413209, r413200);
        double r413211 = r413198 ? r413210 : r413199;
        return r413211;
}

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