Average Error: 10.1 → 5.6
Time: 23.1s
Precision: 64
\[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)\]
\[\begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \le 6.668151396198947 \cdot 10^{+152}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\sqrt{\mathsf{fma}\left(2, \frac{t}{\ell} \cdot \frac{t}{\ell}, 1\right)}}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\frac{t \cdot \sqrt{2}}{\ell}}\right)\right)\right)\\ \end{array}\]
\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \le 6.668151396198947 \cdot 10^{+152}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\sqrt{\mathsf{fma}\left(2, \frac{t}{\ell} \cdot \frac{t}{\ell}, 1\right)}}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\frac{t \cdot \sqrt{2}}{\ell}}\right)\right)\right)\\

\end{array}
double f(double t, double l, double Om, double Omc) {
        double r1908698 = 1.0;
        double r1908699 = Om;
        double r1908700 = Omc;
        double r1908701 = r1908699 / r1908700;
        double r1908702 = 2.0;
        double r1908703 = pow(r1908701, r1908702);
        double r1908704 = r1908698 - r1908703;
        double r1908705 = t;
        double r1908706 = l;
        double r1908707 = r1908705 / r1908706;
        double r1908708 = pow(r1908707, r1908702);
        double r1908709 = r1908702 * r1908708;
        double r1908710 = r1908698 + r1908709;
        double r1908711 = r1908704 / r1908710;
        double r1908712 = sqrt(r1908711);
        double r1908713 = asin(r1908712);
        return r1908713;
}

double f(double t, double l, double Om, double Omc) {
        double r1908714 = t;
        double r1908715 = l;
        double r1908716 = r1908714 / r1908715;
        double r1908717 = 6.668151396198947e+152;
        bool r1908718 = r1908716 <= r1908717;
        double r1908719 = 1.0;
        double r1908720 = Om;
        double r1908721 = Omc;
        double r1908722 = r1908720 / r1908721;
        double r1908723 = r1908722 * r1908722;
        double r1908724 = r1908719 - r1908723;
        double r1908725 = sqrt(r1908724);
        double r1908726 = 2.0;
        double r1908727 = r1908716 * r1908716;
        double r1908728 = fma(r1908726, r1908727, r1908719);
        double r1908729 = sqrt(r1908728);
        double r1908730 = r1908725 / r1908729;
        double r1908731 = asin(r1908730);
        double r1908732 = log1p(r1908731);
        double r1908733 = expm1(r1908732);
        double r1908734 = sqrt(r1908726);
        double r1908735 = r1908714 * r1908734;
        double r1908736 = r1908735 / r1908715;
        double r1908737 = r1908725 / r1908736;
        double r1908738 = asin(r1908737);
        double r1908739 = log1p(r1908738);
        double r1908740 = expm1(r1908739);
        double r1908741 = r1908718 ? r1908733 : r1908740;
        return r1908741;
}

Error

Bits error versus t

Bits error versus l

Bits error versus Om

Bits error versus Omc

Derivation

  1. Split input into 2 regimes
  2. if (/ t l) < 6.668151396198947e+152

    1. Initial program 6.3

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)\]
    2. Simplified6.3

      \[\leadsto \color{blue}{\sin^{-1} \left(\sqrt{\frac{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}{\mathsf{fma}\left(2, \frac{t}{\ell} \cdot \frac{t}{\ell}, 1\right)}}\right)}\]
    3. Using strategy rm
    4. Applied expm1-log1p-u6.3

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\sqrt{\frac{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}{\mathsf{fma}\left(2, \frac{t}{\ell} \cdot \frac{t}{\ell}, 1\right)}}\right)\right)\right)}\]
    5. Using strategy rm
    6. Applied sqrt-div6.3

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\sqrt{\mathsf{fma}\left(2, \frac{t}{\ell} \cdot \frac{t}{\ell}, 1\right)}}\right)}\right)\right)\]

    if 6.668151396198947e+152 < (/ t l)

    1. Initial program 32.7

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)\]
    2. Simplified32.7

      \[\leadsto \color{blue}{\sin^{-1} \left(\sqrt{\frac{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}{\mathsf{fma}\left(2, \frac{t}{\ell} \cdot \frac{t}{\ell}, 1\right)}}\right)}\]
    3. Using strategy rm
    4. Applied expm1-log1p-u32.7

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\sqrt{\frac{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}{\mathsf{fma}\left(2, \frac{t}{\ell} \cdot \frac{t}{\ell}, 1\right)}}\right)\right)\right)}\]
    5. Using strategy rm
    6. Applied sqrt-div32.7

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\sqrt{\mathsf{fma}\left(2, \frac{t}{\ell} \cdot \frac{t}{\ell}, 1\right)}}\right)}\right)\right)\]
    7. Taylor expanded around inf 1.3

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\color{blue}{\frac{t \cdot \sqrt{2}}{\ell}}}\right)\right)\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification5.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \le 6.668151396198947 \cdot 10^{+152}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\sqrt{\mathsf{fma}\left(2, \frac{t}{\ell} \cdot \frac{t}{\ell}, 1\right)}}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\frac{t \cdot \sqrt{2}}{\ell}}\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019158 +o rules:numerics
(FPCore (t l Om Omc)
  :name "Toniolo and Linder, Equation (2)"
  (asin (sqrt (/ (- 1 (pow (/ Om Omc) 2)) (+ 1 (* 2 (pow (/ t l) 2)))))))