Average Error: 24.9 → 9.3
Time: 6.4s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} = -\infty:\\ \;\;\;\;\mathsf{fma}\left(\left(y - x\right) \cdot \frac{1}{a - t}, z - t, x\right)\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le -3.75564871917852029 \cdot 10^{-299}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le 0.0:\\ \;\;\;\;y\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le 3.6671185442121014 \cdot 10^{307}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\sqrt[3]{\frac{y - x}{a - t}} \cdot \left(\sqrt[3]{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}} \cdot \sqrt[3]{\frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}}}\right)\right) \cdot \sqrt[3]{\frac{y - x}{a - t}}, z - t, x\right)\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} = -\infty:\\
\;\;\;\;\mathsf{fma}\left(\left(y - x\right) \cdot \frac{1}{a - t}, z - t, x\right)\\

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

\mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le 0.0:\\
\;\;\;\;y\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r635901 = x;
        double r635902 = y;
        double r635903 = r635902 - r635901;
        double r635904 = z;
        double r635905 = t;
        double r635906 = r635904 - r635905;
        double r635907 = r635903 * r635906;
        double r635908 = a;
        double r635909 = r635908 - r635905;
        double r635910 = r635907 / r635909;
        double r635911 = r635901 + r635910;
        return r635911;
}

double f(double x, double y, double z, double t, double a) {
        double r635912 = x;
        double r635913 = y;
        double r635914 = r635913 - r635912;
        double r635915 = z;
        double r635916 = t;
        double r635917 = r635915 - r635916;
        double r635918 = r635914 * r635917;
        double r635919 = a;
        double r635920 = r635919 - r635916;
        double r635921 = r635918 / r635920;
        double r635922 = r635912 + r635921;
        double r635923 = -inf.0;
        bool r635924 = r635922 <= r635923;
        double r635925 = 1.0;
        double r635926 = r635925 / r635920;
        double r635927 = r635914 * r635926;
        double r635928 = fma(r635927, r635917, r635912);
        double r635929 = -3.7556487191785203e-299;
        bool r635930 = r635922 <= r635929;
        double r635931 = 0.0;
        bool r635932 = r635922 <= r635931;
        double r635933 = 3.6671185442121014e+307;
        bool r635934 = r635922 <= r635933;
        double r635935 = r635914 / r635920;
        double r635936 = cbrt(r635935);
        double r635937 = cbrt(r635914);
        double r635938 = r635937 * r635937;
        double r635939 = cbrt(r635920);
        double r635940 = r635939 * r635939;
        double r635941 = r635938 / r635940;
        double r635942 = cbrt(r635941);
        double r635943 = r635937 / r635939;
        double r635944 = cbrt(r635943);
        double r635945 = r635942 * r635944;
        double r635946 = r635936 * r635945;
        double r635947 = r635946 * r635936;
        double r635948 = fma(r635947, r635917, r635912);
        double r635949 = r635934 ? r635922 : r635948;
        double r635950 = r635932 ? r635913 : r635949;
        double r635951 = r635930 ? r635922 : r635950;
        double r635952 = r635924 ? r635928 : r635951;
        return r635952;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.9
Target9.3
Herbie9.3
\[\begin{array}{l} \mathbf{if}\;a \lt -1.6153062845442575 \cdot 10^{-142}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \lt 3.7744031700831742 \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 4 regimes
  2. if (+ x (/ (* (- y x) (- z t)) (- a t))) < -inf.0

    1. Initial program 64.0

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

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

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

    if -inf.0 < (+ x (/ (* (- y x) (- z t)) (- a t))) < -3.7556487191785203e-299 or 0.0 < (+ x (/ (* (- y x) (- z t)) (- a t))) < 3.6671185442121014e+307

    1. Initial program 2.0

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

    if -3.7556487191785203e-299 < (+ x (/ (* (- y x) (- z t)) (- a t))) < 0.0

    1. Initial program 60.7

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

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

      \[\leadsto \color{blue}{y}\]

    if 3.6671185442121014e+307 < (+ x (/ (* (- y x) (- z t)) (- a t)))

    1. Initial program 63.9

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{\frac{y - x}{a - t}} \cdot \sqrt[3]{\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}}}\right) \cdot \sqrt[3]{\frac{y - x}{a - t}}, z - t, x\right)\]
    8. Applied times-frac18.4

      \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{\frac{y - x}{a - t}} \cdot \sqrt[3]{\color{blue}{\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) \cdot \sqrt[3]{\frac{y - x}{a - t}}, z - t, x\right)\]
    9. Applied cbrt-prod18.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} = -\infty:\\ \;\;\;\;\mathsf{fma}\left(\left(y - x\right) \cdot \frac{1}{a - t}, z - t, x\right)\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le -3.75564871917852029 \cdot 10^{-299}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le 0.0:\\ \;\;\;\;y\\ \mathbf{elif}\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t} \le 3.6671185442121014 \cdot 10^{307}:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\sqrt[3]{\frac{y - x}{a - t}} \cdot \left(\sqrt[3]{\frac{\sqrt[3]{y - x} \cdot \sqrt[3]{y - x}}{\sqrt[3]{a - t} \cdot \sqrt[3]{a - t}}} \cdot \sqrt[3]{\frac{\sqrt[3]{y - x}}{\sqrt[3]{a - t}}}\right)\right) \cdot \sqrt[3]{\frac{y - x}{a - t}}, z - t, x\right)\\ \end{array}\]

Reproduce

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