Average Error: 42.5 → 9.1
Time: 27.3s
Precision: 64
\[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;t \le -2.661507795721962 \cdot 10^{+93}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t}{\mathsf{fma}\left(\frac{2}{2 \cdot \sqrt{2}}, \frac{t}{x \cdot x}, -\mathsf{fma}\left(\frac{2}{\sqrt{2}}, \frac{t}{x}, \mathsf{fma}\left(\sqrt{2}, t, \frac{t}{x \cdot x} \cdot \frac{2}{\sqrt{2}}\right)\right)\right)}\\ \mathbf{elif}\;t \le 4.088323180304518 \cdot 10^{+139}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(2, \mathsf{fma}\left(t, t, \ell \cdot \frac{\ell}{x}\right), \frac{4 \cdot \left(t \cdot t\right)}{x}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t}{\mathsf{fma}\left(\frac{2}{x \cdot x}, \frac{t}{\sqrt{2}}, \mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(\frac{2}{x}, \frac{t}{\sqrt{2}}, \frac{\frac{\frac{t}{\sqrt{2}}}{2}}{x \cdot x} \cdot -2\right)\right)\right)}\\ \end{array}\]
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;t \le -2.661507795721962 \cdot 10^{+93}:\\
\;\;\;\;\frac{\sqrt{2} \cdot t}{\mathsf{fma}\left(\frac{2}{2 \cdot \sqrt{2}}, \frac{t}{x \cdot x}, -\mathsf{fma}\left(\frac{2}{\sqrt{2}}, \frac{t}{x}, \mathsf{fma}\left(\sqrt{2}, t, \frac{t}{x \cdot x} \cdot \frac{2}{\sqrt{2}}\right)\right)\right)}\\

\mathbf{elif}\;t \le 4.088323180304518 \cdot 10^{+139}:\\
\;\;\;\;\frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(2, \mathsf{fma}\left(t, t, \ell \cdot \frac{\ell}{x}\right), \frac{4 \cdot \left(t \cdot t\right)}{x}\right)}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2} \cdot t}{\mathsf{fma}\left(\frac{2}{x \cdot x}, \frac{t}{\sqrt{2}}, \mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(\frac{2}{x}, \frac{t}{\sqrt{2}}, \frac{\frac{\frac{t}{\sqrt{2}}}{2}}{x \cdot x} \cdot -2\right)\right)\right)}\\

\end{array}
double f(double x, double l, double t) {
        double r440165 = 2.0;
        double r440166 = sqrt(r440165);
        double r440167 = t;
        double r440168 = r440166 * r440167;
        double r440169 = x;
        double r440170 = 1.0;
        double r440171 = r440169 + r440170;
        double r440172 = r440169 - r440170;
        double r440173 = r440171 / r440172;
        double r440174 = l;
        double r440175 = r440174 * r440174;
        double r440176 = r440167 * r440167;
        double r440177 = r440165 * r440176;
        double r440178 = r440175 + r440177;
        double r440179 = r440173 * r440178;
        double r440180 = r440179 - r440175;
        double r440181 = sqrt(r440180);
        double r440182 = r440168 / r440181;
        return r440182;
}

double f(double x, double l, double t) {
        double r440183 = t;
        double r440184 = -2.661507795721962e+93;
        bool r440185 = r440183 <= r440184;
        double r440186 = 2.0;
        double r440187 = sqrt(r440186);
        double r440188 = r440187 * r440183;
        double r440189 = r440186 * r440187;
        double r440190 = r440186 / r440189;
        double r440191 = x;
        double r440192 = r440191 * r440191;
        double r440193 = r440183 / r440192;
        double r440194 = r440186 / r440187;
        double r440195 = r440183 / r440191;
        double r440196 = r440193 * r440194;
        double r440197 = fma(r440187, r440183, r440196);
        double r440198 = fma(r440194, r440195, r440197);
        double r440199 = -r440198;
        double r440200 = fma(r440190, r440193, r440199);
        double r440201 = r440188 / r440200;
        double r440202 = 4.088323180304518e+139;
        bool r440203 = r440183 <= r440202;
        double r440204 = l;
        double r440205 = r440204 / r440191;
        double r440206 = r440204 * r440205;
        double r440207 = fma(r440183, r440183, r440206);
        double r440208 = 4.0;
        double r440209 = r440183 * r440183;
        double r440210 = r440208 * r440209;
        double r440211 = r440210 / r440191;
        double r440212 = fma(r440186, r440207, r440211);
        double r440213 = sqrt(r440212);
        double r440214 = r440188 / r440213;
        double r440215 = r440186 / r440192;
        double r440216 = r440183 / r440187;
        double r440217 = r440186 / r440191;
        double r440218 = r440216 / r440186;
        double r440219 = r440218 / r440192;
        double r440220 = -2.0;
        double r440221 = r440219 * r440220;
        double r440222 = fma(r440217, r440216, r440221);
        double r440223 = fma(r440183, r440187, r440222);
        double r440224 = fma(r440215, r440216, r440223);
        double r440225 = r440188 / r440224;
        double r440226 = r440203 ? r440214 : r440225;
        double r440227 = r440185 ? r440201 : r440226;
        return r440227;
}

