Average Error: 24.9 → 10.1
Time: 7.0s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -6.658465691913166053113395158401652231458 \cdot 10^{-212}:\\ \;\;\;\;\left(\sqrt[3]{t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)} \cdot \sqrt[3]{t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)}\right) \cdot \sqrt[3]{t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\\ \mathbf{elif}\;a \le 577835548483027402752:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{y - z}{\sqrt[3]{a - z}} + \mathsf{fma}\left(-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 -6.658465691913166053113395158401652231458 \cdot 10^{-212}:\\
\;\;\;\;\left(\sqrt[3]{t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)} \cdot \sqrt[3]{t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)}\right) \cdot \sqrt[3]{t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r650916 = x;
        double r650917 = y;
        double r650918 = z;
        double r650919 = r650917 - r650918;
        double r650920 = t;
        double r650921 = r650920 - r650916;
        double r650922 = r650919 * r650921;
        double r650923 = a;
        double r650924 = r650923 - r650918;
        double r650925 = r650922 / r650924;
        double r650926 = r650916 + r650925;
        return r650926;
}

double f(double x, double y, double z, double t, double a) {
        double r650927 = a;
        double r650928 = -6.658465691913166e-212;
        bool r650929 = r650927 <= r650928;
        double r650930 = t;
        double r650931 = y;
        double r650932 = z;
        double r650933 = r650927 - r650932;
        double r650934 = r650931 / r650933;
        double r650935 = r650932 / r650933;
        double r650936 = r650934 - r650935;
        double r650937 = r650930 * r650936;
        double r650938 = cbrt(r650937);
        double r650939 = r650938 * r650938;
        double r650940 = r650939 * r650938;
        double r650941 = x;
        double r650942 = -r650941;
        double r650943 = r650931 - r650932;
        double r650944 = r650943 / r650933;
        double r650945 = fma(r650942, r650944, r650941);
        double r650946 = r650940 + r650945;
        double r650947 = 5.778355484830274e+20;
        bool r650948 = r650927 <= r650947;
        double r650949 = r650941 / r650932;
        double r650950 = r650930 / r650932;
        double r650951 = r650949 - r650950;
        double r650952 = fma(r650931, r650951, r650930);
        double r650953 = cbrt(r650933);
        double r650954 = r650953 * r650953;
        double r650955 = r650930 / r650954;
        double r650956 = r650943 / r650953;
        double r650957 = r650955 * r650956;
        double r650958 = r650957 + r650945;
        double r650959 = r650948 ? r650952 : r650958;
        double r650960 = r650929 ? r650946 : r650959;
        return r650960;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.9
Target11.8
Herbie10.1
\[\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 < -6.658465691913166e-212

    1. Initial program 24.3

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

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

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

      \[\leadsto \frac{y - z}{a - z} \cdot \color{blue}{\left(t + \left(-x\right)\right)} + x\]
    7. Applied distribute-rgt-in10.5

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

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

      \[\leadsto t \cdot \frac{y - z}{a - z} + \color{blue}{\mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)}\]
    10. Using strategy rm
    11. Applied div-sub7.1

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

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

    if -6.658465691913166e-212 < a < 5.778355484830274e+20

    1. Initial program 28.1

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

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

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

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

    if 5.778355484830274e+20 < a

    1. Initial program 22.2

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

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

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

      \[\leadsto \frac{y - z}{a - z} \cdot \color{blue}{\left(t + \left(-x\right)\right)} + x\]
    7. Applied distribute-rgt-in5.7

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

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

      \[\leadsto t \cdot \frac{y - z}{a - z} + \color{blue}{\mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)}\]
    10. Using strategy rm
    11. Applied add-cube-cbrt4.7

      \[\leadsto t \cdot \frac{y - z}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\]
    12. Applied *-un-lft-identity4.7

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

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

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

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

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

Reproduce

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