Average Error: 10.1 → 5.4
Time: 18.5s
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 1.2007149219171108 \cdot 10^{+153}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\sqrt{\mathsf{fma}\left(\frac{t}{\ell} \cdot \frac{t}{\ell}, 2, 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 1.2007149219171108 \cdot 10^{+153}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\sqrt{\mathsf{fma}\left(\frac{t}{\ell} \cdot \frac{t}{\ell}, 2, 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 r1324921 = 1.0;
        double r1324922 = Om;
        double r1324923 = Omc;
        double r1324924 = r1324922 / r1324923;
        double r1324925 = 2.0;
        double r1324926 = pow(r1324924, r1324925);
        double r1324927 = r1324921 - r1324926;
        double r1324928 = t;
        double r1324929 = l;
        double r1324930 = r1324928 / r1324929;
        double r1324931 = pow(r1324930, r1324925);
        double r1324932 = r1324925 * r1324931;
        double r1324933 = r1324921 + r1324932;
        double r1324934 = r1324927 / r1324933;
        double r1324935 = sqrt(r1324934);
        double r1324936 = asin(r1324935);
        return r1324936;
}

double f(double t, double l, double Om, double Omc) {
        double r1324937 = t;
        double r1324938 = l;
        double r1324939 = r1324937 / r1324938;
        double r1324940 = 1.2007149219171108e+153;
        bool r1324941 = r1324939 <= r1324940;
        double r1324942 = 1.0;
        double r1324943 = Om;
        double r1324944 = Omc;
        double r1324945 = r1324943 / r1324944;
        double r1324946 = r1324945 * r1324945;
        double r1324947 = r1324942 - r1324946;
        double r1324948 = sqrt(r1324947);
        double r1324949 = r1324939 * r1324939;
        double r1324950 = 2.0;
        double r1324951 = fma(r1324949, r1324950, r1324942);
        double r1324952 = sqrt(r1324951);
        double r1324953 = r1324948 / r1324952;
        double r1324954 = asin(r1324953);
        double r1324955 = log1p(r1324954);
        double r1324956 = expm1(r1324955);
        double r1324957 = sqrt(r1324950);
        double r1324958 = r1324937 * r1324957;
        double r1324959 = r1324958 / r1324938;
        double r1324960 = r1324948 / r1324959;
        double r1324961 = asin(r1324960);
        double r1324962 = log1p(r1324961);
        double r1324963 = expm1(r1324962);
        double r1324964 = r1324941 ? r1324956 : r1324963;
        return r1324964;
}

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) < 1.2007149219171108e+153

    1. Initial program 6.0

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

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

      \[\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(\frac{t}{\ell} \cdot \frac{t}{\ell}, 2, 1\right)}}\right)\right)\right)}\]
    5. Using strategy rm
    6. Applied sqrt-div6.1

      \[\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(\frac{t}{\ell} \cdot \frac{t}{\ell}, 2, 1\right)}}\right)}\right)\right)\]

    if 1.2007149219171108e+153 < (/ t l)

    1. Initial program 34.9

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

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

      \[\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(\frac{t}{\ell} \cdot \frac{t}{\ell}, 2, 1\right)}}\right)\right)\right)}\]
    5. Using strategy rm
    6. Applied sqrt-div34.9

      \[\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(\frac{t}{\ell} \cdot \frac{t}{\ell}, 2, 1\right)}}\right)}\right)\right)\]
    7. Taylor expanded around inf 1.4

      \[\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.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \le 1.2007149219171108 \cdot 10^{+153}:\\ \;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(\sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}}{\sqrt{\mathsf{fma}\left(\frac{t}{\ell} \cdot \frac{t}{\ell}, 2, 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 2019152 +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)))))))