Toniolo and Linder, Equation (2)

Percentage Accurate: 85.0% → 98.4%
Time: 17.3s
Alternatives: 11
Speedup: 1.9×

Specification

?
\[\begin{array}{l} \\ \sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{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)))))))
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))))));
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    code = asin(sqrt(((1.0d0 - ((om / omc) ** 2.0d0)) / (1.0d0 + (2.0d0 * ((t / l) ** 2.0d0))))))
end function
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin(Math.sqrt(((1.0 - Math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * Math.pow((t / l), 2.0))))));
}
def code(t, l, Om, Omc):
	return math.asin(math.sqrt(((1.0 - math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * math.pow((t / l), 2.0))))))
function code(t, l, Om, Omc)
	return asin(sqrt(Float64(Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) / Float64(1.0 + Float64(2.0 * (Float64(t / l) ^ 2.0))))))
end
function tmp = code(t, l, Om, Omc)
	tmp = asin(sqrt(((1.0 - ((Om / Omc) ^ 2.0)) / (1.0 + (2.0 * ((t / l) ^ 2.0))))));
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 85.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{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)))))))
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))))));
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    code = asin(sqrt(((1.0d0 - ((om / omc) ** 2.0d0)) / (1.0d0 + (2.0d0 * ((t / l) ** 2.0d0))))))
end function
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin(Math.sqrt(((1.0 - Math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * Math.pow((t / l), 2.0))))));
}
def code(t, l, Om, Omc):
	return math.asin(math.sqrt(((1.0 - math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * math.pow((t / l), 2.0))))))
function code(t, l, Om, Omc)
	return asin(sqrt(Float64(Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) / Float64(1.0 + Float64(2.0 * (Float64(t / l) ^ 2.0))))))
end
function tmp = code(t, l, Om, Omc)
	tmp = asin(sqrt(((1.0 - ((Om / Omc) ^ 2.0)) / (1.0 + (2.0 * ((t / l) ^ 2.0))))));
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 98.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right) \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (asin
  (/ (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (hypot 1.0 (/ t (/ l (sqrt 2.0)))))))
double code(double t, double l, double Om, double Omc) {
	return asin((sqrt((1.0 - pow((Om / Omc), 2.0))) / hypot(1.0, (t / (l / sqrt(2.0))))));
}
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin((Math.sqrt((1.0 - Math.pow((Om / Omc), 2.0))) / Math.hypot(1.0, (t / (l / Math.sqrt(2.0))))));
}
def code(t, l, Om, Omc):
	return math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) / math.hypot(1.0, (t / (l / math.sqrt(2.0))))))
function code(t, l, Om, Omc)
	return asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) / hypot(1.0, Float64(t / Float64(l / sqrt(2.0))))))
end
function tmp = code(t, l, Om, Omc)
	tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) / hypot(1.0, (t / (l / sqrt(2.0))))));
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(t / N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)
\end{array}
Derivation
  1. Initial program 82.3%

    \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sqrt-div82.2%

      \[\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)} \]
    2. div-inv82.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\sqrt{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)} \]
    3. add-sqr-sqrt82.2%

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

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}\right)}}\right) \]
    5. *-commutative82.2%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{{\left(\frac{t}{\ell}\right)}^{2} \cdot 2}}\right)}\right) \]
    6. sqrt-prod82.2%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2}}\right)}\right) \]
    7. unpow282.2%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{t}{\ell} \cdot \frac{t}{\ell}}} \cdot \sqrt{2}\right)}\right) \]
    8. sqrt-prod49.9%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{t}{\ell}} \cdot \sqrt{\frac{t}{\ell}}\right)} \cdot \sqrt{2}\right)}\right) \]
    9. add-sqr-sqrt99.2%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\ell}} \cdot \sqrt{2}\right)}\right) \]
  4. Applied egg-rr99.2%

    \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
  5. Step-by-step derivation
    1. associate-*r/99.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot 1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
    2. *-rgt-identity99.2%

      \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right) \]
    3. associate-*l/99.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t \cdot \sqrt{2}}{\ell}}\right)}\right) \]
    4. associate-/l*99.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\frac{\ell}{\sqrt{2}}}}\right)}\right) \]
  6. Simplified99.2%

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)} \]
  7. Final simplification99.2%

    \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right) \]
  8. Add Preprocessing

Alternative 2: 98.4% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \sqrt{2} \cdot \frac{t}{\ell}\right)}\right) \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (asin
  (/ (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (hypot 1.0 (* (sqrt 2.0) (/ t l))))))
double code(double t, double l, double Om, double Omc) {
	return asin((sqrt((1.0 - pow((Om / Omc), 2.0))) / hypot(1.0, (sqrt(2.0) * (t / l)))));
}
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin((Math.sqrt((1.0 - Math.pow((Om / Omc), 2.0))) / Math.hypot(1.0, (Math.sqrt(2.0) * (t / l)))));
}
def code(t, l, Om, Omc):
	return math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) / math.hypot(1.0, (math.sqrt(2.0) * (t / l)))))
function code(t, l, Om, Omc)
	return asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) / hypot(1.0, Float64(sqrt(2.0) * Float64(t / l)))))
end
function tmp = code(t, l, Om, Omc)
	tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) / hypot(1.0, (sqrt(2.0) * (t / l)))));
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[Sqrt[2.0], $MachinePrecision] * N[(t / l), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \sqrt{2} \cdot \frac{t}{\ell}\right)}\right)
\end{array}
Derivation
  1. Initial program 82.3%

    \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sqrt-div82.2%

      \[\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)} \]
    2. add-sqr-sqrt82.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\sqrt{1 + \color{blue}{\sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}}}\right) \]
    3. hypot-1-def82.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}\right)}}\right) \]
    4. *-commutative82.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{{\left(\frac{t}{\ell}\right)}^{2} \cdot 2}}\right)}\right) \]
    5. sqrt-prod82.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2}}\right)}\right) \]
    6. unpow282.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{t}{\ell} \cdot \frac{t}{\ell}}} \cdot \sqrt{2}\right)}\right) \]
    7. sqrt-prod49.9%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{t}{\ell}} \cdot \sqrt{\frac{t}{\ell}}\right)} \cdot \sqrt{2}\right)}\right) \]
    8. add-sqr-sqrt99.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\ell}} \cdot \sqrt{2}\right)}\right) \]
  4. Applied egg-rr99.2%

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
  5. Final simplification99.2%

    \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \sqrt{2} \cdot \frac{t}{\ell}\right)}\right) \]
  6. Add Preprocessing

