Average Error: 24.2 → 9.6
Time: 24.2s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -5.99111728669460137343493361641315421585 \cdot 10^{-124}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}}{\sqrt[3]{a - z}}, t - x, x\right)\\ \mathbf{elif}\;a \le 4.148123673034126016993570331008942926337 \cdot 10^{-100}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}\right) \cdot \frac{\sqrt[3]{y - z}}{a - z}, t - x, x\right)\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -5.99111728669460137343493361641315421585 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}}{\sqrt[3]{a - z}}, t - x, x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r433913 = x;
        double r433914 = y;
        double r433915 = z;
        double r433916 = r433914 - r433915;
        double r433917 = t;
        double r433918 = r433917 - r433913;
        double r433919 = r433916 * r433918;
        double r433920 = a;
        double r433921 = r433920 - r433915;
        double r433922 = r433919 / r433921;
        double r433923 = r433913 + r433922;
        return r433923;
}

double f(double x, double y, double z, double t, double a) {
        double r433924 = a;
        double r433925 = -5.991117286694601e-124;
        bool r433926 = r433924 <= r433925;
        double r433927 = y;
        double r433928 = z;
        double r433929 = r433927 - r433928;
        double r433930 = r433924 - r433928;
        double r433931 = cbrt(r433930);
        double r433932 = r433931 * r433931;
        double r433933 = r433929 / r433932;
        double r433934 = r433933 / r433931;
        double r433935 = t;
        double r433936 = x;
        double r433937 = r433935 - r433936;
        double r433938 = fma(r433934, r433937, r433936);
        double r433939 = 4.148123673034126e-100;
        bool r433940 = r433924 <= r433939;
        double r433941 = r433927 / r433928;
        double r433942 = r433941 * r433937;
        double r433943 = r433935 - r433942;
        double r433944 = cbrt(r433929);
        double r433945 = r433944 * r433944;
        double r433946 = r433944 / r433930;
        double r433947 = r433945 * r433946;
        double r433948 = fma(r433947, r433937, r433936);
        double r433949 = r433940 ? r433943 : r433948;
        double r433950 = r433926 ? r433938 : r433949;
        return r433950;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.2
Target12.2
Herbie9.6
\[\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 < -5.991117286694601e-124

    1. Initial program 23.1

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

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

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}}, t - x, x\right)\]
    5. Applied associate-/r*9.5

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

    if -5.991117286694601e-124 < a < 4.148123673034126e-100

    1. Initial program 28.7

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

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

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

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

    if 4.148123673034126e-100 < a

    1. Initial program 21.6

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

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

      \[\leadsto \mathsf{fma}\left(\frac{y - z}{\color{blue}{1 \cdot \left(a - z\right)}}, t - x, x\right)\]
    5. Applied add-cube-cbrt8.3

      \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{\left(\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}\right) \cdot \sqrt[3]{y - z}}}{1 \cdot \left(a - z\right)}, t - x, x\right)\]
    6. Applied times-frac8.3

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

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

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

Reproduce

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