Average Error: 25.2 → 10.7
Time: 23.2s
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 r416379 = x;
        double r416380 = y;
        double r416381 = r416380 - r416379;
        double r416382 = z;
        double r416383 = t;
        double r416384 = r416382 - r416383;
        double r416385 = r416381 * r416384;
        double r416386 = a;
        double r416387 = r416386 - r416383;
        double r416388 = r416385 / r416387;
        double r416389 = r416379 + r416388;
        return r416389;
}

double f(double x, double y, double z, double t, double a) {
        double r416390 = a;
        double r416391 = -5.181595524895995e-145;
        bool r416392 = r416390 <= r416391;
        double r416393 = z;
        double r416394 = t;
        double r416395 = r416393 - r416394;
        double r416396 = y;
        double r416397 = x;
        double r416398 = r416396 - r416397;
        double r416399 = cbrt(r416398);
        double r416400 = r416399 * r416399;
        double r416401 = r416390 - r416394;
        double r416402 = cbrt(r416401);
        double r416403 = r416402 * r416402;
        double r416404 = r416400 / r416403;
        double r416405 = r416395 * r416404;
        double r416406 = r416399 / r416402;
        double r416407 = r416405 * r416406;
        double r416408 = r416407 + r416397;
        double r416409 = 3.085625866310274e-197;
        bool r416410 = r416390 <= r416409;
        double r416411 = r416397 / r416394;
        double r416412 = r416393 * r416396;
        double r416413 = r416412 / r416394;
        double r416414 = r416396 - r416413;
        double r416415 = fma(r416411, r416393, r416414);
        double r416416 = fabs(r416406);
        double r416417 = r416395 * r416416;
        double r416418 = sqrt(r416404);
        double r416419 = r416417 * r416418;
        double r416420 = r416419 * r416406;
        double r416421 = r416420 + r416397;
        double r416422 = r416410 ? r416415 : r416421;
        double r416423 = r416392 ? r416408 : r416422;
        return r416423;
}

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