
(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}
(FPCore (t l Om Omc)
:precision binary64
(if (<= (pow (/ t l) 2.0) 1e+307)
(asin
(sqrt
(/
(- 1.0 (/ Om (* Omc (/ Omc Om))))
(+ 1.0 (* 2.0 (/ (/ t l) (/ l t)))))))
(asin (fabs (/ (/ l t) (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (pow((t / l), 2.0) <= 1e+307) {
tmp = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = asin(fabs(((l / t) / sqrt(2.0))));
}
return tmp;
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: tmp
if (((t / l) ** 2.0d0) <= 1d+307) then
tmp = asin(sqrt(((1.0d0 - (om / (omc * (omc / om)))) / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
else
tmp = asin(abs(((l / t) / sqrt(2.0d0))))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if (Math.pow((t / l), 2.0) <= 1e+307) {
tmp = Math.asin(Math.sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = Math.asin(Math.abs(((l / t) / Math.sqrt(2.0))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if math.pow((t / l), 2.0) <= 1e+307: tmp = math.asin(math.sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t / l) / (l / t))))))) else: tmp = math.asin(math.fabs(((l / t) / math.sqrt(2.0)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if ((Float64(t / l) ^ 2.0) <= 1e+307) tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Om / Float64(Omc * Float64(Omc / Om)))) / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) / Float64(l / t))))))); else tmp = asin(abs(Float64(Float64(l / t) / sqrt(2.0)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (((t / l) ^ 2.0) <= 1e+307) tmp = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t / l) / (l / t))))))); else tmp = asin(abs(((l / t) / sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision], 1e+307], N[ArcSin[N[Sqrt[N[(N[(1.0 - N[(Om / N[(Omc * N[(Omc / Om), $MachinePrecision]), $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[Abs[N[(N[(l / t), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{t}{\ell}\right)}^{2} \leq 10^{+307}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{Om}{Omc \cdot \frac{Omc}{Om}}}{1 + 2 \cdot \frac{\frac{t}{\ell}}{\frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\left|\frac{\frac{\ell}{t}}{\sqrt{2}}\right|\right)\\
\end{array}
\end{array}
if (pow.f64 (/.f64 t l) 2) < 9.99999999999999986e306Initial program 98.6%
unpow298.6%
clear-num98.6%
un-div-inv98.6%
Applied egg-rr98.6%
unpow298.6%
clear-num98.6%
frac-times98.6%
*-un-lft-identity98.6%
Applied egg-rr98.6%
if 9.99999999999999986e306 < (pow.f64 (/.f64 t l) 2) Initial program 53.9%
sqrt-div53.9%
div-inv53.9%
add-sqr-sqrt53.9%
hypot-1-def53.9%
*-commutative53.9%
sqrt-prod53.9%
unpow253.9%
sqrt-prod51.8%
add-sqr-sqrt99.0%
Applied egg-rr99.0%
associate-*r/99.0%
*-rgt-identity99.0%
associate-*l/99.0%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in t around -inf 71.5%
mul-1-neg71.5%
associate-/l/71.5%
*-commutative71.5%
distribute-rgt-neg-in71.5%
unpow271.5%
unpow271.5%
times-frac75.5%
unpow275.5%
associate-/l/75.5%
Simplified75.5%
Taylor expanded in Om around 0 75.4%
mul-1-neg75.4%
distribute-frac-neg75.4%
Simplified75.4%
add-sqr-sqrt73.4%
sqrt-unprod56.0%
pow256.0%
Applied egg-rr56.0%
unpow256.0%
rem-sqrt-square99.4%
distribute-frac-neg99.4%
associate-/r*99.4%
Simplified99.4%
Final simplification98.9%
(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(Om / Float64(Omc * Float64(Omc / Om))))) / hypot(1.0, Float64(t / Float64(l / sqrt(2.0)))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((sqrt((1.0 - (Om / (Omc * (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[(Om / N[(Omc * N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(t / N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{\sqrt{1 - \frac{Om}{Omc \cdot \frac{Omc}{Om}}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)
\end{array}
Initial program 85.3%
sqrt-div85.3%
div-inv85.2%
add-sqr-sqrt85.2%
hypot-1-def85.3%
*-commutative85.3%
sqrt-prod85.2%
unpow285.2%
sqrt-prod53.9%
add-sqr-sqrt98.6%
Applied egg-rr98.6%
associate-*r/98.6%
*-rgt-identity98.6%
associate-*l/98.7%
associate-/l*98.6%
Simplified98.6%
unpow285.3%
clear-num85.3%
frac-times85.3%
*-un-lft-identity85.3%
Applied egg-rr98.6%
Final simplification98.6%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0)))
(t_2 (asin (sqrt (- 1.0 (/ Om (* Omc (/ Omc Om))))))))
(if (<= l -7.6e+102)
t_2
(if (<= l -4.9e+57)
(asin (/ (- l) t_1))
(if (<= l -1.32e+25)
t_2
(if (<= l -1.6e-305)
(asin (* l (/ -1.0 t_1)))
(if (or (<= l 8.5e-74) (and (not (<= l 1.86e-22)) (<= l 1.45e-7)))
(asin (/ l (/ t (sqrt 0.5))))
t_2)))))))
double code(double t, double l, double Om, double Omc) {
double t_1 = t * sqrt(2.0);
double t_2 = asin(sqrt((1.0 - (Om / (Omc * (Omc / Om))))));
double tmp;
if (l <= -7.6e+102) {
tmp = t_2;
} else if (l <= -4.9e+57) {
tmp = asin((-l / t_1));
} else if (l <= -1.32e+25) {
tmp = t_2;
} else if (l <= -1.6e-305) {
tmp = asin((l * (-1.0 / t_1)));
} else if ((l <= 8.5e-74) || (!(l <= 1.86e-22) && (l <= 1.45e-7))) {
tmp = asin((l / (t / sqrt(0.5))));
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = t * sqrt(2.0d0)
t_2 = asin(sqrt((1.0d0 - (om / (omc * (omc / om))))))
if (l <= (-7.6d+102)) then
tmp = t_2
else if (l <= (-4.9d+57)) then
tmp = asin((-l / t_1))
else if (l <= (-1.32d+25)) then
tmp = t_2
else if (l <= (-1.6d-305)) then
tmp = asin((l * ((-1.0d0) / t_1)))
else if ((l <= 8.5d-74) .or. (.not. (l <= 1.86d-22)) .and. (l <= 1.45d-7)) then
tmp = asin((l / (t / sqrt(0.5d0))))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double t_1 = t * Math.sqrt(2.0);
double t_2 = Math.asin(Math.sqrt((1.0 - (Om / (Omc * (Omc / Om))))));
double tmp;
if (l <= -7.6e+102) {
tmp = t_2;
} else if (l <= -4.9e+57) {
tmp = Math.asin((-l / t_1));
} else if (l <= -1.32e+25) {
tmp = t_2;
} else if (l <= -1.6e-305) {
tmp = Math.asin((l * (-1.0 / t_1)));
} else if ((l <= 8.5e-74) || (!(l <= 1.86e-22) && (l <= 1.45e-7))) {
tmp = Math.asin((l / (t / Math.sqrt(0.5))));
} else {
tmp = t_2;
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = t * math.sqrt(2.0) t_2 = math.asin(math.sqrt((1.0 - (Om / (Omc * (Omc / Om)))))) tmp = 0 if l <= -7.6e+102: tmp = t_2 elif l <= -4.9e+57: tmp = math.asin((-l / t_1)) elif l <= -1.32e+25: tmp = t_2 elif l <= -1.6e-305: tmp = math.asin((l * (-1.0 / t_1))) elif (l <= 8.5e-74) or (not (l <= 1.86e-22) and (l <= 1.45e-7)): tmp = math.asin((l / (t / math.sqrt(0.5)))) else: tmp = t_2 return tmp
function code(t, l, Om, Omc) t_1 = Float64(t * sqrt(2.0)) t_2 = asin(sqrt(Float64(1.0 - Float64(Om / Float64(Omc * Float64(Omc / Om)))))) tmp = 0.0 if (l <= -7.6e+102) tmp = t_2; elseif (l <= -4.9e+57) tmp = asin(Float64(Float64(-l) / t_1)); elseif (l <= -1.32e+25) tmp = t_2; elseif (l <= -1.6e-305) tmp = asin(Float64(l * Float64(-1.0 / t_1))); elseif ((l <= 8.5e-74) || (!(l <= 1.86e-22) && (l <= 1.45e-7))) tmp = asin(Float64(l / Float64(t / sqrt(0.5)))); else tmp = t_2; end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = t * sqrt(2.0); t_2 = asin(sqrt((1.0 - (Om / (Omc * (Omc / Om)))))); tmp = 0.0; if (l <= -7.6e+102) tmp = t_2; elseif (l <= -4.9e+57) tmp = asin((-l / t_1)); elseif (l <= -1.32e+25) tmp = t_2; elseif (l <= -1.6e-305) tmp = asin((l * (-1.0 / t_1))); elseif ((l <= 8.5e-74) || (~((l <= 1.86e-22)) && (l <= 1.45e-7))) tmp = asin((l / (t / sqrt(0.5)))); else tmp = t_2; end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcSin[N[Sqrt[N[(1.0 - N[(Om / N[(Omc * N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -7.6e+102], t$95$2, If[LessEqual[l, -4.9e+57], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -1.32e+25], t$95$2, If[LessEqual[l, -1.6e-305], N[ArcSin[N[(l * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[l, 8.5e-74], And[N[Not[LessEqual[l, 1.86e-22]], $MachinePrecision], LessEqual[l, 1.45e-7]]], N[ArcSin[N[(l / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \sqrt{2}\\
t_2 := \sin^{-1} \left(\sqrt{1 - \frac{Om}{Omc \cdot \frac{Omc}{Om}}}\right)\\
\mathbf{if}\;\ell \leq -7.6 \cdot 10^{+102}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -4.9 \cdot 10^{+57}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\ell \leq -1.32 \cdot 10^{+25}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -1.6 \cdot 10^{-305}:\\
\;\;\;\;\sin^{-1} \left(\ell \cdot \frac{-1}{t_1}\right)\\
\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-74} \lor \neg \left(\ell \leq 1.86 \cdot 10^{-22}\right) \land \ell \leq 1.45 \cdot 10^{-7}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if l < -7.59999999999999958e102 or -4.8999999999999999e57 < l < -1.32e25 or 8.50000000000000052e-74 < l < 1.85999999999999994e-22 or 1.4499999999999999e-7 < l Initial program 91.0%
Taylor expanded in t around 0 75.3%
unpow275.3%
unpow275.3%
times-frac77.1%
unpow277.1%
Simplified77.1%
unpow291.0%
clear-num91.0%
frac-times91.0%
*-un-lft-identity91.0%
Applied egg-rr77.1%
if -7.59999999999999958e102 < l < -4.8999999999999999e57Initial program 57.9%
sqrt-div57.5%
div-inv57.5%
add-sqr-sqrt57.4%
hypot-1-def57.5%
*-commutative57.5%
sqrt-prod57.4%
unpow257.4%
sqrt-prod22.2%
add-sqr-sqrt99.1%
Applied egg-rr99.1%
associate-*r/99.1%
*-rgt-identity99.1%
associate-*l/99.3%
associate-/l*98.8%
Simplified98.8%
Taylor expanded in t around -inf 51.4%
mul-1-neg51.4%
associate-/l/51.2%
*-commutative51.2%
distribute-rgt-neg-in51.2%
unpow251.2%
unpow251.2%
times-frac62.1%
unpow262.1%
associate-/l/62.5%
Simplified62.5%
Taylor expanded in Om around 0 61.8%
mul-1-neg61.8%
distribute-frac-neg61.8%
Simplified61.8%
if -1.32e25 < l < -1.60000000000000004e-305Initial program 88.9%
sqrt-div88.9%
div-inv88.9%
add-sqr-sqrt88.8%
hypot-1-def88.9%
*-commutative88.9%
sqrt-prod88.8%
unpow288.8%
sqrt-prod54.3%
add-sqr-sqrt98.3%
Applied egg-rr98.3%
associate-*r/98.3%
*-rgt-identity98.3%
associate-*l/98.4%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in t around -inf 56.2%
mul-1-neg56.2%
associate-/l/56.2%
*-commutative56.2%
distribute-rgt-neg-in56.2%
unpow256.2%
unpow256.2%
times-frac57.7%
unpow257.7%
associate-/l/57.8%
Simplified57.8%
Taylor expanded in Om around 0 57.8%
mul-1-neg57.8%
distribute-frac-neg57.8%
Simplified57.8%
div-inv57.8%
Applied egg-rr57.8%
if -1.60000000000000004e-305 < l < 8.50000000000000052e-74 or 1.85999999999999994e-22 < l < 1.4499999999999999e-7Initial program 72.9%
Taylor expanded in t around -inf 43.0%
associate-*r*43.0%
*-commutative43.0%
unpow243.0%
unpow243.0%
times-frac46.6%
unpow246.6%
associate-/l*46.6%
associate-*r/46.6%
neg-mul-146.6%
Simplified46.6%
associate-*r/46.6%
add-sqr-sqrt1.8%
sqrt-unprod42.5%
sqr-neg42.5%
sqrt-unprod55.8%
add-sqr-sqrt57.7%
Applied egg-rr57.7%
Taylor expanded in Om around 0 57.4%
associate-/l*57.5%
Simplified57.5%
Final simplification67.2%
(FPCore (t l Om Omc)
:precision binary64
(if (or (<= l -1.6e-305) (not (<= l 2.45e-203)))
(asin
(sqrt
(/
(- 1.0 (/ Om (* Omc (/ Omc Om))))
(+ 1.0 (* 2.0 (* t (/ (/ t l) l)))))))
(asin (/ l (/ t (sqrt 0.5))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((l <= -1.6e-305) || !(l <= 2.45e-203)) {
tmp = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * (t * ((t / l) / l)))))));
} else {
tmp = asin((l / (t / sqrt(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 ((l <= (-1.6d-305)) .or. (.not. (l <= 2.45d-203))) then
tmp = asin(sqrt(((1.0d0 - (om / (omc * (omc / om)))) / (1.0d0 + (2.0d0 * (t * ((t / l) / l)))))))
else
tmp = asin((l / (t / sqrt(0.5d0))))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((l <= -1.6e-305) || !(l <= 2.45e-203)) {
tmp = Math.asin(Math.sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * (t * ((t / l) / l)))))));
} else {
tmp = Math.asin((l / (t / Math.sqrt(0.5))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (l <= -1.6e-305) or not (l <= 2.45e-203): tmp = math.asin(math.sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * (t * ((t / l) / l))))))) else: tmp = math.asin((l / (t / math.sqrt(0.5)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if ((l <= -1.6e-305) || !(l <= 2.45e-203)) tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Om / Float64(Omc * Float64(Omc / Om)))) / Float64(1.0 + Float64(2.0 * Float64(t * Float64(Float64(t / l) / l))))))); else tmp = asin(Float64(l / Float64(t / sqrt(0.5)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((l <= -1.6e-305) || ~((l <= 2.45e-203))) tmp = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * (t * ((t / l) / l))))))); else tmp = asin((l / (t / sqrt(0.5)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[Or[LessEqual[l, -1.6e-305], N[Not[LessEqual[l, 2.45e-203]], $MachinePrecision]], N[ArcSin[N[Sqrt[N[(N[(1.0 - N[(Om / N[(Omc * N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[(t * N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.6 \cdot 10^{-305} \lor \neg \left(\ell \leq 2.45 \cdot 10^{-203}\right):\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{Om}{Omc \cdot \frac{Omc}{Om}}}{1 + 2 \cdot \left(t \cdot \frac{\frac{t}{\ell}}{\ell}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\\
\end{array}
\end{array}
if l < -1.60000000000000004e-305 or 2.45e-203 < l Initial program 87.1%
unpow287.1%
clear-num87.1%
un-div-inv87.1%
Applied egg-rr87.1%
unpow287.1%
clear-num87.1%
frac-times87.1%
*-un-lft-identity87.1%
Applied egg-rr87.1%
associate-/r/84.7%
Applied egg-rr84.7%
if -1.60000000000000004e-305 < l < 2.45e-203Initial program 67.4%
Taylor expanded in t around -inf 63.1%
associate-*r*63.1%
*-commutative63.1%
unpow263.1%
unpow263.1%
times-frac71.9%
unpow271.9%
associate-/l*71.8%
associate-*r/71.8%
neg-mul-171.8%
Simplified71.8%
associate-*r/71.8%
add-sqr-sqrt4.3%
sqrt-unprod42.5%
sqr-neg42.5%
sqrt-unprod61.9%
add-sqr-sqrt66.4%
Applied egg-rr66.4%
Taylor expanded in Om around 0 66.2%
associate-/l*66.4%
Simplified66.4%
Final simplification83.0%
(FPCore (t l Om Omc)
:precision binary64
(if (<= t 9e+216)
(asin
(sqrt
(/
(- 1.0 (/ Om (* Omc (/ Omc Om))))
(+ 1.0 (* 2.0 (/ (* t (/ t l)) l))))))
(asin (/ (* l (sqrt 0.5)) t))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (t <= 9e+216) {
tmp = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t * (t / l)) / l))))));
} else {
tmp = asin(((l * sqrt(0.5)) / t));
}
return tmp;
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: tmp
if (t <= 9d+216) then
tmp = asin(sqrt(((1.0d0 - (om / (omc * (omc / om)))) / (1.0d0 + (2.0d0 * ((t * (t / l)) / l))))))
else
tmp = asin(((l * sqrt(0.5d0)) / t))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if (t <= 9e+216) {
tmp = Math.asin(Math.sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t * (t / l)) / l))))));
} else {
tmp = Math.asin(((l * Math.sqrt(0.5)) / t));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if t <= 9e+216: tmp = math.asin(math.sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t * (t / l)) / l)))))) else: tmp = math.asin(((l * math.sqrt(0.5)) / t)) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (t <= 9e+216) tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Om / Float64(Omc * Float64(Omc / Om)))) / Float64(1.0 + Float64(2.0 * Float64(Float64(t * Float64(t / l)) / l)))))); else tmp = asin(Float64(Float64(l * sqrt(0.5)) / t)); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (t <= 9e+216) tmp = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t * (t / l)) / l)))))); else tmp = asin(((l * sqrt(0.5)) / t)); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[t, 9e+216], N[ArcSin[N[Sqrt[N[(N[(1.0 - N[(Om / N[(Omc * N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[(N[(t * N[(t / l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9 \cdot 10^{+216}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{Om}{Omc \cdot \frac{Omc}{Om}}}{1 + 2 \cdot \frac{t \cdot \frac{t}{\ell}}{\ell}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\
\end{array}
\end{array}
if t < 9.0000000000000005e216Initial program 89.2%
unpow289.2%
associate-*r/88.3%
Applied egg-rr88.3%
unpow289.2%
clear-num89.2%
frac-times89.2%
*-un-lft-identity89.2%
Applied egg-rr88.3%
if 9.0000000000000005e216 < t Initial program 58.5%
Taylor expanded in t around -inf 54.2%
associate-*r*54.2%
*-commutative54.2%
unpow254.2%
unpow254.2%
times-frac54.3%
unpow254.3%
associate-/l*54.5%
associate-*r/54.5%
neg-mul-154.5%
Simplified54.5%
associate-*r/54.5%
add-sqr-sqrt43.5%
sqrt-unprod74.5%
sqr-neg74.5%
sqrt-unprod43.4%
add-sqr-sqrt63.3%
Applied egg-rr63.3%
Taylor expanded in Om around 0 62.9%
Final simplification85.2%
(FPCore (t l Om Omc) :precision binary64 (if (<= l -1.6e-305) (asin (* l (/ -1.0 (* t (sqrt 2.0))))) (asin (/ l (/ t (sqrt 0.5))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -1.6e-305) {
tmp = asin((l * (-1.0 / (t * sqrt(2.0)))));
} else {
tmp = asin((l / (t / sqrt(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 (l <= (-1.6d-305)) then
tmp = asin((l * ((-1.0d0) / (t * sqrt(2.0d0)))))
else
tmp = asin((l / (t / sqrt(0.5d0))))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -1.6e-305) {
tmp = Math.asin((l * (-1.0 / (t * Math.sqrt(2.0)))));
} else {
tmp = Math.asin((l / (t / Math.sqrt(0.5))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if l <= -1.6e-305: tmp = math.asin((l * (-1.0 / (t * math.sqrt(2.0))))) else: tmp = math.asin((l / (t / math.sqrt(0.5)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (l <= -1.6e-305) tmp = asin(Float64(l * Float64(-1.0 / Float64(t * sqrt(2.0))))); else tmp = asin(Float64(l / Float64(t / sqrt(0.5)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (l <= -1.6e-305) tmp = asin((l * (-1.0 / (t * sqrt(2.0))))); else tmp = asin((l / (t / sqrt(0.5)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, -1.6e-305], N[ArcSin[N[(l * N[(-1.0 / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.6 \cdot 10^{-305}:\\
\;\;\;\;\sin^{-1} \left(\ell \cdot \frac{-1}{t \cdot \sqrt{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\\
\end{array}
\end{array}
if l < -1.60000000000000004e-305Initial program 89.9%
sqrt-div89.9%
div-inv89.9%
add-sqr-sqrt89.9%
hypot-1-def89.9%
*-commutative89.9%
sqrt-prod89.8%
unpow289.8%
sqrt-prod56.9%
add-sqr-sqrt98.3%
Applied egg-rr98.3%
associate-*r/98.3%
*-rgt-identity98.3%
associate-*l/98.4%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in t around -inf 36.3%
mul-1-neg36.3%
associate-/l/36.2%
*-commutative36.2%
distribute-rgt-neg-in36.2%
unpow236.2%
unpow236.2%
times-frac37.8%
unpow237.8%
associate-/l/37.8%
Simplified37.8%
Taylor expanded in Om around 0 37.8%
mul-1-neg37.8%
distribute-frac-neg37.8%
Simplified37.8%
div-inv37.8%
Applied egg-rr37.8%
if -1.60000000000000004e-305 < l Initial program 80.4%
Taylor expanded in t around -inf 27.6%
associate-*r*27.6%
*-commutative27.6%
unpow227.6%
unpow227.6%
times-frac30.5%
unpow230.5%
associate-/l*30.5%
associate-*r/30.5%
neg-mul-130.5%
Simplified30.5%
associate-*r/30.5%
add-sqr-sqrt0.8%
sqrt-unprod25.0%
sqr-neg25.0%
sqrt-unprod33.5%
add-sqr-sqrt34.4%
Applied egg-rr34.4%
Taylor expanded in Om around 0 34.1%
associate-/l*34.1%
Simplified34.1%
Final simplification36.0%
(FPCore (t l Om Omc) :precision binary64 (if (<= l -1.6e-305) (asin (/ (/ (- l) t) (sqrt 2.0))) (asin (/ l (/ t (sqrt 0.5))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -1.6e-305) {
tmp = asin(((-l / t) / sqrt(2.0)));
} else {
tmp = asin((l / (t / sqrt(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 (l <= (-1.6d-305)) then
tmp = asin(((-l / t) / sqrt(2.0d0)))
else
tmp = asin((l / (t / sqrt(0.5d0))))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -1.6e-305) {
tmp = Math.asin(((-l / t) / Math.sqrt(2.0)));
} else {
tmp = Math.asin((l / (t / Math.sqrt(0.5))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if l <= -1.6e-305: tmp = math.asin(((-l / t) / math.sqrt(2.0))) else: tmp = math.asin((l / (t / math.sqrt(0.5)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (l <= -1.6e-305) tmp = asin(Float64(Float64(Float64(-l) / t) / sqrt(2.0))); else tmp = asin(Float64(l / Float64(t / sqrt(0.5)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (l <= -1.6e-305) tmp = asin(((-l / t) / sqrt(2.0))); else tmp = asin((l / (t / sqrt(0.5)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, -1.6e-305], N[ArcSin[N[(N[((-l) / t), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.6 \cdot 10^{-305}:\\
\;\;\;\;\sin^{-1} \left(\frac{\frac{-\ell}{t}}{\sqrt{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\\
\end{array}
\end{array}
if l < -1.60000000000000004e-305Initial program 89.9%
sqrt-div89.9%
div-inv89.9%
add-sqr-sqrt89.9%
hypot-1-def89.9%
*-commutative89.9%
sqrt-prod89.8%
unpow289.8%
sqrt-prod56.9%
add-sqr-sqrt98.3%
Applied egg-rr98.3%
associate-*r/98.3%
*-rgt-identity98.3%
associate-*l/98.4%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in t around -inf 36.3%
mul-1-neg36.3%
associate-/l/36.2%
*-commutative36.2%
distribute-rgt-neg-in36.2%
unpow236.2%
unpow236.2%
times-frac37.8%
unpow237.8%
associate-/l/37.8%
Simplified37.8%
Taylor expanded in Om around 0 37.8%
mul-1-neg37.8%
distribute-frac-neg37.8%
Simplified37.8%
Taylor expanded in l around 0 37.8%
neg-mul-137.8%
associate-/r*37.7%
Simplified37.7%
if -1.60000000000000004e-305 < l Initial program 80.4%
Taylor expanded in t around -inf 27.6%
associate-*r*27.6%
*-commutative27.6%
unpow227.6%
unpow227.6%
times-frac30.5%
unpow230.5%
associate-/l*30.5%
associate-*r/30.5%
neg-mul-130.5%
Simplified30.5%
associate-*r/30.5%
add-sqr-sqrt0.8%
sqrt-unprod25.0%
sqr-neg25.0%
sqrt-unprod33.5%
add-sqr-sqrt34.4%
Applied egg-rr34.4%
Taylor expanded in Om around 0 34.1%
associate-/l*34.1%
Simplified34.1%
Final simplification36.0%
(FPCore (t l Om Omc) :precision binary64 (asin (/ l (/ t (sqrt 0.5)))))
double code(double t, double l, double Om, double Omc) {
return asin((l / (t / sqrt(0.5))));
}
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((l / (t / sqrt(0.5d0))))
end function
public static double code(double t, double l, double Om, double Omc) {
return Math.asin((l / (t / Math.sqrt(0.5))));
}
def code(t, l, Om, Omc): return math.asin((l / (t / math.sqrt(0.5))))
function code(t, l, Om, Omc) return asin(Float64(l / Float64(t / sqrt(0.5)))) end
function tmp = code(t, l, Om, Omc) tmp = asin((l / (t / sqrt(0.5)))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(l / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)
\end{array}
Initial program 85.3%
Taylor expanded in t around -inf 32.0%
associate-*r*32.0%
*-commutative32.0%
unpow232.0%
unpow232.0%
times-frac34.3%
unpow234.3%
associate-/l*34.2%
associate-*r/34.2%
neg-mul-134.2%
Simplified34.2%
associate-*r/34.2%
add-sqr-sqrt19.8%
sqrt-unprod30.0%
sqr-neg30.0%
sqrt-unprod16.2%
add-sqr-sqrt34.6%
Applied egg-rr34.6%
Taylor expanded in Om around 0 34.4%
associate-/l*34.5%
Simplified34.5%
Final simplification34.5%
herbie shell --seed 2024020
(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)))))))