Average Error: 24.0 → 9.7
Time: 16.4s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.686700831155592813705776808417837254406 \cdot 10^{-61}:\\ \;\;\;\;\mathsf{fma}\left(\left(y - z\right) \cdot \frac{1}{a - z}, t - x, x\right)\\ \mathbf{elif}\;a \le 8.392440744553116362698086020495240028125 \cdot 10^{-55}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \left(\frac{\sqrt[3]{y - z}}{\sqrt[3]{a - z}} \cdot \left(t - x\right)\right) + x\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -1.686700831155592813705776808417837254406 \cdot 10^{-61}:\\
\;\;\;\;\mathsf{fma}\left(\left(y - z\right) \cdot \frac{1}{a - z}, t - x, x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r850650 = x;
        double r850651 = y;
        double r850652 = z;
        double r850653 = r850651 - r850652;
        double r850654 = t;
        double r850655 = r850654 - r850650;
        double r850656 = r850653 * r850655;
        double r850657 = a;
        double r850658 = r850657 - r850652;
        double r850659 = r850656 / r850658;
        double r850660 = r850650 + r850659;
        return r850660;
}

double f(double x, double y, double z, double t, double a) {
        double r850661 = a;
        double r850662 = -1.6867008311555928e-61;
        bool r850663 = r850661 <= r850662;
        double r850664 = y;
        double r850665 = z;
        double r850666 = r850664 - r850665;
        double r850667 = 1.0;
        double r850668 = r850661 - r850665;
        double r850669 = r850667 / r850668;
        double r850670 = r850666 * r850669;
        double r850671 = t;
        double r850672 = x;
        double r850673 = r850671 - r850672;
        double r850674 = fma(r850670, r850673, r850672);
        double r850675 = 8.392440744553116e-55;
        bool r850676 = r850661 <= r850675;
        double r850677 = r850664 / r850665;
        double r850678 = r850677 * r850673;
        double r850679 = r850671 - r850678;
        double r850680 = cbrt(r850666);
        double r850681 = r850680 * r850680;
        double r850682 = cbrt(r850668);
        double r850683 = r850682 * r850682;
        double r850684 = r850681 / r850683;
        double r850685 = r850680 / r850682;
        double r850686 = r850685 * r850673;
        double r850687 = r850684 * r850686;
        double r850688 = r850687 + r850672;
        double r850689 = r850676 ? r850679 : r850688;
        double r850690 = r850663 ? r850674 : r850689;
        return r850690;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.0
Target12.1
Herbie9.7
\[\begin{array}{l} \mathbf{if}\;z \lt -1.253613105609503593846459977496550767343 \cdot 10^{188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z \lt 4.446702369113811028051510715777703865332 \cdot 10^{64}:\\ \;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\ \mathbf{else}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if a < -1.6867008311555928e-61

    1. Initial program 22.5

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

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

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

    if -1.6867008311555928e-61 < a < 8.392440744553116e-55

    1. Initial program 27.7

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

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

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

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

    if 8.392440744553116e-55 < a

    1. Initial program 21.2

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.686700831155592813705776808417837254406 \cdot 10^{-61}:\\ \;\;\;\;\mathsf{fma}\left(\left(y - z\right) \cdot \frac{1}{a - z}, t - x, x\right)\\ \mathbf{elif}\;a \le 8.392440744553116362698086020495240028125 \cdot 10^{-55}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \left(\frac{\sqrt[3]{y - z}}{\sqrt[3]{a - z}} \cdot \left(t - x\right)\right) + x\\ \end{array}\]

Reproduce

herbie shell --seed 2019351 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< z -1.2536131056095036e+188) (- t (* (/ y z) (- t x))) (if (< z 4.446702369113811e+64) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x)))))

  (+ x (/ (* (- y z) (- t x)) (- a z))))