Error

Bits error versus x

Bits error versus l

Bits error versus t

Derivation

  1. Split input into 3 regimes
  2. if t < -2.661507795721962e+93

    1. Initial program 50.3

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}\]
    2. Taylor expanded around -inf 3.1

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{2 \cdot \frac{t}{{\left(\sqrt{2}\right)}^{3} \cdot {x}^{2}} - \left(2 \cdot \frac{t}{\sqrt{2} \cdot {x}^{2}} + \left(t \cdot \sqrt{2} + 2 \cdot \frac{t}{\sqrt{2} \cdot x}\right)\right)}}\]
    3. Simplified3.1

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

    if -2.661507795721962e+93 < t < 4.088323180304518e+139

    1. Initial program 35.8

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}\]
    2. Taylor expanded around inf 17.0

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{2 \cdot {t}^{2} + \left(2 \cdot \frac{{\ell}^{2}}{x} + 4 \cdot \frac{{t}^{2}}{x}\right)}}}\]
    3. Simplified17.0

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\color{blue}{\mathsf{fma}\left(2, \mathsf{fma}\left(t, t, \frac{\ell \cdot \ell}{x}\right), \frac{4 \cdot \left(t \cdot t\right)}{x}\right)}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity17.0

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(2, \mathsf{fma}\left(t, t, \frac{\ell \cdot \ell}{\color{blue}{1 \cdot x}}\right), \frac{4 \cdot \left(t \cdot t\right)}{x}\right)}}\]
    6. Applied times-frac12.9

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(2, \mathsf{fma}\left(t, t, \color{blue}{\frac{\ell}{1} \cdot \frac{\ell}{x}}\right), \frac{4 \cdot \left(t \cdot t\right)}{x}\right)}}\]
    7. Simplified12.9

      \[\leadsto \frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(2, \mathsf{fma}\left(t, t, \color{blue}{\ell} \cdot \frac{\ell}{x}\right), \frac{4 \cdot \left(t \cdot t\right)}{x}\right)}}\]

    if 4.088323180304518e+139 < t

    1. Initial program 57.8

      \[\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}\]
    2. Taylor expanded around inf 2.1

      \[\leadsto \frac{\sqrt{2} \cdot t}{\color{blue}{\left(2 \cdot \frac{t}{\sqrt{2} \cdot {x}^{2}} + \left(t \cdot \sqrt{2} + 2 \cdot \frac{t}{\sqrt{2} \cdot x}\right)\right) - 2 \cdot \frac{t}{{\left(\sqrt{2}\right)}^{3} \cdot {x}^{2}}}}\]
    3. Simplified2.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -2.661507795721962 \cdot 10^{+93}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t}{\mathsf{fma}\left(\frac{2}{2 \cdot \sqrt{2}}, \frac{t}{x \cdot x}, -\mathsf{fma}\left(\frac{2}{\sqrt{2}}, \frac{t}{x}, \mathsf{fma}\left(\sqrt{2}, t, \frac{t}{x \cdot x} \cdot \frac{2}{\sqrt{2}}\right)\right)\right)}\\ \mathbf{elif}\;t \le 4.088323180304518 \cdot 10^{+139}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t}{\sqrt{\mathsf{fma}\left(2, \mathsf{fma}\left(t, t, \ell \cdot \frac{\ell}{x}\right), \frac{4 \cdot \left(t \cdot t\right)}{x}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2} \cdot t}{\mathsf{fma}\left(\frac{2}{x \cdot x}, \frac{t}{\sqrt{2}}, \mathsf{fma}\left(t, \sqrt{2}, \mathsf{fma}\left(\frac{2}{x}, \frac{t}{\sqrt{2}}, \frac{\frac{\frac{t}{\sqrt{2}}}{2}}{x \cdot x} \cdot -2\right)\right)\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2019151 +o rules:numerics
(FPCore (x l t)
  :name "Toniolo and Linder, Equation (7)"
  (/ (* (sqrt 2) t) (sqrt (- (* (/ (+ x 1) (- x 1)) (+ (* l l) (* 2 (* t t)))) (* l l)))))