Alternative 3: 97.5% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right) \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (asin (/ 1.0 (hypot 1.0 (/ t (/ l (sqrt 2.0)))))))
double code(double t, double l, double Om, double Omc) {
	return asin((1.0 / hypot(1.0, (t / (l / sqrt(2.0))))));
}
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin((1.0 / Math.hypot(1.0, (t / (l / Math.sqrt(2.0))))));
}
def code(t, l, Om, Omc):
	return math.asin((1.0 / math.hypot(1.0, (t / (l / math.sqrt(2.0))))))
function code(t, l, Om, Omc)
	return asin(Float64(1.0 / hypot(1.0, Float64(t / Float64(l / sqrt(2.0))))))
end
function tmp = code(t, l, Om, Omc)
	tmp = asin((1.0 / hypot(1.0, (t / (l / sqrt(2.0))))));
end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(t / N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)
\end{array}
Derivation
  1. Initial program 82.3%

    \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sqrt-div82.2%

      \[\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)} \]
    2. div-inv82.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\sqrt{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)} \]
    3. add-sqr-sqrt82.2%

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

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}\right)}}\right) \]
    5. *-commutative82.2%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{{\left(\frac{t}{\ell}\right)}^{2} \cdot 2}}\right)}\right) \]
    6. sqrt-prod82.2%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2}}\right)}\right) \]
    7. unpow282.2%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{t}{\ell} \cdot \frac{t}{\ell}}} \cdot \sqrt{2}\right)}\right) \]
    8. sqrt-prod49.9%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{t}{\ell}} \cdot \sqrt{\frac{t}{\ell}}\right)} \cdot \sqrt{2}\right)}\right) \]
    9. add-sqr-sqrt99.2%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\ell}} \cdot \sqrt{2}\right)}\right) \]
  4. Applied egg-rr99.2%

    \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
  5. Step-by-step derivation
    1. associate-*r/99.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot 1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
    2. *-rgt-identity99.2%

      \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right) \]
    3. associate-*l/99.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t \cdot \sqrt{2}}{\ell}}\right)}\right) \]
    4. associate-/l*99.2%

      \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\frac{\ell}{\sqrt{2}}}}\right)}\right) \]
  6. Simplified99.2%

    \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)} \]
  7. Taylor expanded in Om around 0 98.6%

    \[\leadsto \sin^{-1} \left(\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right) \]
  8. Final simplification98.6%

    \[\leadsto \sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right) \]
  9. Add Preprocessing

Alternative 4: 98.1% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -8 \cdot 10^{+143}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \left(-\ell\right)}{t}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{+147}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{1}{1 + 2 \cdot \left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\ \end{array} \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (if (<= (/ t l) -8e+143)
   (asin (/ (* (sqrt 0.5) (- l)) t))
   (if (<= (/ t l) 2e+147)
     (asin (sqrt (/ 1.0 (+ 1.0 (* 2.0 (* (/ t l) (/ t l)))))))
     (asin (/ (* l (sqrt 0.5)) t)))))
double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -8e+143) {
		tmp = asin(((sqrt(0.5) * -l) / t));
	} else if ((t / l) <= 2e+147) {
		tmp = asin(sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l)))))));
	} else {
		tmp = asin(((l * sqrt(0.5)) / t));
	}
	return tmp;
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if ((t / l) <= (-8d+143)) then
        tmp = asin(((sqrt(0.5d0) * -l) / t))
    else if ((t / l) <= 2d+147) then
        tmp = asin(sqrt((1.0d0 / (1.0d0 + (2.0d0 * ((t / l) * (t / l)))))))
    else
        tmp = asin(((l * sqrt(0.5d0)) / t))
    end if
    code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -8e+143) {
		tmp = Math.asin(((Math.sqrt(0.5) * -l) / t));
	} else if ((t / l) <= 2e+147) {
		tmp = Math.asin(Math.sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l)))))));
	} else {
		tmp = Math.asin(((l * Math.sqrt(0.5)) / t));
	}
	return tmp;
}
def code(t, l, Om, Omc):
	tmp = 0
	if (t / l) <= -8e+143:
		tmp = math.asin(((math.sqrt(0.5) * -l) / t))
	elif (t / l) <= 2e+147:
		tmp = math.asin(math.sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l)))))))
	else:
		tmp = math.asin(((l * math.sqrt(0.5)) / t))
	return tmp
function code(t, l, Om, Omc)
	tmp = 0.0
	if (Float64(t / l) <= -8e+143)
		tmp = asin(Float64(Float64(sqrt(0.5) * Float64(-l)) / t));
	elseif (Float64(t / l) <= 2e+147)
		tmp = asin(sqrt(Float64(1.0 / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) * Float64(t / l)))))));
	else
		tmp = asin(Float64(Float64(l * sqrt(0.5)) / t));
	end
	return tmp
end
function tmp_2 = code(t, l, Om, Omc)
	tmp = 0.0;
	if ((t / l) <= -8e+143)
		tmp = asin(((sqrt(0.5) * -l) / t));
	elseif ((t / l) <= 2e+147)
		tmp = asin(sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l)))))));
	else
		tmp = asin(((l * sqrt(0.5)) / t));
	end
	tmp_2 = tmp;
