Average Error: 14.7 → 9.5
Time: 6.1s
Precision: 64
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -9.1914594564867916 \cdot 10^{238}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;z \le 1.59368057391188301 \cdot 10^{-4}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \mathbf{elif}\;z \le 2.5065936828757308 \cdot 10^{225}:\\ \;\;\;\;\frac{y}{\frac{a - z}{t - x}} - \left(\frac{z}{\frac{a - z}{t - x}} - x\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -9.1914594564867916 \cdot 10^{238}:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r125900 = x;
        double r125901 = y;
        double r125902 = z;
        double r125903 = r125901 - r125902;
        double r125904 = t;
        double r125905 = r125904 - r125900;
        double r125906 = a;
        double r125907 = r125906 - r125902;
        double r125908 = r125905 / r125907;
        double r125909 = r125903 * r125908;
        double r125910 = r125900 + r125909;
        return r125910;
}

double f(double x, double y, double z, double t, double a) {
        double r125911 = z;
        double r125912 = -9.191459456486792e+238;
        bool r125913 = r125911 <= r125912;
        double r125914 = 1.0;
        double r125915 = y;
        double r125916 = x;
        double r125917 = r125916 / r125911;
        double r125918 = t;
        double r125919 = r125918 / r125911;
        double r125920 = r125917 - r125919;
        double r125921 = fma(r125915, r125920, r125918);
        double r125922 = r125914 * r125921;
        double r125923 = 0.0001593680573911883;
        bool r125924 = r125911 <= r125923;
        double r125925 = r125915 - r125911;
        double r125926 = a;
        double r125927 = r125926 - r125911;
        double r125928 = r125925 / r125927;
        double r125929 = r125918 - r125916;
        double r125930 = fma(r125928, r125929, r125916);
        double r125931 = r125914 * r125930;
        double r125932 = 2.5065936828757308e+225;
        bool r125933 = r125911 <= r125932;
        double r125934 = r125927 / r125929;
        double r125935 = r125915 / r125934;
        double r125936 = r125911 / r125934;
        double r125937 = r125936 - r125916;
        double r125938 = r125935 - r125937;
        double r125939 = r125933 ? r125938 : r125922;
        double r125940 = r125924 ? r125931 : r125939;
        double r125941 = r125913 ? r125922 : r125940;
        return r125941;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Derivation

  1. Split input into 3 regimes
  2. if z < -9.191459456486792e+238 or 2.5065936828757308e+225 < z

    1. Initial program 32.5

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
    8. Using strategy rm
    9. Applied *-un-lft-identity32.7

      \[\leadsto \frac{y - z}{\frac{a - z}{t - x}} + \color{blue}{1 \cdot x}\]
    10. Applied *-un-lft-identity32.7

      \[\leadsto \color{blue}{1 \cdot \frac{y - z}{\frac{a - z}{t - x}}} + 1 \cdot x\]
    11. Applied distribute-lft-out32.7

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

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

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

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

    if -9.191459456486792e+238 < z < 0.0001593680573911883

    1. Initial program 10.2

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
    8. Using strategy rm
    9. Applied *-un-lft-identity10.0

      \[\leadsto \frac{y - z}{\frac{a - z}{t - x}} + \color{blue}{1 \cdot x}\]
    10. Applied *-un-lft-identity10.0

      \[\leadsto \color{blue}{1 \cdot \frac{y - z}{\frac{a - z}{t - x}}} + 1 \cdot x\]
    11. Applied distribute-lft-out10.0

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

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

    if 0.0001593680573911883 < z < 2.5065936828757308e+225

    1. Initial program 16.3

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

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

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

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

      \[\leadsto \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}} + x\]
    8. Using strategy rm
    9. Applied div-sub16.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -9.1914594564867916 \cdot 10^{238}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \mathbf{elif}\;z \le 1.59368057391188301 \cdot 10^{-4}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(\frac{y - z}{a - z}, t - x, x\right)\\ \mathbf{elif}\;z \le 2.5065936828757308 \cdot 10^{225}:\\ \;\;\;\;\frac{y}{\frac{a - z}{t - x}} - \left(\frac{z}{\frac{a - z}{t - x}} - x\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \mathsf{fma}\left(y, \frac{x}{z} - \frac{t}{z}, t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020046 +o rules:numerics
(FPCore (x y z t a)
  :name "Numeric.Signal:interpolate   from hsignal-0.2.7.1"
  :precision binary64
  (+ x (* (- y z) (/ (- t x) (- a z)))))