Average Error: 10.9 → 1.0
Time: 19.4s
Precision: 64
Internal precision: 384
\[\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{1 - {\left(\frac{Om}{Omc}\right)}^2}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^2} \le 1.1249976801847743 \cdot 10^{-288}:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^2}}{\frac{t \cdot \sqrt{2}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \log \left(e^{{\left(\frac{Om}{Omc}\right)}^2}\right)}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^2}}\right)\\
\end{array}\]
Derivation
- Split input into 2 regimes.
-
if (/ (- 1 (sqr (/ Om Omc))) (+ 1 (* 2 (sqr (/ t l))))) < 1.1249976801847743e-288
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)\]
- Using strategy
rm
Applied sqrt-div 34.9
\[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^2}}{\sqrt{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^2}}\right)}\]
Applied taylor 1.2
\[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^2}}{\frac{t \cdot \sqrt{2}}{\ell}}\right)\]
Taylor expanded around inf 1.2
\[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^2}}{\color{blue}{\frac{t \cdot \sqrt{2}}{\ell}}}\right)\]
if 1.1249976801847743e-288 < (/ (- 1 (sqr (/ Om Omc))) (+ 1 (* 2 (sqr (/ t l)))))
Initial program 0.9
\[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^2}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^2}}\right)\]
- Using strategy
rm
Applied add-log-exp 0.9
\[\leadsto \sin^{-1} \left(\sqrt{\frac{1 - \color{blue}{\log \left(e^{{\left(\frac{Om}{Omc}\right)}^2}\right)}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^2}}\right)\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie shell --seed '#(1064524629 4159152179 2999149171 575749698 4006532819 692958815)'
(FPCore (t l Om Omc)
:name "Toniolo and Linder, Equation (2)"
(asin (sqrt (/ (- 1 (sqr (/ Om Omc))) (+ 1 (* 2 (sqr (/ t l))))))))