end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -8e+143], N[ArcSin[N[(N[(N[Sqrt[0.5], $MachinePrecision] * (-l)), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 2e+147], N[ArcSin[N[Sqrt[N[(1.0 / N[(1.0 + N[(2.0 * N[(N[(t / l), $MachinePrecision] * N[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -8 \cdot 10^{+143}:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \left(-\ell\right)}{t}\right)\\

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

\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 t l) < -8.0000000000000002e143

    1. Initial program 45.2%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in Om around 0 45.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    4. Taylor expanded in t around -inf 99.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(-1 \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/99.7%

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{-1 \cdot \left(\ell \cdot \sqrt{0.5}\right)}{t}\right)} \]
      2. neg-mul-199.7%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{-\ell \cdot \sqrt{0.5}}}{t}\right) \]
      3. distribute-rgt-neg-in99.7%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\ell \cdot \left(-\sqrt{0.5}\right)}}{t}\right) \]
    6. Simplified99.7%

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

    if -8.0000000000000002e143 < (/.f64 t l) < 2e147

    1. Initial program 99.4%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in Om around 0 74.6%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    4. Step-by-step derivation
      1. unpow274.6%

        \[\leadsto \sin^{-1} \left(\sqrt{\frac{1}{1 + 2 \cdot \frac{\color{blue}{t \cdot t}}{{\ell}^{2}}}}\right) \]
      2. unpow274.6%

        \[\leadsto \sin^{-1} \left(\sqrt{\frac{1}{1 + 2 \cdot \frac{t \cdot t}{\color{blue}{\ell \cdot \ell}}}}\right) \]
      3. frac-times98.4%

        \[\leadsto \sin^{-1} \left(\sqrt{\frac{1}{1 + 2 \cdot \color{blue}{\left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)}}}\right) \]
    5. Applied egg-rr98.4%

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

    if 2e147 < (/.f64 t l)

    1. Initial program 47.1%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in Om around 0 47.1%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    4. Taylor expanded in t around inf 99.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification98.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -8 \cdot 10^{+143}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \left(-\ell\right)}{t}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{+147}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{1}{1 + 2 \cdot \left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 97.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -20:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \left(-\ell\right)}{t}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{-8}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \end{array} \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (if (<= (/ t l) -20.0)
   (asin (/ (* (sqrt 0.5) (- l)) t))
   (if (<= (/ t l) 2e-8)
     (asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
     (asin (/ l (* t (sqrt 2.0)))))))
double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -20.0) {
		tmp = asin(((sqrt(0.5) * -l) / t));
	} else if ((t / l) <= 2e-8) {
		tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
	} else {
		tmp = asin((l / (t * sqrt(2.0))));
	}
	return tmp;
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if ((t / l) <= (-20.0d0)) then
        tmp = asin(((sqrt(0.5d0) * -l) / t))
    else if ((t / l) <= 2d-8) then
        tmp = asin(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
    else
        tmp = asin((l / (t * sqrt(2.0d0))))
    end if
    code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -20.0) {
		tmp = Math.asin(((Math.sqrt(0.5) * -l) / t));
	} else if ((t / l) <= 2e-8) {
		tmp = Math.asin(Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
	} else {
		tmp = Math.asin((l / (t * Math.sqrt(2.0))));
	}
	return tmp;
}
def code(t, l, Om, Omc):
	tmp = 0
	if (t / l) <= -20.0:
		tmp = math.asin(((math.sqrt(0.5) * -l) / t))
	elif (t / l) <= 2e-8:
		tmp = math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))))
	else:
		tmp = math.asin((l / (t * math.sqrt(2.0))))
	return tmp
function code(t, l, Om, Omc)
	tmp = 0.0
	if (Float64(t / l) <= -20.0)
		tmp = asin(Float64(Float64(sqrt(0.5) * Float64(-l)) / t));
	elseif (Float64(t / l) <= 2e-8)
		tmp = asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om)))));
	else
		tmp = asin(Float64(l / Float64(t * sqrt(2.0))));
	end
	return tmp
end
function tmp_2 = code(t, l, Om, Omc)
	tmp = 0.0;
	if ((t / l) <= -20.0)
		tmp = asin(((sqrt(0.5) * -l) / t));
	elseif ((t / l) <= 2e-8)
		tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
	else
		tmp = asin((l / (t * sqrt(2.0))));
	end
	tmp_2 = tmp;
end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -20.0], N[ArcSin[N[(N[(N[Sqrt[0.5], $MachinePrecision] * (-l)), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 2e-8], N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -20:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \left(-\ell\right)}{t}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 t l) < -20

    1. Initial program 68.9%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in Om around 0 40.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    4. Taylor expanded in t around -inf 97.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(-1 \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/97.7%

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{-1 \cdot \left(\ell \cdot \sqrt{0.5}\right)}{t}\right)} \]
      2. neg-mul-197.7%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{-\ell \cdot \sqrt{0.5}}}{t}\right) \]
      3. distribute-rgt-neg-in97.7%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\ell \cdot \left(-\sqrt{0.5}\right)}}{t}\right) \]
    6. Simplified97.7%

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

    if -20 < (/.f64 t l) < 2e-8

    1. Initial program 99.2%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 83.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
    4. Step-by-step derivation
      1. unpow283.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{{Om}^{2}}{\color{blue}{Omc \cdot Omc}}}\right) \]
      2. unpow283.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{\color{blue}{Om \cdot Om}}{Omc \cdot Omc}}\right) \]
      3. times-frac97.5%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}\right) \]
      4. unpow297.5%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{{\left(\frac{Om}{Omc}\right)}^{2}}}\right) \]
    5. Simplified97.5%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}\right)} \]
    6. Step-by-step derivation
      1. unpow297.5%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}\right) \]
      2. clear-num97.5%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{Om}{Omc} \cdot \color{blue}{\frac{1}{\frac{Omc}{Om}}}}\right) \]
      3. un-div-inv97.5%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{\frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}\right) \]
    7. Applied egg-rr97.5%

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

    if 2e-8 < (/.f64 t l)

    1. Initial program 67.7%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sqrt-div67.7%

        \[\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)} \]
      2. div-inv67.7%

        \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\sqrt{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)} \]
      3. add-sqr-sqrt67.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}}}\right) \]
      4. hypot-1-def67.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}\right)}}\right) \]
      5. *-commutative67.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{{\left(\frac{t}{\ell}\right)}^{2} \cdot 2}}\right)}\right) \]
      6. sqrt-prod67.6%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2}}\right)}\right) \]
      7. unpow267.6%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{t}{\ell} \cdot \frac{t}{\ell}}} \cdot \sqrt{2}\right)}\right) \]
      8. sqrt-prod98.6%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{t}{\ell}} \cdot \sqrt{\frac{t}{\ell}}\right)} \cdot \sqrt{2}\right)}\right) \]
      9. add-sqr-sqrt98.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\ell}} \cdot \sqrt{2}\right)}\right) \]
    4. Applied egg-rr98.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/98.7%

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot 1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
      2. *-rgt-identity98.7%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right) \]
      3. associate-*l/98.7%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t \cdot \sqrt{2}}{\ell}}\right)}\right) \]
      4. associate-/l*98.8%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\frac{\ell}{\sqrt{2}}}}\right)}\right) \]
    6. Simplified98.8%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)} \]
    7. Taylor expanded in Om around 0 98.8%

      \[\leadsto \sin^{-1} \left(\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right) \]
    8. Taylor expanded in t around inf 98.8%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell}{t \cdot \sqrt{2}}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -20:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \left(-\ell\right)}{t}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{-8}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 58.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{+136}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq -2.8 \cdot 10^{-308}:\\ \;\;\;\;\sin^{-1} \left(\frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\ \mathbf{elif}\;\ell \leq 9.5 \cdot 10^{-13}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (if (<= l -5e+136)
   (asin 1.0)
   (if (<= l -2.8e-308)
     (asin (/ (- l) (/ t (sqrt 0.5))))
     (if (<= l 9.5e-13) (asin (/ (* l (sqrt 0.5)) t)) (asin 1.0)))))
