Average Error: 25.2 → 10.7
Time: 26.7s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -5.181595524895994673884436306821384479432 \cdot 10^{-145}:\\ \;\;\;\;\left(\left(z - t\right) \cdot \frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}\right) \cdot \frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}} + x\\ \mathbf{elif}\;a \le 3.085625866310274161423784322836746942828 \cdot 10^{-197}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{t}, z, y - \frac{z \cdot y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(z - t\right) \cdot \left|\frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}}\right|\right) \cdot \sqrt{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}}\right) \cdot \frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}} + x\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -5.181595524895994673884436306821384479432 \cdot 10^{-145}:\\
\;\;\;\;\left(\left(z - t\right) \cdot \frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}\right) \cdot \frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}} + x\\

\mathbf{elif}\;a \le 3.085625866310274161423784322836746942828 \cdot 10^{-197}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{t}, z, y - \frac{z \cdot y}{t}\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r380247 = x;
        double r380248 = y;
        double r380249 = r380248 - r380247;
        double r380250 = z;
        double r380251 = t;
        double r380252 = r380250 - r380251;
        double r380253 = r380249 * r380252;
        double r380254 = a;
        double r380255 = r380254 - r380251;
        double r380256 = r380253 / r380255;
        double r380257 = r380247 + r380256;
        return r380257;
}

double f(double x, double y, double z, double t, double a) {
        double r380258 = a;
        double r380259 = -5.181595524895995e-145;
        bool r380260 = r380258 <= r380259;
        double r380261 = z;
        double r380262 = t;
        double r380263 = r380261 - r380262;
        double r380264 = y;
        double r380265 = x;
        double r380266 = r380264 - r380265;
        double r380267 = cbrt(r380266);
        double r380268 = r380267 * r380267;
        double r380269 = r380258 - r380262;
        double r380270 = cbrt(r380269);
        double r380271 = r380270 * r380270;
        double r380272 = r380268 / r380271;
        double r380273 = r380263 * r380272;
        double r380274 = r380267 / r380270;
        double r380275 = r380273 * r380274;
        double r380276 = r380275 + r380265;
        double r380277 = 3.085625866310274e-197;
        bool r380278 = r380258 <= r380277;
        double r380279 = r380265 / r380262;
        double r380280 = r380261 * r380264;
        double r380281 = r380280 / r380262;
        double r380282 = r380264 - r380281;
        double r380283 = fma(r380279, r380261, r380282);
        double r380284 = fabs(r380274);
        double r380285 = r380263 * r380284;
        double r380286 = sqrt(r380272);
        double r380287 = r380285 * r380286;
        double r380288 = r380287 * r380274;
        double r380289 = r380288 + r380265;
        double r380290 = r380278 ? r380283 : r380289;
        double r380291 = r380260 ? r380276 : r380290;
        return r380291;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original25.2
Target9.6
Herbie10.7
\[\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 < -5.181595524895995e-145

    1. Initial program 24.0

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y - x\right) \cdot \frac{1}{a - t}}, z - t, x\right)\]
    5. Using strategy rm
    6. Applied fma-udef12.2

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

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

      \[\leadsto \left(z - t\right) \cdot \frac{y - x}{\color{blue}{\left(\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}\right) \cdot \sqrt[3]{a - t}}} + x\]
    10. Applied add-cube-cbrt12.8

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

      \[\leadsto \left(z - t\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}} \cdot \frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}}\right)} + x\]
    12. Applied associate-*r*10.0

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

    if -5.181595524895995e-145 < a < 3.085625866310274e-197

    1. Initial program 31.0

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y - x\right) \cdot \frac{1}{a - t}}, z - t, x\right)\]
    5. Using strategy rm
    6. Applied fma-udef26.7

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

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

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

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

    if 3.085625866310274e-197 < a

    1. Initial program 23.5

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

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

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(y - x\right) \cdot \frac{1}{a - t}}, z - t, x\right)\]
    5. Using strategy rm
    6. Applied fma-udef12.9

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

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

      \[\leadsto \left(z - t\right) \cdot \frac{y - x}{\color{blue}{\left(\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}\right) \cdot \sqrt[3]{a - t}}} + x\]
    10. Applied add-cube-cbrt13.5

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

      \[\leadsto \left(z - t\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}} \cdot \frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}}\right)} + x\]
    12. Applied associate-*r*10.8

      \[\leadsto \color{blue}{\left(\left(z - t\right) \cdot \frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}\right) \cdot \frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}}} + x\]
    13. Using strategy rm
    14. Applied add-sqr-sqrt10.8

      \[\leadsto \left(\left(z - t\right) \cdot \color{blue}{\left(\sqrt{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}} \cdot \sqrt{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}}\right)}\right) \cdot \frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}} + x\]
    15. Applied associate-*r*10.8

      \[\leadsto \color{blue}{\left(\left(\left(z - t\right) \cdot \sqrt{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}}\right) \cdot \sqrt{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}}\right)} \cdot \frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}} + x\]
    16. Simplified10.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -5.181595524895994673884436306821384479432 \cdot 10^{-145}:\\ \;\;\;\;\left(\left(z - t\right) \cdot \frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}\right) \cdot \frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}} + x\\ \mathbf{elif}\;a \le 3.085625866310274161423784322836746942828 \cdot 10^{-197}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{t}, z, y - \frac{z \cdot y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(z - t\right) \cdot \left|\frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}}\right|\right) \cdot \sqrt{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}}\right) \cdot \frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}} + x\\ \end{array}\]

Reproduce

herbie shell --seed 2019323 +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))))