Average Error: 10.0 → 3.0
Time: 57.4s
Precision: binary64
\[\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} t_1 := \frac{\ell \cdot \sqrt{0.5}}{t}\\ \mathbf{if}\;\frac{t}{\ell} \leq -9.571535657966036 \cdot 10^{+160}:\\ \;\;\;\;\sin^{-1} \left(-\sqrt{1 - \frac{Om \cdot Om}{Omc \cdot Omc}} \cdot t_1\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 1.575323330487734 \cdot 10^{+157}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(t_1 \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\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}
t_1 := \frac{\ell \cdot \sqrt{0.5}}{t}\\
\mathbf{if}\;\frac{t}{\ell} \leq -9.571535657966036 \cdot 10^{+160}:\\
\;\;\;\;\sin^{-1} \left(-\sqrt{1 - \frac{Om \cdot Om}{Omc \cdot Omc}} \cdot t_1\right)\\

\mathbf{elif}\;\frac{t}{\ell} \leq 1.575323330487734 \cdot 10^{+157}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)\\

\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(t_1 \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)\\


\end{array}
(FPCore (t l Om Omc)
 :precision binary64
 (asin
  (sqrt (/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (* 2.0 (pow (/ t l) 2.0)))))))
(FPCore (t l Om Omc)
 :precision binary64
 (let* ((t_1 (/ (* l (sqrt 0.5)) t)))
   (if (<= (/ t l) -9.571535657966036e+160)
     (asin (- (* (sqrt (- 1.0 (/ (* Om Om) (* Omc Omc)))) t_1)))
     (if (<= (/ t l) 1.575323330487734e+157)
       (asin
        (sqrt
         (/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (* 2.0 (pow (/ t l) 2.0))))))
       (asin (* t_1 (sqrt (- 1.0 (/ (pow Om 2.0) (pow Omc 2.0))))))))))
double code(double t, double l, double Om, double Omc) {
	return asin(sqrt(((1.0 - pow((Om / Omc), 2.0)) / (1.0 + (2.0 * pow((t / l), 2.0))))));
}
double code(double t, double l, double Om, double Omc) {
	double t_1 = (l * sqrt(0.5)) / t;
	double tmp;
	if ((t / l) <= -9.571535657966036e+160) {
		tmp = asin(-(sqrt((1.0 - ((Om * Om) / (Omc * Omc)))) * t_1));
	} else if ((t / l) <= 1.575323330487734e+157) {
		tmp = asin(sqrt(((1.0 - pow((Om / Omc), 2.0)) / (1.0 + (2.0 * pow((t / l), 2.0))))));
	} else {
		tmp = asin((t_1 * sqrt((1.0 - (pow(Om, 2.0) / pow(Omc, 2.0))))));
	}
	return tmp;
}

Error

Bits error versus t

Bits error versus l

Bits error versus Om

Bits error versus Omc

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if (/.f64 t l) < -9.5715356579660361e160

    1. Initial program 34.5

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

      \[\leadsto \color{blue}{\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{\mathsf{fma}\left(2, {\left(\frac{t}{\ell}\right)}^{2}, 1\right)}}\right)} \]
    3. Taylor expanded in t around -inf 7.1

      \[\leadsto \sin^{-1} \color{blue}{\left(-1 \cdot \left(\frac{\sqrt{0.5} \cdot \ell}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)\right)} \]
    4. Simplified7.1

      \[\leadsto \sin^{-1} \color{blue}{\left(-\sqrt{1 - \frac{Om \cdot Om}{Omc \cdot Omc}} \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]

    if -9.5715356579660361e160 < (/.f64 t l) < 1.5753233304877341e157

    1. Initial program 1.3

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

    if 1.5753233304877341e157 < (/.f64 t l)

    1. Initial program 32.3

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

      \[\leadsto \color{blue}{\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{\mathsf{fma}\left(2, {\left(\frac{t}{\ell}\right)}^{2}, 1\right)}}\right)} \]
    3. Taylor expanded in t around inf 8.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -9.571535657966036 \cdot 10^{+160}:\\ \;\;\;\;\sin^{-1} \left(-\sqrt{1 - \frac{Om \cdot Om}{Omc \cdot Omc}} \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 1.575323330487734 \cdot 10^{+157}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t} \cdot \sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2022130 
(FPCore (t l Om Omc)
  :name "Toniolo and Linder, Equation (2)"
  :precision binary64
  (asin (sqrt (/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (* 2.0 (pow (/ t l) 2.0)))))))