double code(double t, double l, double Om, double Omc) {
	double tmp;
	if (l <= -5e+136) {
		tmp = asin(1.0);
	} else if (l <= -2.8e-308) {
		tmp = asin((-l / (t / sqrt(0.5))));
	} else if (l <= 9.5e-13) {
		tmp = asin(((l * sqrt(0.5)) / t));
	} else {
		tmp = asin(1.0);
	}
	return tmp;
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if (l <= (-5d+136)) then
        tmp = asin(1.0d0)
    else if (l <= (-2.8d-308)) then
        tmp = asin((-l / (t / sqrt(0.5d0))))
    else if (l <= 9.5d-13) then
        tmp = asin(((l * sqrt(0.5d0)) / t))
    else
        tmp = asin(1.0d0)
    end if
    code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
	double tmp;
	if (l <= -5e+136) {
		tmp = Math.asin(1.0);
	} else if (l <= -2.8e-308) {
		tmp = Math.asin((-l / (t / Math.sqrt(0.5))));
	} else if (l <= 9.5e-13) {
		tmp = Math.asin(((l * Math.sqrt(0.5)) / t));
	} else {
		tmp = Math.asin(1.0);
	}
	return tmp;
}
def code(t, l, Om, Omc):
	tmp = 0
	if l <= -5e+136:
		tmp = math.asin(1.0)
	elif l <= -2.8e-308:
		tmp = math.asin((-l / (t / math.sqrt(0.5))))
	elif l <= 9.5e-13:
		tmp = math.asin(((l * math.sqrt(0.5)) / t))
	else:
		tmp = math.asin(1.0)
	return tmp
function code(t, l, Om, Omc)
	tmp = 0.0
	if (l <= -5e+136)
		tmp = asin(1.0);
	elseif (l <= -2.8e-308)
		tmp = asin(Float64(Float64(-l) / Float64(t / sqrt(0.5))));
	elseif (l <= 9.5e-13)
		tmp = asin(Float64(Float64(l * sqrt(0.5)) / t));
	else
		tmp = asin(1.0);
	end
	return tmp
end
function tmp_2 = code(t, l, Om, Omc)
	tmp = 0.0;
	if (l <= -5e+136)
		tmp = asin(1.0);
	elseif (l <= -2.8e-308)
		tmp = asin((-l / (t / sqrt(0.5))));
	elseif (l <= 9.5e-13)
		tmp = asin(((l * sqrt(0.5)) / t));
	else
		tmp = asin(1.0);
	end
	tmp_2 = tmp;
