Toniolo and Linder, Equation (2)

Percentage Accurate: 83.3% → 98.8%
Time: 24.2s
Alternatives: 10
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 10 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: 83.3% 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.8% accurate, 1.3× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ l_m = \left|\ell\right| \\ \begin{array}{l} t_1 := \frac{t\_m \cdot \left(-2 \cdot \frac{t\_m}{l\_m}\right)}{l\_m}\\ t_2 := 1 - t\_1\\ t_3 := \frac{\frac{Om}{\frac{Omc}{\frac{Om}{Omc}}}}{-1 + t\_1}\\ t_4 := \frac{1}{t\_2}\\ \mathbf{if}\;\frac{t\_m}{l\_m} \leq 5 \cdot 10^{+14}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{\frac{t\_4}{t\_2} - t\_3 \cdot t\_3}{t\_4 - t\_3}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{l\_m \cdot \sqrt{\frac{\left(1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\right) \cdot 0.5}{t\_m}}}{\sqrt{t\_m}}\right)\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
l_m = (fabs.f64 l)
(FPCore (t_m l_m Om Omc)
 :precision binary64
 (let* ((t_1 (/ (* t_m (* -2.0 (/ t_m l_m))) l_m))
        (t_2 (- 1.0 t_1))
        (t_3 (/ (/ Om (/ Omc (/ Om Omc))) (+ -1.0 t_1)))
        (t_4 (/ 1.0 t_2)))
   (if (<= (/ t_m l_m) 5e+14)
     (asin (sqrt (/ (- (/ t_4 t_2) (* t_3 t_3)) (- t_4 t_3))))
     (asin
      (/
       (* l_m (sqrt (/ (* (- 1.0 (/ (/ Om Omc) (/ Omc Om))) 0.5) t_m)))
       (sqrt t_m))))))
t_m = fabs(t);
l_m = fabs(l);
double code(double t_m, double l_m, double Om, double Omc) {
	double t_1 = (t_m * (-2.0 * (t_m / l_m))) / l_m;
	double t_2 = 1.0 - t_1;
	double t_3 = (Om / (Omc / (Om / Omc))) / (-1.0 + t_1);
	double t_4 = 1.0 / t_2;
	double tmp;
	if ((t_m / l_m) <= 5e+14) {
		tmp = asin(sqrt((((t_4 / t_2) - (t_3 * t_3)) / (t_4 - t_3))));
	} else {
		tmp = asin(((l_m * sqrt((((1.0 - ((Om / Omc) / (Omc / Om))) * 0.5) / t_m))) / sqrt(t_m)));
	}
	return tmp;
}
t_m = abs(t)
l_m = abs(l)
real(8) function code(t_m, l_m, om, omc)
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l_m
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = (t_m * ((-2.0d0) * (t_m / l_m))) / l_m
    t_2 = 1.0d0 - t_1
    t_3 = (om / (omc / (om / omc))) / ((-1.0d0) + t_1)
    t_4 = 1.0d0 / t_2
    if ((t_m / l_m) <= 5d+14) then
        tmp = asin(sqrt((((t_4 / t_2) - (t_3 * t_3)) / (t_4 - t_3))))
    else
        tmp = asin(((l_m * sqrt((((1.0d0 - ((om / omc) / (omc / om))) * 0.5d0) / t_m))) / sqrt(t_m)))
    end if
    code = tmp
end function
t_m = Math.abs(t);
l_m = Math.abs(l);
public static double code(double t_m, double l_m, double Om, double Omc) {
	double t_1 = (t_m * (-2.0 * (t_m / l_m))) / l_m;
	double t_2 = 1.0 - t_1;
	double t_3 = (Om / (Omc / (Om / Omc))) / (-1.0 + t_1);
	double t_4 = 1.0 / t_2;
	double tmp;
	if ((t_m / l_m) <= 5e+14) {
		tmp = Math.asin(Math.sqrt((((t_4 / t_2) - (t_3 * t_3)) / (t_4 - t_3))));
	} else {
		tmp = Math.asin(((l_m * Math.sqrt((((1.0 - ((Om / Omc) / (Omc / Om))) * 0.5) / t_m))) / Math.sqrt(t_m)));
	}
	return tmp;
}
t_m = math.fabs(t)
l_m = math.fabs(l)
def code(t_m, l_m, Om, Omc):
	t_1 = (t_m * (-2.0 * (t_m / l_m))) / l_m
	t_2 = 1.0 - t_1
	t_3 = (Om / (Omc / (Om / Omc))) / (-1.0 + t_1)
	t_4 = 1.0 / t_2
	tmp = 0
	if (t_m / l_m) <= 5e+14:
		tmp = math.asin(math.sqrt((((t_4 / t_2) - (t_3 * t_3)) / (t_4 - t_3))))
	else:
		tmp = math.asin(((l_m * math.sqrt((((1.0 - ((Om / Omc) / (Omc / Om))) * 0.5) / t_m))) / math.sqrt(t_m)))
	return tmp
t_m = abs(t)
l_m = abs(l)
function code(t_m, l_m, Om, Omc)
	t_1 = Float64(Float64(t_m * Float64(-2.0 * Float64(t_m / l_m))) / l_m)
	t_2 = Float64(1.0 - t_1)
	t_3 = Float64(Float64(Om / Float64(Omc / Float64(Om / Omc))) / Float64(-1.0 + t_1))
	t_4 = Float64(1.0 / t_2)
	tmp = 0.0
	if (Float64(t_m / l_m) <= 5e+14)
		tmp = asin(sqrt(Float64(Float64(Float64(t_4 / t_2) - Float64(t_3 * t_3)) / Float64(t_4 - t_3))));
	else
		tmp = asin(Float64(Float64(l_m * sqrt(Float64(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) * 0.5) / t_m))) / sqrt(t_m)));
	end
	return tmp
