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

\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{\frac{y - z}{a - z}} \cdot \sqrt[3]{\frac{y - z}{a - z}}\right) \cdot \left(\sqrt[3]{\frac{y - z}{a - z}} \cdot t\right) + \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 r2851 = x;
        double r2852 = y;
        double r2853 = z;
        double r2854 = r2852 - r2853;
        double r2855 = t;
        double r2856 = r2855 - r2851;
        double r2857 = r2854 * r2856;
        double r2858 = a;
        double r2859 = r2858 - r2853;
        double r2860 = r2857 / r2859;
        double r2861 = r2851 + r2860;
        return r2861;
}

double f(double x, double y, double z, double t, double a) {
        double r2862 = z;
        double r2863 = -6.195549894709601e+225;
        bool r2864 = r2862 <= r2863;
        double r2865 = y;
        double r2866 = x;
        double r2867 = r2866 / r2862;
        double r2868 = t;
        double r2869 = r2868 / r2862;
        double r2870 = r2867 - r2869;
        double r2871 = fma(r2865, r2870, r2868);
        double r2872 = r2865 - r2862;
        double r2873 = a;
        double r2874 = r2873 - r2862;
        double r2875 = r2872 / r2874;
        double r2876 = cbrt(r2875);
        double r2877 = r2876 * r2876;
        double r2878 = r2876 * r2868;
        double r2879 = r2877 * r2878;
        double r2880 = -r2866;
        double r2881 = fma(r2880, r2875, r2866);
        double r2882 = r2879 + r2881;
        double r2883 = r2864 ? r2871 : r2882;
        return r2883;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original25.2
Target12.0
Herbie7.4
\[\begin{array}{l} \mathbf{if}\;z \lt -1.25361310560950359 \cdot 10^{188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z \lt 4.44670236911381103 \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 2 regimes
  2. if z < -6.195549894709601e+225

    1. Initial program 51.4

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

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

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

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

    if -6.195549894709601e+225 < z

    1. Initial program 23.1

      \[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-lft-in10.5

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

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

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

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

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

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

Reproduce

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