end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, -5e+136], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, -2.8e-308], N[ArcSin[N[((-l) / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 9.5e-13], N[ArcSin[N[(N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{+136}:\\
\;\;\;\;\sin^{-1} 1\\

\mathbf{elif}\;\ell \leq -2.8 \cdot 10^{-308}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\

\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{-13}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\

\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -5.0000000000000002e136 or 9.49999999999999991e-13 < l

    1. Initial program 96.8%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 76.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
    4. Step-by-step derivation
      1. unpow276.2%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{{Om}^{2}}{\color{blue}{Omc \cdot Omc}}}\right) \]
      2. unpow276.2%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{\color{blue}{Om \cdot Om}}{Omc \cdot Omc}}\right) \]
      3. times-frac86.0%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}\right) \]
      4. unpow286.0%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{{\left(\frac{Om}{Omc}\right)}^{2}}}\right) \]
    5. Simplified86.0%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}\right)} \]
    6. Taylor expanded in Om around 0 85.3%

      \[\leadsto \sin^{-1} \color{blue}{1} \]

    if -5.0000000000000002e136 < l < -2.79999999999999984e-308

    1. Initial program 74.4%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in Om around 0 50.8%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    4. Taylor expanded in t around -inf 51.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(-1 \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/51.2%

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{-1 \cdot \left(\ell \cdot \sqrt{0.5}\right)}{t}\right)} \]
      2. neg-mul-151.2%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{-\ell \cdot \sqrt{0.5}}}{t}\right) \]
      3. distribute-rgt-neg-in51.2%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\ell \cdot \left(-\sqrt{0.5}\right)}}{t}\right) \]
    6. Simplified51.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \left(-\sqrt{0.5}\right)}{t}\right)} \]
    7. Taylor expanded in l around 0 51.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(-1 \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg51.2%

        \[\leadsto \sin^{-1} \color{blue}{\left(-\frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
      2. associate-/l*51.1%

        \[\leadsto \sin^{-1} \left(-\color{blue}{\frac{\ell}{\frac{t}{\sqrt{0.5}}}}\right) \]
    9. Simplified51.1%

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

    if -2.79999999999999984e-308 < l < 9.49999999999999991e-13

    1. Initial program 73.4%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in Om around 0 57.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    4. Taylor expanded in t around inf 50.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{+136}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq -2.8 \cdot 10^{-308}:\\ \;\;\;\;\sin^{-1} \left(\frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\ \mathbf{elif}\;\ell \leq 9.5 \cdot 10^{-13}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 96.7% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -20:\\ \;\;\;\;\sin^{-1} \left(\frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{-8}:\\ \;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \end{array} \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (if (<= (/ t l) -20.0)
   (asin (/ (- l) (/ t (sqrt 0.5))))
   (if (<= (/ t l) 2e-8)
     (asin (- 1.0 (pow (/ t l) 2.0)))
     (asin (/ l (* t (sqrt 2.0)))))))
double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -20.0) {
		tmp = asin((-l / (t / sqrt(0.5))));
	} else if ((t / l) <= 2e-8) {
		tmp = asin((1.0 - pow((t / l), 2.0)));
	} else {
		tmp = asin((l / (t * sqrt(2.0))));
	}
	return tmp;
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if ((t / l) <= (-20.0d0)) then
        tmp = asin((-l / (t / sqrt(0.5d0))))
    else if ((t / l) <= 2d-8) then
        tmp = asin((1.0d0 - ((t / l) ** 2.0d0)))
    else
        tmp = asin((l / (t * sqrt(2.0d0))))
    end if
    code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -20.0) {
		tmp = Math.asin((-l / (t / Math.sqrt(0.5))));
	} else if ((t / l) <= 2e-8) {
		tmp = Math.asin((1.0 - Math.pow((t / l), 2.0)));
	} else {
		tmp = Math.asin((l / (t * Math.sqrt(2.0))));
	}
	return tmp;
}
def code(t, l, Om, Omc):
	tmp = 0
	if (t / l) <= -20.0:
		tmp = math.asin((-l / (t / math.sqrt(0.5))))
	elif (t / l) <= 2e-8:
		tmp = math.asin((1.0 - math.pow((t / l), 2.0)))
	else:
		tmp = math.asin((l / (t * math.sqrt(2.0))))
	return tmp
function code(t, l, Om, Omc)
	tmp = 0.0
	if (Float64(t / l) <= -20.0)
		tmp = asin(Float64(Float64(-l) / Float64(t / sqrt(0.5))));
	elseif (Float64(t / l) <= 2e-8)
		tmp = asin(Float64(1.0 - (Float64(t / l) ^ 2.0)));
	else
		tmp = asin(Float64(l / Float64(t * sqrt(2.0))));
	end
	return tmp
end
function tmp_2 = code(t, l, Om, Omc)
	tmp = 0.0;
	if ((t / l) <= -20.0)
		tmp = asin((-l / (t / sqrt(0.5))));
	elseif ((t / l) <= 2e-8)
		tmp = asin((1.0 - ((t / l) ^ 2.0)));
	else
		tmp = asin((l / (t * sqrt(2.0))));
	end
	tmp_2 = tmp;
end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -20.0], N[ArcSin[N[((-l) / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 2e-8], N[ArcSin[N[(1.0 - N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -20:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\

\mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 t l) < -20

    1. Initial program 68.9%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in Om around 0 40.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    4. Taylor expanded in t around -inf 97.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(-1 \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/97.7%

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{-1 \cdot \left(\ell \cdot \sqrt{0.5}\right)}{t}\right)} \]
      2. neg-mul-197.7%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{-\ell \cdot \sqrt{0.5}}}{t}\right) \]
      3. distribute-rgt-neg-in97.7%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\ell \cdot \left(-\sqrt{0.5}\right)}}{t}\right) \]
    6. Simplified97.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell \cdot \left(-\sqrt{0.5}\right)}{t}\right)} \]
    7. Taylor expanded in l around 0 97.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(-1 \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg97.7%

        \[\leadsto \sin^{-1} \color{blue}{\left(-\frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
      2. associate-/l*97.6%

        \[\leadsto \sin^{-1} \left(-\color{blue}{\frac{\ell}{\frac{t}{\sqrt{0.5}}}}\right) \]
    9. Simplified97.6%

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

    if -20 < (/.f64 t l) < 2e-8

    1. Initial program 99.2%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in Om around 0 91.5%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    4. Taylor expanded in t around 0 90.0%

      \[\leadsto \sin^{-1} \color{blue}{\left(1 + -1 \cdot \frac{{t}^{2}}{{\ell}^{2}}\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg90.0%

        \[\leadsto \sin^{-1} \left(1 + \color{blue}{\left(-\frac{{t}^{2}}{{\ell}^{2}}\right)}\right) \]
      2. unpow290.0%

        \[\leadsto \sin^{-1} \left(1 + \left(-\frac{\color{blue}{t \cdot t}}{{\ell}^{2}}\right)\right) \]
      3. unpow290.0%

        \[\leadsto \sin^{-1} \left(1 + \left(-\frac{t \cdot t}{\color{blue}{\ell \cdot \ell}}\right)\right) \]
      4. times-frac96.6%

        \[\leadsto \sin^{-1} \left(1 + \left(-\color{blue}{\frac{t}{\ell} \cdot \frac{t}{\ell}}\right)\right) \]
      5. unpow296.6%

        \[\leadsto \sin^{-1} \left(1 + \left(-\color{blue}{{\left(\frac{t}{\ell}\right)}^{2}}\right)\right) \]
      6. unsub-neg96.6%

        \[\leadsto \sin^{-1} \color{blue}{\left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)} \]
    6. Simplified96.6%

      \[\leadsto \sin^{-1} \color{blue}{\left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)} \]

    if 2e-8 < (/.f64 t l)

    1. Initial program 67.7%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sqrt-div67.7%

        \[\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)} \]
      2. div-inv67.7%

        \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\sqrt{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)} \]
      3. add-sqr-sqrt67.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}}}\right) \]
      4. hypot-1-def67.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}\right)}}\right) \]
      5. *-commutative67.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{{\left(\frac{t}{\ell}\right)}^{2} \cdot 2}}\right)}\right) \]
      6. sqrt-prod67.6%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2}}\right)}\right) \]
      7. unpow267.6%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{t}{\ell} \cdot \frac{t}{\ell}}} \cdot \sqrt{2}\right)}\right) \]
      8. sqrt-prod98.6%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{t}{\ell}} \cdot \sqrt{\frac{t}{\ell}}\right)} \cdot \sqrt{2}\right)}\right) \]
      9. add-sqr-sqrt98.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\ell}} \cdot \sqrt{2}\right)}\right) \]
    4. Applied egg-rr98.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/98.7%

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot 1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
      2. *-rgt-identity98.7%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right) \]
      3. associate-*l/98.7%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t \cdot \sqrt{2}}{\ell}}\right)}\right) \]
      4. associate-/l*98.8%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\frac{\ell}{\sqrt{2}}}}\right)}\right) \]
    6. Simplified98.8%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)} \]
    7. Taylor expanded in Om around 0 98.8%

      \[\leadsto \sin^{-1} \left(\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right) \]
    8. Taylor expanded in t around inf 98.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -20:\\ \;\;\;\;\sin^{-1} \left(\frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{-8}:\\ \;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 96.7% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -20:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \left(-\ell\right)}{t}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{-8}:\\ \;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \end{array} \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (if (<= (/ t l) -20.0)
   (asin (/ (* (sqrt 0.5) (- l)) t))
   (if (<= (/ t l) 2e-8)
     (asin (- 1.0 (pow (/ t l) 2.0)))
     (asin (/ l (* t (sqrt 2.0)))))))