end
t_m = abs(t);
l_m = abs(l);
function tmp_2 = code(t_m, l_m, Om, Omc)
	t_1 = (t_m * (-2.0 * (t_m / l_m))) / l_m;
	t_2 = 1.0 - t_1;
	t_3 = (Om / (Omc / (Om / Omc))) / (-1.0 + t_1);
	t_4 = 1.0 / t_2;
	tmp = 0.0;
	if ((t_m / l_m) <= 5e+14)
		tmp = asin(sqrt((((t_4 / t_2) - (t_3 * t_3)) / (t_4 - t_3))));
	else
		tmp = asin(((l_m * sqrt((((1.0 - ((Om / Omc) / (Omc / Om))) * 0.5) / t_m))) / sqrt(t_m)));
	end
	tmp_2 = tmp;
end
t_m = N[Abs[t], $MachinePrecision]
l_m = N[Abs[l], $MachinePrecision]
code[t$95$m_, l$95$m_, Om_, Omc_] := Block[{t$95$1 = N[(N[(t$95$m * N[(-2.0 * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(Om / N[(Omc / N[(Om / Omc), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 / t$95$2), $MachinePrecision]}, If[LessEqual[N[(t$95$m / l$95$m), $MachinePrecision], 5e+14], N[ArcSin[N[Sqrt[N[(N[(N[(t$95$4 / t$95$2), $MachinePrecision] - N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision] / N[(t$95$4 - t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l$95$m * N[Sqrt[N[(N[(N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / t$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[t$95$m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
l_m = \left|\ell\right|

\\
\begin{array}{l}
t_1 := \frac{t\_m \cdot \left(-2 \cdot \frac{t\_m}{l\_m}\right)}{l\_m}\\
t_2 := 1 - t\_1\\
t_3 := \frac{\frac{Om}{\frac{Omc}{\frac{Om}{Omc}}}}{-1 + t\_1}\\
t_4 := \frac{1}{t\_2}\\
\mathbf{if}\;\frac{t\_m}{l\_m} \leq 5 \cdot 10^{+14}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{\frac{t\_4}{t\_2} - t\_3 \cdot t\_3}{t\_4 - t\_3}}\right)\\

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


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

    1. Initial program 92.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. Applied egg-rr0

      \[\leadsto expr\]

    if 5e14 < (/.f64 t l)

    1. Initial program 62.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. Taylor expanded in t around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 98.3% accurate, 1.4× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ l_m = \left|\ell\right| \\ \begin{array}{l} t_1 := \frac{t\_m \cdot \left(-2 \cdot \frac{t\_m}{l\_m}\right)}{l\_m}\\ t_2 := 1 - t\_1\\ t_3 := \frac{\frac{Om}{\frac{Omc}{\frac{Om}{Omc}}}}{-1 + t\_1}\\ t_4 := \frac{1}{t\_2}\\ \mathbf{if}\;\frac{t\_m}{l\_m} \leq 2 \cdot 10^{+42}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{\frac{t\_4}{t\_2} - t\_3 \cdot t\_3}{t\_4 - t\_3}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{l\_m}{t\_m}}{\sqrt{2}}\right)\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
l_m = (fabs.f64 l)
(FPCore (t_m l_m Om Omc)
 :precision binary64
 (let* ((t_1 (/ (* t_m (* -2.0 (/ t_m l_m))) l_m))
        (t_2 (- 1.0 t_1))
        (t_3 (/ (/ Om (/ Omc (/ Om Omc))) (+ -1.0 t_1)))
        (t_4 (/ 1.0 t_2)))
   (if (<= (/ t_m l_m) 2e+42)
     (asin (sqrt (/ (- (/ t_4 t_2) (* t_3 t_3)) (- t_4 t_3))))
     (asin (/ (/ l_m t_m) (sqrt 2.0))))))
t_m = fabs(t);
l_m = fabs(l);
double code(double t_m, double l_m, double Om, double Omc) {
	double t_1 = (t_m * (-2.0 * (t_m / l_m))) / l_m;
	double t_2 = 1.0 - t_1;
	double t_3 = (Om / (Omc / (Om / Omc))) / (-1.0 + t_1);
	double t_4 = 1.0 / t_2;
	double tmp;
	if ((t_m / l_m) <= 2e+42) {
		tmp = asin(sqrt((((t_4 / t_2) - (t_3 * t_3)) / (t_4 - t_3))));
	} else {
		tmp = asin(((l_m / t_m) / sqrt(2.0)));
	}
	return tmp;
}
t_m = abs(t)
l_m = abs(l)
real(8) function code(t_m, l_m, om, omc)
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l_m
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_1 = (t_m * ((-2.0d0) * (t_m / l_m))) / l_m
    t_2 = 1.0d0 - t_1
    t_3 = (om / (omc / (om / omc))) / ((-1.0d0) + t_1)
    t_4 = 1.0d0 / t_2
    if ((t_m / l_m) <= 2d+42) then
        tmp = asin(sqrt((((t_4 / t_2) - (t_3 * t_3)) / (t_4 - t_3))))
    else
        tmp = asin(((l_m / t_m) / sqrt(2.0d0)))
    end if
    code = tmp
end function
t_m = Math.abs(t);
l_m = Math.abs(l);
public static double code(double t_m, double l_m, double Om, double Omc) {
	double t_1 = (t_m * (-2.0 * (t_m / l_m))) / l_m;
	double t_2 = 1.0 - t_1;
	double t_3 = (Om / (Omc / (Om / Omc))) / (-1.0 + t_1);
	double t_4 = 1.0 / t_2;
	double tmp;
	if ((t_m / l_m) <= 2e+42) {
		tmp = Math.asin(Math.sqrt((((t_4 / t_2) - (t_3 * t_3)) / (t_4 - t_3))));
	} else {
		tmp = Math.asin(((l_m / t_m) / Math.sqrt(2.0)));
	}
	return tmp;
}
t_m = math.fabs(t)
l_m = math.fabs(l)
def code(t_m, l_m, Om, Omc):
	t_1 = (t_m * (-2.0 * (t_m / l_m))) / l_m
	t_2 = 1.0 - t_1
	t_3 = (Om / (Omc / (Om / Omc))) / (-1.0 + t_1)
	t_4 = 1.0 / t_2
	tmp = 0
	if (t_m / l_m) <= 2e+42:
		tmp = math.asin(math.sqrt((((t_4 / t_2) - (t_3 * t_3)) / (t_4 - t_3))))
	else:
		tmp = math.asin(((l_m / t_m) / math.sqrt(2.0)))
	return tmp
t_m = abs(t)
l_m = abs(l)
function code(t_m, l_m, Om, Omc)
	t_1 = Float64(Float64(t_m * Float64(-2.0 * Float64(t_m / l_m))) / l_m)
	t_2 = Float64(1.0 - t_1)
	t_3 = Float64(Float64(Om / Float64(Omc / Float64(Om / Omc))) / Float64(-1.0 + t_1))
	t_4 = Float64(1.0 / t_2)
	tmp = 0.0
	if (Float64(t_m / l_m) <= 2e+42)
		tmp = asin(sqrt(Float64(Float64(Float64(t_4 / t_2) - Float64(t_3 * t_3)) / Float64(t_4 - t_3))));
	else
		tmp = asin(Float64(Float64(l_m / t_m) / sqrt(2.0)));
	end
	return tmp
end
t_m = abs(t);
l_m = abs(l);
function tmp_2 = code(t_m, l_m, Om, Omc)
	t_1 = (t_m * (-2.0 * (t_m / l_m))) / l_m;
	t_2 = 1.0 - t_1;
	t_3 = (Om / (Omc / (Om / Omc))) / (-1.0 + t_1);
	t_4 = 1.0 / t_2;
	tmp = 0.0;
	if ((t_m / l_m) <= 2e+42)
		tmp = asin(sqrt((((t_4 / t_2) - (t_3 * t_3)) / (t_4 - t_3))));
	else
		tmp = asin(((l_m / t_m) / sqrt(2.0)));
	end
	tmp_2 = tmp;
end
t_m = N[Abs[t], $MachinePrecision]
l_m = N[Abs[l], $MachinePrecision]
code[t$95$m_, l$95$m_, Om_, Omc_] := Block[{t$95$1 = N[(N[(t$95$m * N[(-2.0 * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(Om / N[(Omc / N[(Om / Omc), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 / t$95$2), $MachinePrecision]}, If[LessEqual[N[(t$95$m / l$95$m), $MachinePrecision], 2e+42], N[ArcSin[N[Sqrt[N[(N[(N[(t$95$4 / t$95$2), $MachinePrecision] - N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision] / N[(t$95$4 - t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l$95$m / t$95$m), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
l_m = \left|\ell\right|

\\
\begin{array}{l}
t_1 := \frac{t\_m \cdot \left(-2 \cdot \frac{t\_m}{l\_m}\right)}{l\_m}\\
t_2 := 1 - t\_1\\
t_3 := \frac{\frac{Om}{\frac{Omc}{\frac{Om}{Omc}}}}{-1 + t\_1}\\
t_4 := \frac{1}{t\_2}\\
\mathbf{if}\;\frac{t\_m}{l\_m} \leq 2 \cdot 10^{+42}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{\frac{t\_4}{t\_2} - t\_3 \cdot t\_3}{t\_4 - t\_3}}\right)\\

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


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

    1. Initial program 92.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. Applied egg-rr0

      \[\leadsto expr\]

    if 2.00000000000000009e42 < (/.f64 t l)

    1. Initial program 61.0%

      \[\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 inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]
    7. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 98.3% accurate, 1.8× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;\frac{t\_m}{l\_m} \leq 5 \cdot 10^{+41}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{Om}{\frac{Omc}{\frac{Om}{Omc}}}}{1 - \frac{t\_m \cdot \left(-2 \cdot \frac{t\_m}{l\_m}\right)}{l\_m}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{l\_m}{t\_m}}{\sqrt{2}}\right)\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
l_m = (fabs.f64 l)
(FPCore (t_m l_m Om Omc)
 :precision binary64
 (if (<= (/ t_m l_m) 5e+41)
   (asin
    (sqrt
     (/
      (- 1.0 (/ Om (/ Omc (/ Om Omc))))
      (- 1.0 (/ (* t_m (* -2.0 (/ t_m l_m))) l_m)))))
   (asin (/ (/ l_m t_m) (sqrt 2.0)))))
t_m = fabs(t);
l_m = fabs(l);
double code(double t_m, double l_m, double Om, double Omc) {
	double tmp;
	if ((t_m / l_m) <= 5e+41) {
		tmp = asin(sqrt(((1.0 - (Om / (Omc / (Om / Omc)))) / (1.0 - ((t_m * (-2.0 * (t_m / l_m))) / l_m)))));
	} else {
		tmp = asin(((l_m / t_m) / sqrt(2.0)));
	}
	return tmp;
}
t_m = abs(t)
l_m = abs(l)
real(8) function code(t_m, l_m, om, omc)
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l_m
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if ((t_m / l_m) <= 5d+41) then
        tmp = asin(sqrt(((1.0d0 - (om / (omc / (om / omc)))) / (1.0d0 - ((t_m * ((-2.0d0) * (t_m / l_m))) / l_m)))))
    else
        tmp = asin(((l_m / t_m) / sqrt(2.0d0)))
    end if
    code = tmp
end function
t_m = Math.abs(t);
l_m = Math.abs(l);
public static double code(double t_m, double l_m, double Om, double Omc) {
	double tmp;
	if ((t_m / l_m) <= 5e+41) {
		tmp = Math.asin(Math.sqrt(((1.0 - (Om / (Omc / (Om / Omc)))) / (1.0 - ((t_m * (-2.0 * (t_m / l_m))) / l_m)))));
	} else {
		tmp = Math.asin(((l_m / t_m) / Math.sqrt(2.0)));
	}
	return tmp;
}
t_m = math.fabs(t)
l_m = math.fabs(l)
def code(t_m, l_m, Om, Omc):
	tmp = 0
	if (t_m / l_m) <= 5e+41:
		tmp = math.asin(math.sqrt(((1.0 - (Om / (Omc / (Om / Omc)))) / (1.0 - ((t_m * (-2.0 * (t_m / l_m))) / l_m)))))
	else:
		tmp = math.asin(((l_m / t_m) / math.sqrt(2.0)))
	return tmp
t_m = abs(t)
l_m = abs(l)
function code(t_m, l_m, Om, Omc)
	tmp = 0.0
	if (Float64(t_m / l_m) <= 5e+41)
		tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Om / Float64(Omc / Float64(Om / Omc)))) / Float64(1.0 - Float64(Float64(t_m * Float64(-2.0 * Float64(t_m / l_m))) / l_m)))));
	else
		tmp = asin(Float64(Float64(l_m / t_m) / sqrt(2.0)));
	end
	return tmp
end
t_m = abs(t);
l_m = abs(l);
function tmp_2 = code(t_m, l_m, Om, Omc)
	tmp = 0.0;
	if ((t_m / l_m) <= 5e+41)
		tmp = asin(sqrt(((1.0 - (Om / (Omc / (Om / Omc)))) / (1.0 - ((t_m * (-2.0 * (t_m / l_m))) / l_m)))));
	else
		tmp = asin(((l_m / t_m) / sqrt(2.0)));
	end
	tmp_2 = tmp;
end
t_m = N[Abs[t], $MachinePrecision]
l_m = N[Abs[l], $MachinePrecision]
code[t$95$m_, l$95$m_, Om_, Omc_] := If[LessEqual[N[(t$95$m / l$95$m), $MachinePrecision], 5e+41], N[ArcSin[N[Sqrt[N[(N[(1.0 - N[(Om / N[(Omc / N[(Om / Omc), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[(t$95$m * N[(-2.0 * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l$95$m / t$95$m), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|
\\
l_m = \left|\ell\right|

\\
\begin{array}{l}
\mathbf{if}\;\frac{t\_m}{l\_m} \leq 5 \cdot 10^{+41}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{Om}{\frac{Omc}{\frac{Om}{Omc}}}}{1 - \frac{t\_m \cdot \left(-2 \cdot \frac{t\_m}{l\_m}\right)}{l\_m}}}\right)\\

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


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

    1. Initial program 92.3%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Applied egg-rr0

      \[\leadsto expr\]

    if 5.00000000000000022e41 < (/.f64 t l)

    1. Initial program 61.0%

      \[\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 inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]
    7. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 97.5% accurate, 1.9× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ l_m = \left|\ell\right| \\ \begin{array}{l} t_1 := 1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\\ \mathbf{if}\;\frac{t\_m}{l\_m} \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\sin^{-1} \left({\left(\frac{1}{t\_1}\right)}^{-0.5}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{t\_1 \cdot 0.5}}{t\_m} \cdot l\_m\right)\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
l_m = (fabs.f64 l)
(FPCore (t_m l_m Om Omc)
 :precision binary64
 (let* ((t_1 (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
   (if (<= (/ t_m l_m) 2e-5)
     (asin (pow (/ 1.0 t_1) -0.5))
     (asin (* (/ (sqrt (* t_1 0.5)) t_m) l_m)))))
t_m = fabs(t);
l_m = fabs(l);
double code(double t_m, double l_m, double Om, double Omc) {
	double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
	double tmp;
	if ((t_m / l_m) <= 2e-5) {
		tmp = asin(pow((1.0 / t_1), -0.5));
	} else {
		tmp = asin(((sqrt((t_1 * 0.5)) / t_m) * l_m));
	}
	return tmp;
}
t_m = abs(t)
l_m = abs(l)
real(8) function code(t_m, l_m, om, omc)
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l_m
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: t_1
    real(8) :: tmp
    t_1 = 1.0d0 - ((om / omc) / (omc / om))
    if ((t_m / l_m) <= 2d-5) then
        tmp = asin(((1.0d0 / t_1) ** (-0.5d0)))
    else
        tmp = asin(((sqrt((t_1 * 0.5d0)) / t_m) * l_m))
    end if
    code = tmp
end function
t_m = Math.abs(t);
l_m = Math.abs(l);
public static double code(double t_m, double l_m, double Om, double Omc) {
	double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
	double tmp;
	if ((t_m / l_m) <= 2e-5) {
		tmp = Math.asin(Math.pow((1.0 / t_1), -0.5));
	} else {
		tmp = Math.asin(((Math.sqrt((t_1 * 0.5)) / t_m) * l_m));
	}
	return tmp;
}
t_m = math.fabs(t)
l_m = math.fabs(l)
def code(t_m, l_m, Om, Omc):
	t_1 = 1.0 - ((Om / Omc) / (Omc / Om))
	tmp = 0
	if (t_m / l_m) <= 2e-5:
		tmp = math.asin(math.pow((1.0 / t_1), -0.5))
	else:
		tmp = math.asin(((math.sqrt((t_1 * 0.5)) / t_m) * l_m))
	return tmp
t_m = abs(t)
l_m = abs(l)
function code(t_m, l_m, Om, Omc)
	t_1 = Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om)))
	tmp = 0.0
	if (Float64(t_m / l_m) <= 2e-5)
		tmp = asin((Float64(1.0 / t_1) ^ -0.5));
	else
		tmp = asin(Float64(Float64(sqrt(Float64(t_1 * 0.5)) / t_m) * l_m));
	end
	return tmp
end
t_m = abs(t);
l_m = abs(l);
function tmp_2 = code(t_m, l_m, Om, Omc)
	t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
	tmp = 0.0;
	if ((t_m / l_m) <= 2e-5)
		tmp = asin(((1.0 / t_1) ^ -0.5));
	else
		tmp = asin(((sqrt((t_1 * 0.5)) / t_m) * l_m));
	end
	tmp_2 = tmp;
end
t_m = N[Abs[t], $MachinePrecision]
l_m = N[Abs[l], $MachinePrecision]
code[t$95$m_, l$95$m_, Om_, Omc_] := Block[{t$95$1 = N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$m / l$95$m), $MachinePrecision], 2e-5], N[ArcSin[N[Power[N[(1.0 / t$95$1), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(N[Sqrt[N[(t$95$1 * 0.5), $MachinePrecision]], $MachinePrecision] / t$95$m), $MachinePrecision] * l$95$m), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
l_m = \left|\ell\right|

\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\\
\mathbf{if}\;\frac{t\_m}{l\_m} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\sin^{-1} \left({\left(\frac{1}{t\_1}\right)}^{-0.5}\right)\\

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


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

    1. Initial program 92.1%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]

    if 2.00000000000000016e-5 < (/.f64 t l)

    1. Initial program 64.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 inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 72.4% accurate, 1.9× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;t\_m \leq 1.35 \cdot 10^{-55}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;t\_m \leq 2.85 \cdot 10^{-25}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{0.5} \cdot \frac{l\_m}{t\_m}\right)\\ \mathbf{elif}\;t\_m \leq 35:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{l\_m}{t\_m}}{\sqrt{2}}\right)\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
l_m = (fabs.f64 l)
(FPCore (t_m l_m Om Omc)
 :precision binary64
 (if (<= t_m 1.35e-55)
   (asin 1.0)
   (if (<= t_m 2.85e-25)
     (asin (* (sqrt 0.5) (/ l_m t_m)))
     (if (<= t_m 35.0) (asin 1.0) (asin (/ (/ l_m t_m) (sqrt 2.0)))))))
t_m = fabs(t);
l_m = fabs(l);
double code(double t_m, double l_m, double Om, double Omc) {
	double tmp;
	if (t_m <= 1.35e-55) {
		tmp = asin(1.0);
	} else if (t_m <= 2.85e-25) {
		tmp = asin((sqrt(0.5) * (l_m / t_m)));
	} else if (t_m <= 35.0) {
		tmp = asin(1.0);
	} else {
		tmp = asin(((l_m / t_m) / sqrt(2.0)));
	}
	return tmp;
}
t_m = abs(t)
l_m = abs(l)
real(8) function code(t_m, l_m, om, omc)
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l_m
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if (t_m <= 1.35d-55) then
        tmp = asin(1.0d0)
    else if (t_m <= 2.85d-25) then
        tmp = asin((sqrt(0.5d0) * (l_m / t_m)))
    else if (t_m <= 35.0d0) then
        tmp = asin(1.0d0)
    else
        tmp = asin(((l_m / t_m) / sqrt(2.0d0)))
    end if
    code = tmp
end function
t_m = Math.abs(t);
l_m = Math.abs(l);
public static double code(double t_m, double l_m, double Om, double Omc) {
	double tmp;
	if (t_m <= 1.35e-55) {
		tmp = Math.asin(1.0);
	} else if (t_m <= 2.85e-25) {
		tmp = Math.asin((Math.sqrt(0.5) * (l_m / t_m)));
	} else if (t_m <= 35.0) {
		tmp = Math.asin(1.0);
	} else {
		tmp = Math.asin(((l_m / t_m) / Math.sqrt(2.0)));
	}
	return tmp;
}
t_m = math.fabs(t)
l_m = math.fabs(l)
def code(t_m, l_m, Om, Omc):
	tmp = 0
	if t_m <= 1.35e-55:
		tmp = math.asin(1.0)
	elif t_m <= 2.85e-25:
		tmp = math.asin((math.sqrt(0.5) * (l_m / t_m)))
	elif t_m <= 35.0:
		tmp = math.asin(1.0)
	else:
		tmp = math.asin(((l_m / t_m) / math.sqrt(2.0)))
	return tmp
t_m = abs(t)
l_m = abs(l)
function code(t_m, l_m, Om, Omc)
	tmp = 0.0
	if (t_m <= 1.35e-55)
		tmp = asin(1.0);
	elseif (t_m <= 2.85e-25)
		tmp = asin(Float64(sqrt(0.5) * Float64(l_m / t_m)));
	elseif (t_m <= 35.0)
		tmp = asin(1.0);
	else
		tmp = asin(Float64(Float64(l_m / t_m) / sqrt(2.0)));
	end
	return tmp
end
t_m = abs(t);
l_m = abs(l);
function tmp_2 = code(t_m, l_m, Om, Omc)
	tmp = 0.0;
	if (t_m <= 1.35e-55)
		tmp = asin(1.0);
	elseif (t_m <= 2.85e-25)
		tmp = asin((sqrt(0.5) * (l_m / t_m)));
	elseif (t_m <= 35.0)
		tmp = asin(1.0);
	else
		tmp = asin(((l_m / t_m) / sqrt(2.0)));
	end
	tmp_2 = tmp;
end
t_m = N[Abs[t], $MachinePrecision]
l_m = N[Abs[l], $MachinePrecision]
code[t$95$m_, l$95$m_, Om_, Omc_] := If[LessEqual[t$95$m, 1.35e-55], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[t$95$m, 2.85e-25], N[ArcSin[N[(N[Sqrt[0.5], $MachinePrecision] * N[(l$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$m, 35.0], N[ArcSin[1.0], $MachinePrecision], N[ArcSin[N[(N[(l$95$m / t$95$m), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
l_m = \left|\ell\right|

\\
\begin{array}{l}
\mathbf{if}\;t\_m \leq 1.35 \cdot 10^{-55}:\\
\;\;\;\;\sin^{-1} 1\\

\mathbf{elif}\;t\_m \leq 2.85 \cdot 10^{-25}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{0.5} \cdot \frac{l\_m}{t\_m}\right)\\

\mathbf{elif}\;t\_m \leq 35:\\
\;\;\;\;\sin^{-1} 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 1.35000000000000002e-55 or 2.8500000000000002e-25 < t < 35

    1. Initial program 87.1%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 1.35000000000000002e-55 < t < 2.8500000000000002e-25

    1. Initial program 71.5%

      \[\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 inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]
    7. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 35 < t

    1. Initial program 77.0%

      \[\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 inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]
    7. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 72.5% accurate, 1.9× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-56}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;t\_m \leq 2.85 \cdot 10^{-26}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{0.5} \cdot \frac{l\_m}{t\_m}\right)\\ \mathbf{elif}\;t\_m \leq 13.8:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{t\_m} \cdot l\_m\right)\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
l_m = (fabs.f64 l)
(FPCore (t_m l_m Om Omc)
 :precision binary64
 (if (<= t_m 5.5e-56)
   (asin 1.0)
   (if (<= t_m 2.85e-26)
     (asin (* (sqrt 0.5) (/ l_m t_m)))
     (if (<= t_m 13.8) (asin 1.0) (asin (* (/ (sqrt 0.5) t_m) l_m))))))
t_m = fabs(t);
l_m = fabs(l);
double code(double t_m, double l_m, double Om, double Omc) {
	double tmp;
	if (t_m <= 5.5e-56) {
		tmp = asin(1.0);
	} else if (t_m <= 2.85e-26) {
		tmp = asin((sqrt(0.5) * (l_m / t_m)));
	} else if (t_m <= 13.8) {
		tmp = asin(1.0);
	} else {
		tmp = asin(((sqrt(0.5) / t_m) * l_m));
	}
	return tmp;
}
t_m = abs(t)
l_m = abs(l)
real(8) function code(t_m, l_m, om, omc)
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l_m
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if (t_m <= 5.5d-56) then
        tmp = asin(1.0d0)
    else if (t_m <= 2.85d-26) then
        tmp = asin((sqrt(0.5d0) * (l_m / t_m)))
    else if (t_m <= 13.8d0) then
        tmp = asin(1.0d0)
    else
        tmp = asin(((sqrt(0.5d0) / t_m) * l_m))
    end if
    code = tmp
end function
t_m = Math.abs(t);
l_m = Math.abs(l);
public static double code(double t_m, double l_m, double Om, double Omc) {
	double tmp;
	if (t_m <= 5.5e-56) {
		tmp = Math.asin(1.0);
	} else if (t_m <= 2.85e-26) {
		tmp = Math.asin((Math.sqrt(0.5) * (l_m / t_m)));
	} else if (t_m <= 13.8) {
		tmp = Math.asin(1.0);
	} else {
		tmp = Math.asin(((Math.sqrt(0.5) / t_m) * l_m));
	}
	return tmp;
}
t_m = math.fabs(t)
l_m = math.fabs(l)
def code(t_m, l_m, Om, Omc):
	tmp = 0
	if t_m <= 5.5e-56:
		tmp = math.asin(1.0)
	elif t_m <= 2.85e-26:
		tmp = math.asin((math.sqrt(0.5) * (l_m / t_m)))
	elif t_m <= 13.8:
		tmp = math.asin(1.0)
	else:
		tmp = math.asin(((math.sqrt(0.5) / t_m) * l_m))
	return tmp
t_m = abs(t)
l_m = abs(l)
function code(t_m, l_m, Om, Omc)
	tmp = 0.0
	if (t_m <= 5.5e-56)
		tmp = asin(1.0);
	elseif (t_m <= 2.85e-26)
		tmp = asin(Float64(sqrt(0.5) * Float64(l_m / t_m)));
	elseif (t_m <= 13.8)
		tmp = asin(1.0);
	else
		tmp = asin(Float64(Float64(sqrt(0.5) / t_m) * l_m));
	end
	return tmp
end
t_m = abs(t);
l_m = abs(l);
function tmp_2 = code(t_m, l_m, Om, Omc)
	tmp = 0.0;
	if (t_m <= 5.5e-56)
		tmp = asin(1.0);
	elseif (t_m <= 2.85e-26)
		tmp = asin((sqrt(0.5) * (l_m / t_m)));
	elseif (t_m <= 13.8)
		tmp = asin(1.0);
	else
		tmp = asin(((sqrt(0.5) / t_m) * l_m));
	end
	tmp_2 = tmp;
end
t_m = N[Abs[t], $MachinePrecision]
l_m = N[Abs[l], $MachinePrecision]
code[t$95$m_, l$95$m_, Om_, Omc_] := If[LessEqual[t$95$m, 5.5e-56], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[t$95$m, 2.85e-26], N[ArcSin[N[(N[Sqrt[0.5], $MachinePrecision] * N[(l$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$m, 13.8], N[ArcSin[1.0], $MachinePrecision], N[ArcSin[N[(N[(N[Sqrt[0.5], $MachinePrecision] / t$95$m), $MachinePrecision] * l$95$m), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
l_m = \left|\ell\right|

\\
\begin{array}{l}
\mathbf{if}\;t\_m \leq 5.5 \cdot 10^{-56}:\\
\;\;\;\;\sin^{-1} 1\\

\mathbf{elif}\;t\_m \leq 2.85 \cdot 10^{-26}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{0.5} \cdot \frac{l\_m}{t\_m}\right)\\

\mathbf{elif}\;t\_m \leq 13.8:\\
\;\;\;\;\sin^{-1} 1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 5.4999999999999999e-56 or 2.85e-26 < t < 13.800000000000001

    1. Initial program 87.1%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 5.4999999999999999e-56 < t < 2.85e-26

    1. Initial program 71.5%

      \[\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 inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]
    7. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]

    if 13.800000000000001 < t

    1. Initial program 77.0%

      \[\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 inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 7: 72.6% accurate, 1.9× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ l_m = \left|\ell\right| \\ \begin{array}{l} t_1 := \sin^{-1} \left(\sqrt{0.5} \cdot \frac{l\_m}{t\_m}\right)\\ \mathbf{if}\;t\_m \leq 1.35 \cdot 10^{-55}:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{elif}\;t\_m \leq 1.48 \cdot 10^{-27}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_m \leq 1.7:\\ \;\;\;\;\sin^{-1} 1\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
l_m = (fabs.f64 l)
(FPCore (t_m l_m Om Omc)
 :precision binary64
 (let* ((t_1 (asin (* (sqrt 0.5) (/ l_m t_m)))))
   (if (<= t_m 1.35e-55)
     (asin 1.0)
     (if (<= t_m 1.48e-27) t_1 (if (<= t_m 1.7) (asin 1.0) t_1)))))
t_m = fabs(t);
l_m = fabs(l);
double code(double t_m, double l_m, double Om, double Omc) {
	double t_1 = asin((sqrt(0.5) * (l_m / t_m)));
	double tmp;
	if (t_m <= 1.35e-55) {
		tmp = asin(1.0);
	} else if (t_m <= 1.48e-27) {
		tmp = t_1;
	} else if (t_m <= 1.7) {
		tmp = asin(1.0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
t_m = abs(t)
l_m = abs(l)
real(8) function code(t_m, l_m, om, omc)
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l_m
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: t_1
    real(8) :: tmp
    t_1 = asin((sqrt(0.5d0) * (l_m / t_m)))
    if (t_m <= 1.35d-55) then
        tmp = asin(1.0d0)
    else if (t_m <= 1.48d-27) then
        tmp = t_1
    else if (t_m <= 1.7d0) then
        tmp = asin(1.0d0)
    else
        tmp = t_1
    end if
    code = tmp
end function
t_m = Math.abs(t);
l_m = Math.abs(l);
public static double code(double t_m, double l_m, double Om, double Omc) {
	double t_1 = Math.asin((Math.sqrt(0.5) * (l_m / t_m)));
	double tmp;
	if (t_m <= 1.35e-55) {
		tmp = Math.asin(1.0);
	} else if (t_m <= 1.48e-27) {
		tmp = t_1;
	} else if (t_m <= 1.7) {
		tmp = Math.asin(1.0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
t_m = math.fabs(t)
l_m = math.fabs(l)
def code(t_m, l_m, Om, Omc):
	t_1 = math.asin((math.sqrt(0.5) * (l_m / t_m)))
	tmp = 0
	if t_m <= 1.35e-55:
		tmp = math.asin(1.0)
	elif t_m <= 1.48e-27:
		tmp = t_1
	elif t_m <= 1.7:
		tmp = math.asin(1.0)
	else:
		tmp = t_1
	return tmp
t_m = abs(t)
l_m = abs(l)
function code(t_m, l_m, Om, Omc)
	t_1 = asin(Float64(sqrt(0.5) * Float64(l_m / t_m)))
	tmp = 0.0
	if (t_m <= 1.35e-55)
		tmp = asin(1.0);
	elseif (t_m <= 1.48e-27)
		tmp = t_1;
	elseif (t_m <= 1.7)
		tmp = asin(1.0);
	else
		tmp = t_1;
	end
	return tmp
end
t_m = abs(t);
l_m = abs(l);
function tmp_2 = code(t_m, l_m, Om, Omc)
	t_1 = asin((sqrt(0.5) * (l_m / t_m)));
	tmp = 0.0;
	if (t_m <= 1.35e-55)
		tmp = asin(1.0);
	elseif (t_m <= 1.48e-27)
		tmp = t_1;
	elseif (t_m <= 1.7)
		tmp = asin(1.0);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
t_m = N[Abs[t], $MachinePrecision]
l_m = N[Abs[l], $MachinePrecision]
code[t$95$m_, l$95$m_, Om_, Omc_] := Block[{t$95$1 = N[ArcSin[N[(N[Sqrt[0.5], $MachinePrecision] * N[(l$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$m, 1.35e-55], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[t$95$m, 1.48e-27], t$95$1, If[LessEqual[t$95$m, 1.7], N[ArcSin[1.0], $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
l_m = \left|\ell\right|

\\
\begin{array}{l}
t_1 := \sin^{-1} \left(\sqrt{0.5} \cdot \frac{l\_m}{t\_m}\right)\\
\mathbf{if}\;t\_m \leq 1.35 \cdot 10^{-55}:\\
\;\;\;\;\sin^{-1} 1\\

\mathbf{elif}\;t\_m \leq 1.48 \cdot 10^{-27}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_m \leq 1.7:\\
\;\;\;\;\sin^{-1} 1\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.35000000000000002e-55 or 1.48000000000000008e-27 < t < 1.69999999999999996

    1. Initial program 87.1%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    7. Simplified0

      \[\leadsto expr\]

    if 1.35000000000000002e-55 < t < 1.48000000000000008e-27 or 1.69999999999999996 < t

    1. Initial program 76.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 t around inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]
    7. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 97.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{t\_m}{l\_m} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\sin^{-1} \left({\left(\frac{1}{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)}^{-0.5}\right)\\

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


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

    1. Initial program 92.1%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]

    if 2.00000000000000016e-5 < (/.f64 t l)

    1. Initial program 64.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 inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]
    7. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 97.1% accurate, 1.9× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ l_m = \left|\ell\right| \\ \begin{array}{l} \mathbf{if}\;\frac{t\_m}{l\_m} \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{\frac{Omc}{Om}}}{Omc}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sin^{-1} \left(\frac{\frac{l\_m}{t\_m}}{\sqrt{2}}\right)\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
l_m = (fabs.f64 l)
(FPCore (t_m l_m Om Omc)
 :precision binary64
 (if (<= (/ t_m l_m) 2e-5)
   (asin (sqrt (- 1.0 (/ (/ Om (/ Omc Om)) Omc))))
   (asin (/ (/ l_m t_m) (sqrt 2.0)))))
t_m = fabs(t);
l_m = fabs(l);
double code(double t_m, double l_m, double Om, double Omc) {
	double tmp;
	if ((t_m / l_m) <= 2e-5) {
		tmp = asin(sqrt((1.0 - ((Om / (Omc / Om)) / Omc))));
	} else {
		tmp = asin(((l_m / t_m) / sqrt(2.0)));
	}
	return tmp;
}
t_m = abs(t)
l_m = abs(l)
real(8) function code(t_m, l_m, om, omc)
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l_m
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    real(8) :: tmp
    if ((t_m / l_m) <= 2d-5) then
        tmp = asin(sqrt((1.0d0 - ((om / (omc / om)) / omc))))
    else
        tmp = asin(((l_m / t_m) / sqrt(2.0d0)))
    end if
    code = tmp
end function
t_m = Math.abs(t);
l_m = Math.abs(l);
public static double code(double t_m, double l_m, double Om, double Omc) {
	double tmp;
	if ((t_m / l_m) <= 2e-5) {
		tmp = Math.asin(Math.sqrt((1.0 - ((Om / (Omc / Om)) / Omc))));
	} else {
		tmp = Math.asin(((l_m / t_m) / Math.sqrt(2.0)));
	}
	return tmp;
}
t_m = math.fabs(t)
l_m = math.fabs(l)
def code(t_m, l_m, Om, Omc):
	tmp = 0
	if (t_m / l_m) <= 2e-5:
		tmp = math.asin(math.sqrt((1.0 - ((Om / (Omc / Om)) / Omc))))
	else:
		tmp = math.asin(((l_m / t_m) / math.sqrt(2.0)))
	return tmp
t_m = abs(t)
l_m = abs(l)
function code(t_m, l_m, Om, Omc)
	tmp = 0.0
	if (Float64(t_m / l_m) <= 2e-5)
		tmp = asin(sqrt(Float64(1.0 - Float64(Float64(Om / Float64(Omc / Om)) / Omc))));
	else
		tmp = asin(Float64(Float64(l_m / t_m) / sqrt(2.0)));
	end
	return tmp
end
t_m = abs(t);
l_m = abs(l);
function tmp_2 = code(t_m, l_m, Om, Omc)
	tmp = 0.0;
	if ((t_m / l_m) <= 2e-5)
		tmp = asin(sqrt((1.0 - ((Om / (Omc / Om)) / Omc))));
	else
		tmp = asin(((l_m / t_m) / sqrt(2.0)));
	end
	tmp_2 = tmp;
end
t_m = N[Abs[t], $MachinePrecision]
l_m = N[Abs[l], $MachinePrecision]
code[t$95$m_, l$95$m_, Om_, Omc_] := If[LessEqual[N[(t$95$m / l$95$m), $MachinePrecision], 2e-5], N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / N[(Omc / Om), $MachinePrecision]), $MachinePrecision] / Omc), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l$95$m / t$95$m), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|
\\
l_m = \left|\ell\right|

\\
\begin{array}{l}
\mathbf{if}\;\frac{t\_m}{l\_m} \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{\frac{Omc}{Om}}}{Omc}}\right)\\

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


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

    1. Initial program 92.1%

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

      \[\leadsto expr\]
    3. Add Preprocessing
    4. Taylor expanded in t around 0 0

      \[\leadsto expr\]
    5. Simplified0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]

    if 2.00000000000000016e-5 < (/.f64 t l)

    1. Initial program 64.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 inf 0

      \[\leadsto expr\]
    4. Simplified0

      \[\leadsto expr\]
    5. Applied egg-rr0

      \[\leadsto expr\]
    6. Applied egg-rr0

      \[\leadsto expr\]
    7. Taylor expanded in Om around 0 0

      \[\leadsto expr\]
    8. Simplified0

      \[\leadsto expr\]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 50.0% accurate, 4.1× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ l_m = \left|\ell\right| \\ \sin^{-1} 1 \end{array} \]
t_m = (fabs.f64 t)
l_m = (fabs.f64 l)
(FPCore (t_m l_m Om Omc) :precision binary64 (asin 1.0))
t_m = fabs(t);
l_m = fabs(l);
double code(double t_m, double l_m, double Om, double Omc) {
	return asin(1.0);
}
t_m = abs(t)
l_m = abs(l)
real(8) function code(t_m, l_m, om, omc)
    real(8), intent (in) :: t_m
    real(8), intent (in) :: l_m
    real(8), intent (in) :: om
    real(8), intent (in) :: omc
    code = asin(1.0d0)
end function
t_m = Math.abs(t);
l_m = Math.abs(l);
public static double code(double t_m, double l_m, double Om, double Omc) {
	return Math.asin(1.0);
}
t_m = math.fabs(t)
l_m = math.fabs(l)
def code(t_m, l_m, Om, Omc):
	return math.asin(1.0)
t_m = abs(t)
l_m = abs(l)
function code(t_m, l_m, Om, Omc)
	return asin(1.0)
end
t_m = abs(t);
l_m = abs(l);
function tmp = code(t_m, l_m, Om, Omc)
	tmp = asin(1.0);
end
t_m = N[Abs[t], $MachinePrecision]
l_m = N[Abs[l], $MachinePrecision]
code[t$95$m_, l$95$m_, Om_, Omc_] := N[ArcSin[1.0], $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
l_m = \left|\ell\right|

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

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

    \[\leadsto expr\]
  3. Add Preprocessing
  4. Taylor expanded in t around 0 0

    \[\leadsto expr\]
  5. Simplified0

    \[\leadsto expr\]
  6. Taylor expanded in Om around 0 0

    \[\leadsto expr\]
  7. Simplified0

    \[\leadsto expr\]
  8. Add Preprocessing

Reproduce

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