
(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:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(let* ((t_1 (- 1.0 (pow (/ Om Omc) 2.0))) (t_2 (sqrt t_1)))
(if (<= (/ t_m l) -1e+152)
(asin (* t_2 (* (sqrt 0.5) (/ (- l) t_m))))
(if (<= (/ t_m l) 5e+49)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (* (/ t_m l) (/ t_m l)))))))
(asin (* t_2 (/ l (* t_m (sqrt 2.0)))))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double t_1 = 1.0 - pow((Om / Omc), 2.0);
double t_2 = sqrt(t_1);
double tmp;
if ((t_m / l) <= -1e+152) {
tmp = asin((t_2 * (sqrt(0.5) * (-l / t_m))));
} else if ((t_m / l) <= 5e+49) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} else {
tmp = asin((t_2 * (l / (t_m * sqrt(2.0)))));
}
return tmp;
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 1.0d0 - ((om / omc) ** 2.0d0)
t_2 = sqrt(t_1)
if ((t_m / l) <= (-1d+152)) then
tmp = asin((t_2 * (sqrt(0.5d0) * (-l / t_m))))
else if ((t_m / l) <= 5d+49) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t_m / l) * (t_m / l)))))))
else
tmp = asin((t_2 * (l / (t_m * sqrt(2.0d0)))))
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
double t_1 = 1.0 - Math.pow((Om / Omc), 2.0);
double t_2 = Math.sqrt(t_1);
double tmp;
if ((t_m / l) <= -1e+152) {
tmp = Math.asin((t_2 * (Math.sqrt(0.5) * (-l / t_m))));
} else if ((t_m / l) <= 5e+49) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} else {
tmp = Math.asin((t_2 * (l / (t_m * Math.sqrt(2.0)))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): t_1 = 1.0 - math.pow((Om / Omc), 2.0) t_2 = math.sqrt(t_1) tmp = 0 if (t_m / l) <= -1e+152: tmp = math.asin((t_2 * (math.sqrt(0.5) * (-l / t_m)))) elif (t_m / l) <= 5e+49: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))) else: tmp = math.asin((t_2 * (l / (t_m * math.sqrt(2.0))))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) t_1 = Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) t_2 = sqrt(t_1) tmp = 0.0 if (Float64(t_m / l) <= -1e+152) tmp = asin(Float64(t_2 * Float64(sqrt(0.5) * Float64(Float64(-l) / t_m)))); elseif (Float64(t_m / l) <= 5e+49) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(Float64(t_m / l) * Float64(t_m / l))))))); else tmp = asin(Float64(t_2 * Float64(l / Float64(t_m * sqrt(2.0))))); end return tmp end
t_m = abs(t); function tmp_2 = code(t_m, l, Om, Omc) t_1 = 1.0 - ((Om / Omc) ^ 2.0); t_2 = sqrt(t_1); tmp = 0.0; if ((t_m / l) <= -1e+152) tmp = asin((t_2 * (sqrt(0.5) * (-l / t_m)))); elseif ((t_m / l) <= 5e+49) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))); else tmp = asin((t_2 * (l / (t_m * sqrt(2.0))))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[t$95$m_, l_, Om_, Omc_] := Block[{t$95$1 = N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[t$95$1], $MachinePrecision]}, If[LessEqual[N[(t$95$m / l), $MachinePrecision], -1e+152], N[ArcSin[N[(t$95$2 * N[(N[Sqrt[0.5], $MachinePrecision] * N[((-l) / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t$95$m / l), $MachinePrecision], 5e+49], N[ArcSin[N[Sqrt[N[(t$95$1 / N[(1.0 + N[(2.0 * N[(N[(t$95$m / l), $MachinePrecision] * N[(t$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(t$95$2 * N[(l / N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := 1 - {\left(\frac{Om}{Omc}\right)}^{2}\\
t_2 := \sqrt{t\_1}\\
\mathbf{if}\;\frac{t\_m}{\ell} \leq -1 \cdot 10^{+152}:\\
\;\;\;\;\sin^{-1} \left(t\_2 \cdot \left(\sqrt{0.5} \cdot \frac{-\ell}{t\_m}\right)\right)\\
\mathbf{elif}\;\frac{t\_m}{\ell} \leq 5 \cdot 10^{+49}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t\_1}{1 + 2 \cdot \left(\frac{t\_m}{\ell} \cdot \frac{t\_m}{\ell}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(t\_2 \cdot \frac{\ell}{t\_m \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1e152Initial program 45.4%
Taylor expanded in t around -inf 80.2%
mul-1-neg80.2%
*-commutative80.2%
distribute-rgt-neg-in80.2%
unpow280.2%
unpow280.2%
times-frac99.6%
unpow299.6%
associate-/l*99.5%
associate-/r/99.6%
Simplified99.6%
if -1e152 < (/.f64 t l) < 5.0000000000000004e49Initial program 98.4%
unpow298.4%
Applied egg-rr98.4%
if 5.0000000000000004e49 < (/.f64 t l) Initial program 68.0%
sqrt-div68.0%
div-inv68.0%
add-sqr-sqrt68.0%
hypot-1-def68.0%
*-commutative68.0%
sqrt-prod68.0%
unpow268.0%
sqrt-prod99.1%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
Taylor expanded in t around inf 95.3%
*-commutative95.3%
unpow295.3%
unpow295.3%
times-frac99.6%
unpow299.6%
Simplified99.6%
Final simplification98.8%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(let* ((t_1 (- 1.0 (pow (/ Om Omc) 2.0))))
(if (<= (/ t_m l) 5e+49)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (* (/ t_m l) (/ t_m l)))))))
(asin (* (sqrt t_1) (/ l (* t_m (sqrt 2.0))))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double t_1 = 1.0 - pow((Om / Omc), 2.0);
double tmp;
if ((t_m / l) <= 5e+49) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} else {
tmp = asin((sqrt(t_1) * (l / (t_m * sqrt(2.0)))));
}
return tmp;
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: t_1
real(8) :: tmp
t_1 = 1.0d0 - ((om / omc) ** 2.0d0)
if ((t_m / l) <= 5d+49) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t_m / l) * (t_m / l)))))))
else
tmp = asin((sqrt(t_1) * (l / (t_m * sqrt(2.0d0)))))
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
double t_1 = 1.0 - Math.pow((Om / Omc), 2.0);
double tmp;
if ((t_m / l) <= 5e+49) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} else {
tmp = Math.asin((Math.sqrt(t_1) * (l / (t_m * Math.sqrt(2.0)))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): t_1 = 1.0 - math.pow((Om / Omc), 2.0) tmp = 0 if (t_m / l) <= 5e+49: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))) else: tmp = math.asin((math.sqrt(t_1) * (l / (t_m * math.sqrt(2.0))))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) t_1 = Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) tmp = 0.0 if (Float64(t_m / l) <= 5e+49) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(Float64(t_m / l) * Float64(t_m / l))))))); else tmp = asin(Float64(sqrt(t_1) * Float64(l / Float64(t_m * sqrt(2.0))))); end return tmp end
t_m = abs(t); function tmp_2 = code(t_m, l, Om, Omc) t_1 = 1.0 - ((Om / Omc) ^ 2.0); tmp = 0.0; if ((t_m / l) <= 5e+49) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))); else tmp = asin((sqrt(t_1) * (l / (t_m * sqrt(2.0))))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[t$95$m_, l_, Om_, Omc_] := Block[{t$95$1 = N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$m / l), $MachinePrecision], 5e+49], N[ArcSin[N[Sqrt[N[(t$95$1 / N[(1.0 + N[(2.0 * N[(N[(t$95$m / l), $MachinePrecision] * N[(t$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[(l / N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := 1 - {\left(\frac{Om}{Omc}\right)}^{2}\\
\mathbf{if}\;\frac{t\_m}{\ell} \leq 5 \cdot 10^{+49}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t\_1}{1 + 2 \cdot \left(\frac{t\_m}{\ell} \cdot \frac{t\_m}{\ell}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{t\_1} \cdot \frac{\ell}{t\_m \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 5.0000000000000004e49Initial program 88.0%
unpow288.0%
Applied egg-rr88.0%
if 5.0000000000000004e49 < (/.f64 t l) Initial program 68.0%
sqrt-div68.0%
div-inv68.0%
add-sqr-sqrt68.0%
hypot-1-def68.0%
*-commutative68.0%
sqrt-prod68.0%
unpow268.0%
sqrt-prod99.1%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
Taylor expanded in t around inf 95.3%
*-commutative95.3%
unpow295.3%
unpow295.3%
times-frac99.6%
unpow299.6%
Simplified99.6%
Final simplification90.2%
t_m = (fabs.f64 t) (FPCore (t_m l Om Omc) :precision binary64 (asin (/ (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))) (hypot 1.0 (* (/ t_m l) (sqrt 2.0))))))
t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
return asin((sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / hypot(1.0, ((t_m / l) * sqrt(2.0)))));
}
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
return Math.asin((Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / Math.hypot(1.0, ((t_m / l) * Math.sqrt(2.0)))));
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): return math.asin((math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / math.hypot(1.0, ((t_m / l) * math.sqrt(2.0)))))
t_m = abs(t) function code(t_m, l, Om, Omc) return asin(Float64(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om)))) / hypot(1.0, Float64(Float64(t_m / l) * sqrt(2.0))))) end
t_m = abs(t); function tmp = code(t_m, l, Om, Omc) tmp = asin((sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / hypot(1.0, ((t_m / l) * sqrt(2.0))))); end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := N[ArcSin[N[(N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(N[(t$95$m / l), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sin^{-1} \left(\frac{\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}{\mathsf{hypot}\left(1, \frac{t\_m}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Initial program 84.4%
sqrt-div84.3%
div-inv84.3%
add-sqr-sqrt84.3%
hypot-1-def84.3%
*-commutative84.3%
sqrt-prod84.3%
unpow284.3%
sqrt-prod51.6%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
associate-*r/98.4%
*-rgt-identity98.4%
Simplified98.4%
unpow253.7%
clear-num53.7%
un-div-inv53.7%
Applied egg-rr98.4%
Final simplification98.4%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(if (<= (/ t_m l) 2e+127)
(asin
(sqrt
(/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (* 2.0 (* (/ t_m l) (/ t_m l)))))))
(asin
(* (/ (* l (sqrt 0.5)) t_m) (sqrt (- 1.0 (* (/ Om Omc) (/ Om Omc))))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double tmp;
if ((t_m / l) <= 2e+127) {
tmp = asin(sqrt(((1.0 - pow((Om / Omc), 2.0)) / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} else {
tmp = asin((((l * sqrt(0.5)) / t_m) * sqrt((1.0 - ((Om / Omc) * (Om / Omc))))));
}
return tmp;
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: tmp
if ((t_m / l) <= 2d+127) then
tmp = asin(sqrt(((1.0d0 - ((om / omc) ** 2.0d0)) / (1.0d0 + (2.0d0 * ((t_m / l) * (t_m / l)))))))
else
tmp = asin((((l * sqrt(0.5d0)) / t_m) * sqrt((1.0d0 - ((om / omc) * (om / omc))))))
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
double tmp;
if ((t_m / l) <= 2e+127) {
tmp = Math.asin(Math.sqrt(((1.0 - Math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} else {
tmp = Math.asin((((l * Math.sqrt(0.5)) / t_m) * Math.sqrt((1.0 - ((Om / Omc) * (Om / Omc))))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): tmp = 0 if (t_m / l) <= 2e+127: tmp = math.asin(math.sqrt(((1.0 - math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))) else: tmp = math.asin((((l * math.sqrt(0.5)) / t_m) * math.sqrt((1.0 - ((Om / Omc) * (Om / Omc)))))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) tmp = 0.0 if (Float64(t_m / l) <= 2e+127) tmp = asin(sqrt(Float64(Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) / Float64(1.0 + Float64(2.0 * Float64(Float64(t_m / l) * Float64(t_m / l))))))); else tmp = asin(Float64(Float64(Float64(l * sqrt(0.5)) / t_m) * sqrt(Float64(1.0 - Float64(Float64(Om / Omc) * Float64(Om / Omc)))))); end return tmp end
t_m = abs(t); function tmp_2 = code(t_m, l, Om, Omc) tmp = 0.0; if ((t_m / l) <= 2e+127) tmp = asin(sqrt(((1.0 - ((Om / Omc) ^ 2.0)) / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))); else tmp = asin((((l * sqrt(0.5)) / t_m) * sqrt((1.0 - ((Om / Omc) * (Om / Omc)))))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := If[LessEqual[N[(t$95$m / l), $MachinePrecision], 2e+127], 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[(N[(t$95$m / l), $MachinePrecision] * N[(t$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t$95$m), $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] * N[(Om / Omc), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{t\_m}{\ell} \leq 2 \cdot 10^{+127}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot \left(\frac{t\_m}{\ell} \cdot \frac{t\_m}{\ell}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t\_m} \cdot \sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 1.99999999999999991e127Initial program 88.7%
unpow288.7%
Applied egg-rr88.7%
if 1.99999999999999991e127 < (/.f64 t l) Initial program 57.2%
Taylor expanded in t around inf 93.8%
unpow293.8%
unpow293.8%
frac-times99.6%
Applied egg-rr99.6%
Final simplification90.1%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(let* ((t_1 (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(if (<= t_m 1.3e+160)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (* (* t_m (/ t_m l)) (/ 1.0 l)))))))
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (/ t_m (* l (/ l t_m)))))))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
double tmp;
if (t_m <= 1.3e+160) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m * (t_m / l)) * (1.0 / l)))))));
} else {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * (t_m / (l * (l / t_m))))))));
}
return tmp;
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
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 <= 1.3d+160) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t_m * (t_m / l)) * (1.0d0 / l)))))))
else
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * (t_m / (l * (l / t_m))))))))
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
double tmp;
if (t_m <= 1.3e+160) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t_m * (t_m / l)) * (1.0 / l)))))));
} else {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * (t_m / (l * (l / t_m))))))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): t_1 = 1.0 - ((Om / Omc) / (Omc / Om)) tmp = 0 if t_m <= 1.3e+160: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t_m * (t_m / l)) * (1.0 / l))))))) else: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * (t_m / (l * (l / t_m)))))))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) t_1 = Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) tmp = 0.0 if (t_m <= 1.3e+160) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(Float64(t_m * Float64(t_m / l)) * Float64(1.0 / l))))))); else tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(t_m / Float64(l * Float64(l / t_m)))))))); end return tmp end
t_m = abs(t); function tmp_2 = code(t_m, l, Om, Omc) t_1 = 1.0 - ((Om / Omc) / (Omc / Om)); tmp = 0.0; if (t_m <= 1.3e+160) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m * (t_m / l)) * (1.0 / l))))))); else tmp = asin(sqrt((t_1 / (1.0 + (2.0 * (t_m / (l * (l / t_m)))))))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[t$95$m_, l_, Om_, Omc_] := Block[{t$95$1 = N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$m, 1.3e+160], N[ArcSin[N[Sqrt[N[(t$95$1 / N[(1.0 + N[(2.0 * N[(N[(t$95$m * N[(t$95$m / l), $MachinePrecision]), $MachinePrecision] * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[Sqrt[N[(t$95$1 / N[(1.0 + N[(2.0 * N[(t$95$m / N[(l * N[(l / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\\
\mathbf{if}\;t\_m \leq 1.3 \cdot 10^{+160}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t\_1}{1 + 2 \cdot \left(\left(t\_m \cdot \frac{t\_m}{\ell}\right) \cdot \frac{1}{\ell}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t\_1}{1 + 2 \cdot \frac{t\_m}{\ell \cdot \frac{\ell}{t\_m}}}}\right)\\
\end{array}
\end{array}
if t < 1.3e160Initial program 85.4%
unpow285.4%
div-inv85.4%
associate-*r*84.1%
Applied egg-rr84.1%
unpow257.9%
clear-num57.9%
un-div-inv57.9%
Applied egg-rr84.1%
if 1.3e160 < t Initial program 73.7%
unpow273.7%
div-inv73.7%
associate-*r*61.3%
Applied egg-rr61.3%
unpow211.3%
clear-num11.3%
un-div-inv11.3%
Applied egg-rr61.3%
associate-*l*73.7%
div-inv73.7%
clear-num73.8%
frac-times73.7%
*-un-lft-identity73.7%
Applied egg-rr73.7%
Final simplification83.2%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ 1.0 (* (/ l t_m) (/ l t_m)))))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
return asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))));
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
code = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * (1.0d0 / ((l / t_m) * (l / t_m))))))))
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
return Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))));
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): return math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))))
t_m = abs(t) function code(t_m, l, Om, Omc) return asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(1.0 / Float64(Float64(l / t_m) * Float64(l / t_m)))))))) end
t_m = abs(t); function tmp = code(t_m, l, Om, Omc) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m)))))))); end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[(1.0 / N[(N[(l / t$95$m), $MachinePrecision] * N[(l / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{1}{\frac{\ell}{t\_m} \cdot \frac{\ell}{t\_m}}}}\right)
\end{array}
Initial program 84.4%
unpow284.4%
clear-num84.4%
clear-num84.3%
frac-times84.3%
metadata-eval84.3%
Applied egg-rr84.3%
unpow253.7%
clear-num53.7%
un-div-inv53.7%
Applied egg-rr84.3%
Final simplification84.3%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ t_m (* l (/ l t_m)))))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
return asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t_m / (l * (l / t_m))))))));
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
code = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * (t_m / (l * (l / t_m))))))))
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
return Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t_m / (l * (l / t_m))))))));
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): return math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t_m / (l * (l / t_m))))))))
t_m = abs(t) function code(t_m, l, Om, Omc) return asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(t_m / Float64(l * Float64(l / t_m)))))))) end
t_m = abs(t); function tmp = code(t_m, l, Om, Omc) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t_m / (l * (l / t_m)))))))); end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[(t$95$m / N[(l * N[(l / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{t\_m}{\ell \cdot \frac{\ell}{t\_m}}}}\right)
\end{array}
Initial program 84.4%
unpow284.4%
div-inv84.4%
associate-*r*82.1%
Applied egg-rr82.1%
unpow253.7%
clear-num53.7%
un-div-inv53.7%
Applied egg-rr82.1%
associate-*l*84.4%
div-inv84.4%
clear-num84.4%
frac-times81.3%
*-un-lft-identity81.3%
Applied egg-rr81.3%
Final simplification81.3%
t_m = (fabs.f64 t) (FPCore (t_m l Om Omc) :precision binary64 (asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om))))))
t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
return asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
code = asin(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
return Math.asin(Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): return math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))))
t_m = abs(t) function code(t_m, l, Om, Omc) return asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))) end
t_m = abs(t); function tmp = code(t_m, l, Om, Omc) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)
\end{array}
Initial program 84.4%
Taylor expanded in t around 0 46.9%
unpow246.9%
unpow246.9%
times-frac53.7%
unpow253.7%
Simplified53.7%
unpow253.7%
clear-num53.7%
un-div-inv53.7%
Applied egg-rr53.7%
Final simplification53.7%
herbie shell --seed 2024027
(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)))))))