double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -20.0) {
		tmp = asin(((sqrt(0.5) * -l) / t));
	} else if ((t / l) <= 2e-8) {
		tmp = asin((1.0 - pow((t / l), 2.0)));
	} else {
		tmp = asin((l / (t * sqrt(2.0))));
	}
	return tmp;
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if ((t / l) <= (-20.0d0)) then
        tmp = asin(((sqrt(0.5d0) * -l) / t))
    else if ((t / l) <= 2d-8) then
        tmp = asin((1.0d0 - ((t / l) ** 2.0d0)))
    else
        tmp = asin((l / (t * sqrt(2.0d0))))
    end if
    code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
	double tmp;
	if ((t / l) <= -20.0) {
		tmp = Math.asin(((Math.sqrt(0.5) * -l) / t));
	} else if ((t / l) <= 2e-8) {
		tmp = Math.asin((1.0 - Math.pow((t / l), 2.0)));
	} else {
		tmp = Math.asin((l / (t * Math.sqrt(2.0))));
	}
	return tmp;
}
def code(t, l, Om, Omc):
	tmp = 0
	if (t / l) <= -20.0:
		tmp = math.asin(((math.sqrt(0.5) * -l) / t))
	elif (t / l) <= 2e-8:
		tmp = math.asin((1.0 - math.pow((t / l), 2.0)))
	else:
		tmp = math.asin((l / (t * math.sqrt(2.0))))
	return tmp
function code(t, l, Om, Omc)
	tmp = 0.0
	if (Float64(t / l) <= -20.0)
		tmp = asin(Float64(Float64(sqrt(0.5) * Float64(-l)) / t));
	elseif (Float64(t / l) <= 2e-8)
		tmp = asin(Float64(1.0 - (Float64(t / l) ^ 2.0)));
	else
		tmp = asin(Float64(l / Float64(t * sqrt(2.0))));
	end
	return tmp
end
function tmp_2 = code(t, l, Om, Omc)
	tmp = 0.0;
	if ((t / l) <= -20.0)
		tmp = asin(((sqrt(0.5) * -l) / t));
	elseif ((t / l) <= 2e-8)
		tmp = asin((1.0 - ((t / l) ^ 2.0)));
	else
		tmp = asin((l / (t * sqrt(2.0))));
	end
	tmp_2 = tmp;
end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -20.0], N[ArcSin[N[(N[(N[Sqrt[0.5], $MachinePrecision] * (-l)), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 2e-8], N[ArcSin[N[(1.0 - N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -20:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \left(-\ell\right)}{t}\right)\\

\mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 t l) < -20

    1. Initial program 68.9%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in Om around 0 40.2%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    4. Taylor expanded in t around -inf 97.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(-1 \cdot \frac{\ell \cdot \sqrt{0.5}}{t}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/97.7%

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{-1 \cdot \left(\ell \cdot \sqrt{0.5}\right)}{t}\right)} \]
      2. neg-mul-197.7%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{-\ell \cdot \sqrt{0.5}}}{t}\right) \]
      3. distribute-rgt-neg-in97.7%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\ell \cdot \left(-\sqrt{0.5}\right)}}{t}\right) \]
    6. Simplified97.7%

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

    if -20 < (/.f64 t l) < 2e-8

    1. Initial program 99.2%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in Om around 0 91.5%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    4. Taylor expanded in t around 0 90.0%

      \[\leadsto \sin^{-1} \color{blue}{\left(1 + -1 \cdot \frac{{t}^{2}}{{\ell}^{2}}\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg90.0%

        \[\leadsto \sin^{-1} \left(1 + \color{blue}{\left(-\frac{{t}^{2}}{{\ell}^{2}}\right)}\right) \]
      2. unpow290.0%

        \[\leadsto \sin^{-1} \left(1 + \left(-\frac{\color{blue}{t \cdot t}}{{\ell}^{2}}\right)\right) \]
      3. unpow290.0%

        \[\leadsto \sin^{-1} \left(1 + \left(-\frac{t \cdot t}{\color{blue}{\ell \cdot \ell}}\right)\right) \]
      4. times-frac96.6%

        \[\leadsto \sin^{-1} \left(1 + \left(-\color{blue}{\frac{t}{\ell} \cdot \frac{t}{\ell}}\right)\right) \]
      5. unpow296.6%

        \[\leadsto \sin^{-1} \left(1 + \left(-\color{blue}{{\left(\frac{t}{\ell}\right)}^{2}}\right)\right) \]
      6. unsub-neg96.6%

        \[\leadsto \sin^{-1} \color{blue}{\left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)} \]
    6. Simplified96.6%

      \[\leadsto \sin^{-1} \color{blue}{\left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)} \]

    if 2e-8 < (/.f64 t l)

    1. Initial program 67.7%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sqrt-div67.7%

        \[\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)} \]
      2. div-inv67.7%

        \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\sqrt{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)} \]
      3. add-sqr-sqrt67.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}}}\right) \]
      4. hypot-1-def67.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}\right)}}\right) \]
      5. *-commutative67.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{{\left(\frac{t}{\ell}\right)}^{2} \cdot 2}}\right)}\right) \]
      6. sqrt-prod67.6%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2}}\right)}\right) \]
      7. unpow267.6%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{t}{\ell} \cdot \frac{t}{\ell}}} \cdot \sqrt{2}\right)}\right) \]
      8. sqrt-prod98.6%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{t}{\ell}} \cdot \sqrt{\frac{t}{\ell}}\right)} \cdot \sqrt{2}\right)}\right) \]
      9. add-sqr-sqrt98.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\ell}} \cdot \sqrt{2}\right)}\right) \]
    4. Applied egg-rr98.7%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/98.7%

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot 1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
      2. *-rgt-identity98.7%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right) \]
      3. associate-*l/98.7%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t \cdot \sqrt{2}}{\ell}}\right)}\right) \]
      4. associate-/l*98.8%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\frac{\ell}{\sqrt{2}}}}\right)}\right) \]
    6. Simplified98.8%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)} \]
    7. Taylor expanded in Om around 0 98.8%

      \[\leadsto \sin^{-1} \left(\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right) \]
    8. Taylor expanded in t around inf 98.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{t}{\ell} \leq -20:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5} \cdot \left(-\ell\right)}{t}\right)\\ \mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{-8}:\\ \;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 61.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.4 \cdot 10^{-186}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq 3.5 \cdot 10^{-9}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (if (<= l -2.4e-186)
   (asin 1.0)
   (if (<= l 3.5e-9) (asin (/ l (* t (sqrt 2.0)))) (asin 1.0))))
