
(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 7 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}
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (- 1.0 (pow (/ Om Omc) 2.0))))
(if (<= (/ t_1 (+ 1.0 (* 2.0 (pow (/ t l) 2.0)))) 1e-272)
(fabs (asin (* (/ l t) (sqrt (* t_1 0.5)))))
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ (/ t l) (/ l t))))))))))
double code(double t, double l, double Om, double Omc) {
double t_1 = 1.0 - pow((Om / Omc), 2.0);
double tmp;
if ((t_1 / (1.0 + (2.0 * pow((t / l), 2.0)))) <= 1e-272) {
tmp = fabs(asin(((l / t) * sqrt((t_1 * 0.5)))));
} else {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / 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) :: t_1
real(8) :: tmp
t_1 = 1.0d0 - ((om / omc) ** 2.0d0)
if ((t_1 / (1.0d0 + (2.0d0 * ((t / l) ** 2.0d0)))) <= 1d-272) then
tmp = abs(asin(((l / t) * sqrt((t_1 * 0.5d0)))))
else
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double t_1 = 1.0 - Math.pow((Om / Omc), 2.0);
double tmp;
if ((t_1 / (1.0 + (2.0 * Math.pow((t / l), 2.0)))) <= 1e-272) {
tmp = Math.abs(Math.asin(((l / t) * Math.sqrt((t_1 * 0.5)))));
} else {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = 1.0 - math.pow((Om / Omc), 2.0) tmp = 0 if (t_1 / (1.0 + (2.0 * math.pow((t / l), 2.0)))) <= 1e-272: tmp = math.fabs(math.asin(((l / t) * math.sqrt((t_1 * 0.5))))) else: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))) return tmp
function code(t, l, Om, Omc) t_1 = Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) tmp = 0.0 if (Float64(t_1 / Float64(1.0 + Float64(2.0 * (Float64(t / l) ^ 2.0)))) <= 1e-272) tmp = abs(asin(Float64(Float64(l / t) * sqrt(Float64(t_1 * 0.5))))); else tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) / Float64(l / t))))))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = 1.0 - ((Om / Omc) ^ 2.0); tmp = 0.0; if ((t_1 / (1.0 + (2.0 * ((t / l) ^ 2.0)))) <= 1e-272) tmp = abs(asin(((l / t) * sqrt((t_1 * 0.5))))); else tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))); end tmp_2 = tmp; end
code[t_, 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$1 / N[(1.0 + N[(2.0 * N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-272], N[Abs[N[ArcSin[N[(N[(l / t), $MachinePrecision] * N[Sqrt[N[(t$95$1 * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 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[(N[(t / l), $MachinePrecision] / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - {\left(\frac{Om}{Omc}\right)}^{2}\\
\mathbf{if}\;\frac{t_1}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}} \leq 10^{-272}:\\
\;\;\;\;\left|\sin^{-1} \left(\frac{\ell}{t} \cdot \sqrt{t_1 \cdot 0.5}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{\frac{t}{\ell}}{\frac{\ell}{t}}}}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 1 (pow.f64 (/.f64 Om Omc) 2)) (+.f64 1 (*.f64 2 (pow.f64 (/.f64 t l) 2)))) < 9.9999999999999993e-273Initial program 56.3%
Taylor expanded in t around inf 64.7%
*-commutative64.7%
unpow264.7%
unpow264.7%
times-frac74.2%
unpow274.2%
*-commutative74.2%
associate-/l*74.2%
Simplified74.2%
add-sqr-sqrt72.9%
sqrt-unprod57.0%
pow257.0%
associate-*r/57.0%
div-inv57.0%
sqrt-unprod57.0%
clear-num57.1%
Applied egg-rr57.1%
unpow257.1%
rem-sqrt-square99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
if 9.9999999999999993e-273 < (/.f64 (-.f64 1 (pow.f64 (/.f64 Om Omc) 2)) (+.f64 1 (*.f64 2 (pow.f64 (/.f64 t l) 2)))) Initial program 98.8%
unpow298.8%
clear-num98.8%
un-div-inv98.8%
Applied egg-rr98.8%
unpow298.8%
clear-num98.8%
un-div-inv98.8%
Applied egg-rr98.8%
Final simplification99.1%
(FPCore (t l Om Omc) :precision binary64 (asin (/ (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))) (hypot 1.0 (* (/ t l) (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
return asin((sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / 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 - ((Om / Omc) / (Omc / Om)))) / Math.hypot(1.0, ((t / l) * Math.sqrt(2.0)))));
}
def code(t, l, Om, Omc): return math.asin((math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / math.hypot(1.0, ((t / l) * math.sqrt(2.0)))))
function code(t, l, Om, Omc) return asin(Float64(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om)))) / hypot(1.0, Float64(Float64(t / l) * sqrt(2.0))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / hypot(1.0, ((t / l) * sqrt(2.0))))); end
code[t_, 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 / l), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Initial program 86.4%
sqrt-div86.3%
div-inv86.3%
add-sqr-sqrt86.3%
hypot-1-def86.4%
*-commutative86.4%
sqrt-prod86.3%
unpow286.3%
sqrt-prod58.5%
add-sqr-sqrt99.0%
Applied egg-rr99.0%
associate-*r/99.0%
*-rgt-identity99.0%
Simplified99.0%
unpow286.4%
clear-num86.4%
un-div-inv86.4%
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(if (<= (/ t l) -5e+157)
(asin (* (sqrt t_1) (/ (- l) (/ t (sqrt 0.5)))))
(if (<= (/ t l) 1e+134)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (/ (/ t l) (/ l t)))))))
(asin (* (/ l t) (sqrt (* (- 1.0 (pow (/ Om Omc) 2.0)) 0.5))))))))
double code(double t, double l, double Om, double Omc) {
double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
double tmp;
if ((t / l) <= -5e+157) {
tmp = asin((sqrt(t_1) * (-l / (t / sqrt(0.5)))));
} else if ((t / l) <= 1e+134) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = asin(((l / t) * sqrt(((1.0 - pow((Om / Omc), 2.0)) * 0.5))));
}
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) :: t_1
real(8) :: tmp
t_1 = 1.0d0 - ((om / omc) / (omc / om))
if ((t / l) <= (-5d+157)) then
tmp = asin((sqrt(t_1) * (-l / (t / sqrt(0.5d0)))))
else if ((t / l) <= 1d+134) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
else
tmp = asin(((l / t) * sqrt(((1.0d0 - ((om / omc) ** 2.0d0)) * 0.5d0))))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
double tmp;
if ((t / l) <= -5e+157) {
tmp = Math.asin((Math.sqrt(t_1) * (-l / (t / Math.sqrt(0.5)))));
} else if ((t / l) <= 1e+134) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = Math.asin(((l / t) * Math.sqrt(((1.0 - Math.pow((Om / Omc), 2.0)) * 0.5))));
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = 1.0 - ((Om / Omc) / (Omc / Om)) tmp = 0 if (t / l) <= -5e+157: tmp = math.asin((math.sqrt(t_1) * (-l / (t / math.sqrt(0.5))))) elif (t / l) <= 1e+134: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t))))))) else: tmp = math.asin(((l / t) * math.sqrt(((1.0 - math.pow((Om / Omc), 2.0)) * 0.5)))) return tmp
function code(t, l, Om, Omc) t_1 = Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) tmp = 0.0 if (Float64(t / l) <= -5e+157) tmp = asin(Float64(sqrt(t_1) * Float64(Float64(-l) / Float64(t / sqrt(0.5))))); elseif (Float64(t / l) <= 1e+134) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) / Float64(l / t))))))); else tmp = asin(Float64(Float64(l / t) * sqrt(Float64(Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) * 0.5)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = 1.0 - ((Om / Omc) / (Omc / Om)); tmp = 0.0; if ((t / l) <= -5e+157) tmp = asin((sqrt(t_1) * (-l / (t / sqrt(0.5))))); elseif ((t / l) <= 1e+134) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t))))))); else tmp = asin(((l / t) * sqrt(((1.0 - ((Om / Omc) ^ 2.0)) * 0.5)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t / l), $MachinePrecision], -5e+157], N[ArcSin[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[((-l) / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 1e+134], N[ArcSin[N[Sqrt[N[(t$95$1 / N[(1.0 + N[(2.0 * N[(N[(t / l), $MachinePrecision] / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l / t), $MachinePrecision] * N[Sqrt[N[(N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\\
\mathbf{if}\;\frac{t}{\ell} \leq -5 \cdot 10^{+157}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{t_1} \cdot \frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 10^{+134}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t_1}{1 + 2 \cdot \frac{\frac{t}{\ell}}{\frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t} \cdot \sqrt{\left(1 - {\left(\frac{Om}{Omc}\right)}^{2}\right) \cdot 0.5}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -4.99999999999999976e157Initial program 57.2%
Taylor expanded in t around -inf 87.6%
associate-*r*87.6%
*-commutative87.6%
unpow287.6%
unpow287.6%
times-frac99.7%
unpow299.7%
associate-/l*99.5%
associate-*r/99.5%
neg-mul-199.5%
Simplified99.5%
unpow257.2%
clear-num57.2%
un-div-inv57.2%
Applied egg-rr99.5%
if -4.99999999999999976e157 < (/.f64 t l) < 9.99999999999999921e133Initial program 98.8%
unpow298.8%
clear-num98.8%
un-div-inv98.9%
Applied egg-rr98.9%
unpow298.9%
clear-num98.9%
un-div-inv98.9%
Applied egg-rr98.9%
if 9.99999999999999921e133 < (/.f64 t l) Initial program 49.7%
Taylor expanded in t around inf 86.2%
*-commutative86.2%
unpow286.2%
unpow286.2%
times-frac99.7%
unpow299.7%
*-commutative99.7%
associate-/l*99.5%
Simplified99.5%
expm1-log1p-u99.5%
expm1-udef42.0%
associate-*r/42.0%
div-inv42.0%
sqrt-unprod42.0%
clear-num42.0%
Applied egg-rr42.0%
expm1-def99.7%
expm1-log1p99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.1%
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) 1e+134)
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ (/ t l) (/ l t)))))))
(asin (* (/ l t) (sqrt (* (- 1.0 (pow (/ Om Omc) 2.0)) 0.5))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 1e+134) {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = asin(((l / t) * sqrt(((1.0 - pow((Om / Omc), 2.0)) * 0.5))));
}
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) <= 1d+134) then
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
else
tmp = asin(((l / t) * sqrt(((1.0d0 - ((om / omc) ** 2.0d0)) * 0.5d0))))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 1e+134) {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = Math.asin(((l / t) * Math.sqrt(((1.0 - Math.pow((Om / Omc), 2.0)) * 0.5))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 1e+134: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))) else: tmp = math.asin(((l / t) * math.sqrt(((1.0 - math.pow((Om / Omc), 2.0)) * 0.5)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= 1e+134) tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) / Float64(l / t))))))); else tmp = asin(Float64(Float64(l / t) * sqrt(Float64(Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) * 0.5)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= 1e+134) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))); else tmp = asin(((l / t) * sqrt(((1.0 - ((Om / Omc) ^ 2.0)) * 0.5)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], 1e+134], 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[(N[(t / l), $MachinePrecision] / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l / t), $MachinePrecision] * N[Sqrt[N[(N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 10^{+134}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{\frac{t}{\ell}}{\frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t} \cdot \sqrt{\left(1 - {\left(\frac{Om}{Omc}\right)}^{2}\right) \cdot 0.5}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 9.99999999999999921e133Initial program 92.6%
unpow292.6%
clear-num92.6%
un-div-inv92.6%
Applied egg-rr92.6%
unpow292.6%
clear-num92.6%
un-div-inv92.6%
Applied egg-rr92.6%
if 9.99999999999999921e133 < (/.f64 t l) Initial program 49.7%
Taylor expanded in t around inf 86.2%
*-commutative86.2%
unpow286.2%
unpow286.2%
times-frac99.7%
unpow299.7%
*-commutative99.7%
associate-/l*99.5%
Simplified99.5%
expm1-log1p-u99.5%
expm1-udef42.0%
associate-*r/42.0%
div-inv42.0%
sqrt-unprod42.0%
clear-num42.0%
Applied egg-rr42.0%
expm1-def99.7%
expm1-log1p99.7%
*-commutative99.7%
*-commutative99.7%
Simplified99.7%
Final simplification93.6%
(FPCore (t l Om Omc) :precision binary64 (asin (sqrt (/ (- 1.0 (/ (/ Om Omc) (/ Omc Om))) (+ 1.0 (* 2.0 (* (/ t l) (/ t l))))))))
double code(double t, double l, double Om, double Omc) {
return asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l)))))));
}
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) / (omc / om))) / (1.0d0 + (2.0d0 * ((t / l) * (t / l)))))))
end function
public static double code(double t, double l, double Om, double Omc) {
return Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l)))))));
}
def code(t, l, Om, Omc): return math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l)))))))
function code(t, l, Om, Omc) return asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) * Float64(t / l))))))) end
function tmp = code(t, l, Om, Omc) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l))))))); end
code[t_, 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[(N[(t / l), $MachinePrecision] * N[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)}}\right)
\end{array}
Initial program 86.4%
unpow286.4%
clear-num86.4%
un-div-inv86.4%
Applied egg-rr86.4%
unpow286.4%
clear-num86.4%
un-div-inv86.4%
Applied egg-rr86.4%
div-inv86.4%
clear-num86.4%
Applied egg-rr86.4%
Final simplification86.4%
(FPCore (t l Om Omc) :precision binary64 (asin (sqrt (/ (- 1.0 (/ (/ Om Omc) (/ Omc Om))) (+ 1.0 (* 2.0 (/ (/ t l) (/ l t))))))))
double code(double t, double l, double Om, double Omc) {
return asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
}
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) / (omc / om))) / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
end function
public static double code(double t, double l, double Om, double Omc) {
return Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
}
def code(t, l, Om, Omc): return math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))))
function code(t, l, Om, Omc) return asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) / Float64(l / t))))))) end
function tmp = code(t, l, Om, Omc) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))); end
code[t_, 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[(N[(t / l), $MachinePrecision] / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{\frac{t}{\ell}}{\frac{\ell}{t}}}}\right)
\end{array}
Initial program 86.4%
unpow286.4%
clear-num86.4%
un-div-inv86.4%
Applied egg-rr86.4%
unpow286.4%
clear-num86.4%
un-div-inv86.4%
Applied egg-rr86.4%
Final simplification86.4%
(FPCore (t l Om Omc) :precision binary64 (asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om))))))
double code(double t, double l, double Om, double Omc) {
return asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
}
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) / (omc / om)))))
end function
public static double code(double t, double l, double Om, double Omc) {
return Math.asin(Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
}
def code(t, l, Om, Omc): return math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))))
function code(t, l, Om, Omc) return asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))) end
function tmp = code(t, l, Om, Omc) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); end
code[t_, 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}
\\
\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)
\end{array}
Initial program 86.4%
Taylor expanded in t around 0 48.0%
unpow248.0%
unpow248.0%
times-frac53.2%
unpow253.2%
Simplified53.2%
unpow286.4%
clear-num86.4%
un-div-inv86.4%
Applied egg-rr53.2%
Final simplification53.2%
herbie shell --seed 2023313
(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)))))))