Average Error: 23.2 → 10.2
Time: 19.2s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.245100240535762 \cdot 10^{-210}:\\ \;\;\;\;x + \left(\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}\right) \cdot \left(\frac{\sqrt[3]{t - x}}{a - z} \cdot \left(y - z\right)\right)\\ \mathbf{elif}\;a \le 9.28745641578995 \cdot 10^{-118}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -1.245100240535762 \cdot 10^{-210}:\\
\;\;\;\;x + \left(\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}\right) \cdot \left(\frac{\sqrt[3]{t - x}}{a - z} \cdot \left(y - z\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r24028636 = x;
        double r24028637 = y;
        double r24028638 = z;
        double r24028639 = r24028637 - r24028638;
        double r24028640 = t;
        double r24028641 = r24028640 - r24028636;
        double r24028642 = r24028639 * r24028641;
        double r24028643 = a;
        double r24028644 = r24028643 - r24028638;
        double r24028645 = r24028642 / r24028644;
        double r24028646 = r24028636 + r24028645;
        return r24028646;
}

double f(double x, double y, double z, double t, double a) {
        double r24028647 = a;
        double r24028648 = -1.245100240535762e-210;
        bool r24028649 = r24028647 <= r24028648;
        double r24028650 = x;
        double r24028651 = t;
        double r24028652 = r24028651 - r24028650;
        double r24028653 = cbrt(r24028652);
        double r24028654 = r24028653 * r24028653;
        double r24028655 = z;
        double r24028656 = r24028647 - r24028655;
        double r24028657 = r24028653 / r24028656;
        double r24028658 = y;
        double r24028659 = r24028658 - r24028655;
        double r24028660 = r24028657 * r24028659;
        double r24028661 = r24028654 * r24028660;
        double r24028662 = r24028650 + r24028661;
        double r24028663 = 9.28745641578995e-118;
        bool r24028664 = r24028647 <= r24028663;
        double r24028665 = r24028650 / r24028655;
        double r24028666 = r24028651 / r24028655;
        double r24028667 = r24028665 - r24028666;
        double r24028668 = fma(r24028658, r24028667, r24028651);
        double r24028669 = r24028659 / r24028656;
        double r24028670 = fma(r24028652, r24028669, r24028650);
        double r24028671 = r24028664 ? r24028668 : r24028670;
        double r24028672 = r24028649 ? r24028662 : r24028671;
        return r24028672;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original23.2
Target11.8
Herbie10.2
\[\begin{array}{l} \mathbf{if}\;z \lt -1.2536131056095036 \cdot 10^{+188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z \lt 4.446702369113811 \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.245100240535762e-210

    1. Initial program 21.7

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

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

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

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

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

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

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

    if -1.245100240535762e-210 < a < 9.28745641578995e-118

    1. Initial program 28.9

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

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

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

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

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

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

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

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

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

    if 9.28745641578995e-118 < a

    1. Initial program 21.7

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

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

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

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

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

      \[\leadsto \left(t - x\right) \cdot \color{blue}{\frac{y - z}{a - z}} + x\]
    9. Using strategy rm
    10. Applied fma-def9.0

      \[\leadsto \color{blue}{\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.2

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

Reproduce

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

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