double code(double t, double l, double Om, double Omc) {
	double tmp;
	if (l <= -2.4e-186) {
		tmp = asin(1.0);
	} else if (l <= 3.5e-9) {
		tmp = asin((l / (t * sqrt(2.0))));
	} else {
		tmp = asin(1.0);
	}
	return tmp;
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if (l <= (-2.4d-186)) then
        tmp = asin(1.0d0)
    else if (l <= 3.5d-9) then
        tmp = asin((l / (t * sqrt(2.0d0))))
    else
        tmp = asin(1.0d0)
    end if
    code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
	double tmp;
	if (l <= -2.4e-186) {
		tmp = Math.asin(1.0);
	} else if (l <= 3.5e-9) {
		tmp = Math.asin((l / (t * Math.sqrt(2.0))));
	} else {
		tmp = Math.asin(1.0);
	}
	return tmp;
}
def code(t, l, Om, Omc):
	tmp = 0
	if l <= -2.4e-186:
		tmp = math.asin(1.0)
	elif l <= 3.5e-9:
		tmp = math.asin((l / (t * math.sqrt(2.0))))
	else:
		tmp = math.asin(1.0)
	return tmp
function code(t, l, Om, Omc)
	tmp = 0.0
	if (l <= -2.4e-186)
		tmp = asin(1.0);
	elseif (l <= 3.5e-9)
		tmp = asin(Float64(l / Float64(t * sqrt(2.0))));
	else
		tmp = asin(1.0);
	end
	return tmp
end
function tmp_2 = code(t, l, Om, Omc)
	tmp = 0.0;
	if (l <= -2.4e-186)
		tmp = asin(1.0);
	elseif (l <= 3.5e-9)
		tmp = asin((l / (t * sqrt(2.0))));
	else
		tmp = asin(1.0);
	end
	tmp_2 = tmp;
end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, -2.4e-186], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, 3.5e-9], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{-186}:\\
\;\;\;\;\sin^{-1} 1\\

\mathbf{elif}\;\ell \leq 3.5 \cdot 10^{-9}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\

\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -2.40000000000000003e-186 or 3.4999999999999999e-9 < l

    1. Initial program 87.4%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 56.5%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
    4. Step-by-step derivation
      1. unpow256.5%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{{Om}^{2}}{\color{blue}{Omc \cdot Omc}}}\right) \]
      2. unpow256.5%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{\color{blue}{Om \cdot Om}}{Omc \cdot Omc}}\right) \]
      3. times-frac64.9%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}\right) \]
      4. unpow264.9%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{{\left(\frac{Om}{Omc}\right)}^{2}}}\right) \]
    5. Simplified64.9%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}\right)} \]
    6. Taylor expanded in Om around 0 64.1%

      \[\leadsto \sin^{-1} \color{blue}{1} \]

    if -2.40000000000000003e-186 < l < 3.4999999999999999e-9

    1. Initial program 73.9%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sqrt-div73.8%

        \[\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)} \]
      2. div-inv73.8%

        \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\sqrt{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)} \]
      3. add-sqr-sqrt73.8%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\sqrt{1 + \color{blue}{\sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}}}\right) \]
      4. hypot-1-def73.8%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\color{blue}{\mathsf{hypot}\left(1, \sqrt{2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}\right)}}\right) \]
      5. *-commutative73.8%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{{\left(\frac{t}{\ell}\right)}^{2} \cdot 2}}\right)}\right) \]
      6. sqrt-prod73.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\sqrt{{\left(\frac{t}{\ell}\right)}^{2}} \cdot \sqrt{2}}\right)}\right) \]
      7. unpow273.7%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \sqrt{\color{blue}{\frac{t}{\ell} \cdot \frac{t}{\ell}}} \cdot \sqrt{2}\right)}\right) \]
      8. sqrt-prod37.2%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\left(\sqrt{\frac{t}{\ell}} \cdot \sqrt{\frac{t}{\ell}}\right)} \cdot \sqrt{2}\right)}\right) \]
      9. add-sqr-sqrt98.6%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\ell}} \cdot \sqrt{2}\right)}\right) \]
    4. Applied egg-rr98.6%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/98.6%

        \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot 1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)} \]
      2. *-rgt-identity98.6%

        \[\leadsto \sin^{-1} \left(\frac{\color{blue}{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right) \]
      3. associate-*l/98.6%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t \cdot \sqrt{2}}{\ell}}\right)}\right) \]
      4. associate-/l*98.6%

        \[\leadsto \sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \color{blue}{\frac{t}{\frac{\ell}{\sqrt{2}}}}\right)}\right) \]
    6. Simplified98.6%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)} \]
    7. Taylor expanded in Om around 0 98.3%

      \[\leadsto \sin^{-1} \left(\frac{\color{blue}{1}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right) \]
    8. Taylor expanded in t around inf 53.1%

      \[\leadsto \sin^{-1} \color{blue}{\left(\frac{\ell}{t \cdot \sqrt{2}}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.4 \cdot 10^{-186}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq 3.5 \cdot 10^{-9}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 61.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.6 \cdot 10^{-187}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-12}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \end{array} \]
(FPCore (t l Om Omc)
 :precision binary64
 (if (<= l -2.6e-187)
   (asin 1.0)
   (if (<= l 1.3e-12) (asin (/ (* l (sqrt 0.5)) t)) (asin 1.0))))
double code(double t, double l, double Om, double Omc) {
	double tmp;
	if (l <= -2.6e-187) {
		tmp = asin(1.0);
	} else if (l <= 1.3e-12) {
		tmp = asin(((l * sqrt(0.5)) / t));
	} else {
		tmp = asin(1.0);
	}
	return tmp;
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if (l <= (-2.6d-187)) then
        tmp = asin(1.0d0)
    else if (l <= 1.3d-12) then
        tmp = asin(((l * sqrt(0.5d0)) / t))
    else
        tmp = asin(1.0d0)
    end if
    code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
	double tmp;
	if (l <= -2.6e-187) {
		tmp = Math.asin(1.0);
	} else if (l <= 1.3e-12) {
		tmp = Math.asin(((l * Math.sqrt(0.5)) / t));
	} else {
		tmp = Math.asin(1.0);
	}
	return tmp;
}
def code(t, l, Om, Omc):
	tmp = 0
	if l <= -2.6e-187:
		tmp = math.asin(1.0)
	elif l <= 1.3e-12:
		tmp = math.asin(((l * math.sqrt(0.5)) / t))
	else:
		tmp = math.asin(1.0)
	return tmp
function code(t, l, Om, Omc)
	tmp = 0.0
	if (l <= -2.6e-187)
		tmp = asin(1.0);
	elseif (l <= 1.3e-12)
		tmp = asin(Float64(Float64(l * sqrt(0.5)) / t));
	else
		tmp = asin(1.0);
	end
	return tmp
end
function tmp_2 = code(t, l, Om, Omc)
	tmp = 0.0;
	if (l <= -2.6e-187)
		tmp = asin(1.0);
	elseif (l <= 1.3e-12)
		tmp = asin(((l * sqrt(0.5)) / t));
	else
		tmp = asin(1.0);
	end
	tmp_2 = tmp;
end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, -2.6e-187], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, 1.3e-12], N[ArcSin[N[(N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.6 \cdot 10^{-187}:\\
\;\;\;\;\sin^{-1} 1\\

\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-12}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\

\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < -2.5999999999999999e-187 or 1.29999999999999991e-12 < l

    1. Initial program 87.4%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 56.5%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
    4. Step-by-step derivation
      1. unpow256.5%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{{Om}^{2}}{\color{blue}{Omc \cdot Omc}}}\right) \]
      2. unpow256.5%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{\color{blue}{Om \cdot Om}}{Omc \cdot Omc}}\right) \]
      3. times-frac64.9%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}\right) \]
      4. unpow264.9%

        \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{{\left(\frac{Om}{Omc}\right)}^{2}}}\right) \]
    5. Simplified64.9%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}\right)} \]
    6. Taylor expanded in Om around 0 64.1%

      \[\leadsto \sin^{-1} \color{blue}{1} \]

    if -2.5999999999999999e-187 < l < 1.29999999999999991e-12

    1. Initial program 73.9%

      \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in Om around 0 51.9%

      \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{\frac{1}{1 + 2 \cdot \frac{{t}^{2}}{{\ell}^{2}}}}\right)} \]
    4. Taylor expanded in t around inf 53.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.6 \cdot 10^{-187}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-12}:\\ \;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} 1\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 51.2% accurate, 4.1× speedup?

\[\begin{array}{l} \\ \sin^{-1} 1 \end{array} \]
(FPCore (t l Om Omc) :precision binary64 (asin 1.0))
double code(double t, double l, double Om, double Omc) {
	return asin(1.0);
}
real(8) function code(t, l, om, omc)
    real(8), intent (in) :: t
    real(8), intent (in) :: l
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    code = asin(1.0d0)
end function
public static double code(double t, double l, double Om, double Omc) {
	return Math.asin(1.0);
}
def code(t, l, Om, Omc):
	return math.asin(1.0)
function code(t, l, Om, Omc)
	return asin(1.0)
end
function tmp = code(t, l, Om, Omc)
	tmp = asin(1.0);
end
code[t_, l_, Om_, Omc_] := N[ArcSin[1.0], $MachinePrecision]
\begin{array}{l}

\\
\sin^{-1} 1
\end{array}
Derivation
  1. Initial program 82.3%

    \[\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in t around 0 39.9%

    \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - \frac{{Om}^{2}}{{Omc}^{2}}}\right)} \]
  4. Step-by-step derivation
    1. unpow239.9%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{{Om}^{2}}{\color{blue}{Omc \cdot Omc}}}\right) \]
    2. unpow239.9%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - \frac{\color{blue}{Om \cdot Om}}{Omc \cdot Omc}}\right) \]
    3. times-frac46.5%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{\frac{Om}{Omc} \cdot \frac{Om}{Omc}}}\right) \]
    4. unpow246.5%

      \[\leadsto \sin^{-1} \left(\sqrt{1 - \color{blue}{{\left(\frac{Om}{Omc}\right)}^{2}}}\right) \]
  5. Simplified46.5%

    \[\leadsto \sin^{-1} \color{blue}{\left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}\right)} \]
  6. Taylor expanded in Om around 0 46.0%

    \[\leadsto \sin^{-1} \color{blue}{1} \]
  7. Final simplification46.0%

    \[\leadsto \sin^{-1} 1 \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2024031 
(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)))))))