
(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 (asin (/ (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (hypot 1.0 (* t (/ (sqrt 2.0) l))))))
double code(double t, double l, double Om, double Omc) {
return asin((sqrt((1.0 - pow((Om / Omc), 2.0))) / hypot(1.0, (t * (sqrt(2.0) / l)))));
}
public static double code(double t, double l, double Om, double Omc) {
return Math.asin((Math.sqrt((1.0 - Math.pow((Om / Omc), 2.0))) / Math.hypot(1.0, (t * (Math.sqrt(2.0) / l)))));
}
def code(t, l, Om, Omc): return math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) / math.hypot(1.0, (t * (math.sqrt(2.0) / l)))))
function code(t, l, Om, Omc) return asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) / hypot(1.0, Float64(t * Float64(sqrt(2.0) / l))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) / hypot(1.0, (t * (sqrt(2.0) / l))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, t \cdot \frac{\sqrt{2}}{\ell}\right)}\right)
\end{array}
Initial program 85.8%
sqrt-div85.8%
div-inv85.8%
add-sqr-sqrt85.8%
hypot-1-def85.8%
*-commutative85.8%
sqrt-prod85.7%
sqrt-pow199.0%
metadata-eval99.0%
pow199.0%
Applied egg-rr99.0%
associate-*r/99.0%
*-rgt-identity99.0%
associate-*l/99.0%
associate-/l*99.0%
Simplified99.0%
Final simplification99.0%
(FPCore (t l Om Omc) :precision binary64 (asin (/ 1.0 (hypot 1.0 (* t (/ (sqrt 2.0) l))))))
double code(double t, double l, double Om, double Omc) {
return asin((1.0 / hypot(1.0, (t * (sqrt(2.0) / l)))));
}
public static double code(double t, double l, double Om, double Omc) {
return Math.asin((1.0 / Math.hypot(1.0, (t * (Math.sqrt(2.0) / l)))));
}
def code(t, l, Om, Omc): return math.asin((1.0 / math.hypot(1.0, (t * (math.sqrt(2.0) / l)))))
function code(t, l, Om, Omc) return asin(Float64(1.0 / hypot(1.0, Float64(t * Float64(sqrt(2.0) / l))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((1.0 / hypot(1.0, (t * (sqrt(2.0) / l))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, t \cdot \frac{\sqrt{2}}{\ell}\right)}\right)
\end{array}
Initial program 85.8%
sqrt-div85.8%
div-inv85.8%
add-sqr-sqrt85.8%
hypot-1-def85.8%
*-commutative85.8%
sqrt-prod85.7%
sqrt-pow199.0%
metadata-eval99.0%
pow199.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 Om around 0 98.4%
Final simplification98.4%
(FPCore (t l Om Omc)
:precision binary64
(if (<= l 3.9e-155)
(asin (/ l (* t (sqrt 2.0))))
(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 tmp;
if (l <= 3.9e-155) {
tmp = asin((l / (t * sqrt(2.0))));
} 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) :: tmp
if (l <= 3.9d-155) then
tmp = asin((l / (t * sqrt(2.0d0))))
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 tmp;
if (l <= 3.9e-155) {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
} 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): tmp = 0 if l <= 3.9e-155: tmp = math.asin((l / (t * math.sqrt(2.0)))) 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) tmp = 0.0 if (l <= 3.9e-155) tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); 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) tmp = 0.0; if (l <= 3.9e-155) tmp = asin((l / (t * sqrt(2.0)))); 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_] := If[LessEqual[l, 3.9e-155], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $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}
\mathbf{if}\;\ell \leq 3.9 \cdot 10^{-155}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\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 l < 3.9000000000000003e-155Initial program 83.0%
sqrt-div83.0%
div-inv83.0%
add-sqr-sqrt83.0%
hypot-1-def83.0%
*-commutative83.0%
sqrt-prod82.9%
sqrt-pow199.2%
metadata-eval99.2%
pow199.2%
Applied egg-rr99.2%
associate-*r/99.2%
*-rgt-identity99.2%
associate-*l/99.2%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in Om around 0 98.4%
Taylor expanded in t around inf 31.4%
if 3.9000000000000003e-155 < l Initial program 91.1%
unpow291.1%
clear-num91.2%
un-div-inv91.1%
Applied egg-rr91.1%
unpow260.1%
clear-num60.1%
un-div-inv60.1%
Applied egg-rr91.1%
Final simplification51.7%
(FPCore (t l Om Omc)
:precision binary64
(if (<= l 8.8e-48)
(asin (/ l (* t (sqrt 2.0))))
(if (or (<= l 5.5e-10) (not (<= l 7.5e+54)))
(asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(asin (* (/ 1.0 t) (/ l (sqrt 2.0)))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= 8.8e-48) {
tmp = asin((l / (t * sqrt(2.0))));
} else if ((l <= 5.5e-10) || !(l <= 7.5e+54)) {
tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else {
tmp = asin(((1.0 / t) * (l / 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 (l <= 8.8d-48) then
tmp = asin((l / (t * sqrt(2.0d0))))
else if ((l <= 5.5d-10) .or. (.not. (l <= 7.5d+54))) then
tmp = asin(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
else
tmp = asin(((1.0d0 / t) * (l / sqrt(2.0d0))))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= 8.8e-48) {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
} else if ((l <= 5.5e-10) || !(l <= 7.5e+54)) {
tmp = Math.asin(Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else {
tmp = Math.asin(((1.0 / t) * (l / Math.sqrt(2.0))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if l <= 8.8e-48: tmp = math.asin((l / (t * math.sqrt(2.0)))) elif (l <= 5.5e-10) or not (l <= 7.5e+54): tmp = math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om))))) else: tmp = math.asin(((1.0 / t) * (l / math.sqrt(2.0)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (l <= 8.8e-48) tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); elseif ((l <= 5.5e-10) || !(l <= 7.5e+54)) tmp = asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))); else tmp = asin(Float64(Float64(1.0 / t) * Float64(l / sqrt(2.0)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (l <= 8.8e-48) tmp = asin((l / (t * sqrt(2.0)))); elseif ((l <= 5.5e-10) || ~((l <= 7.5e+54))) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); else tmp = asin(((1.0 / t) * (l / sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, 8.8e-48], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[l, 5.5e-10], N[Not[LessEqual[l, 7.5e+54]], $MachinePrecision]], N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(1.0 / t), $MachinePrecision] * N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 8.8 \cdot 10^{-48}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{-10} \lor \neg \left(\ell \leq 7.5 \cdot 10^{+54}\right):\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{1}{t} \cdot \frac{\ell}{\sqrt{2}}\right)\\
\end{array}
\end{array}
if l < 8.8000000000000005e-48Initial program 81.6%
sqrt-div81.5%
div-inv81.5%
add-sqr-sqrt81.5%
hypot-1-def81.5%
*-commutative81.5%
sqrt-prod81.4%
sqrt-pow199.2%
metadata-eval99.2%
pow199.2%
Applied egg-rr99.2%
associate-*r/99.2%
*-rgt-identity99.2%
associate-*l/99.2%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in Om around 0 98.4%
Taylor expanded in t around inf 35.0%
if 8.8000000000000005e-48 < l < 5.4999999999999996e-10 or 7.50000000000000042e54 < l Initial program 98.3%
Taylor expanded in t around 0 71.1%
unpow271.1%
unpow271.1%
times-frac76.3%
unpow276.3%
Simplified76.3%
unpow276.3%
clear-num76.3%
un-div-inv76.3%
Applied egg-rr76.3%
if 5.4999999999999996e-10 < l < 7.50000000000000042e54Initial program 100.0%
sqrt-div99.6%
div-inv99.6%
add-sqr-sqrt99.6%
hypot-1-def99.6%
*-commutative99.6%
sqrt-prod98.8%
sqrt-pow198.8%
metadata-eval98.8%
pow198.8%
Applied egg-rr98.8%
associate-*r/98.8%
*-rgt-identity98.8%
associate-*l/98.8%
associate-/l*98.4%
Simplified98.4%
Taylor expanded in Om around 0 98.4%
Taylor expanded in t around inf 2.3%
*-un-lft-identity2.3%
times-frac2.3%
Applied egg-rr2.3%
Final simplification44.1%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (/ (/ Om Omc) (/ Omc Om))))
(if (<= l 1.25e-44)
(asin (/ l (* t (sqrt 2.0))))
(if (<= l 4.1e-8)
(asin (sqrt (+ 1.0 (+ 1.0 (- -1.0 t_1)))))
(if (<= l 5.4e+51)
(asin (* (/ 1.0 t) (/ l (sqrt 2.0))))
(asin (sqrt (- 1.0 t_1))))))))
double code(double t, double l, double Om, double Omc) {
double t_1 = (Om / Omc) / (Omc / Om);
double tmp;
if (l <= 1.25e-44) {
tmp = asin((l / (t * sqrt(2.0))));
} else if (l <= 4.1e-8) {
tmp = asin(sqrt((1.0 + (1.0 + (-1.0 - t_1)))));
} else if (l <= 5.4e+51) {
tmp = asin(((1.0 / t) * (l / sqrt(2.0))));
} else {
tmp = asin(sqrt((1.0 - t_1)));
}
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 = (om / omc) / (omc / om)
if (l <= 1.25d-44) then
tmp = asin((l / (t * sqrt(2.0d0))))
else if (l <= 4.1d-8) then
tmp = asin(sqrt((1.0d0 + (1.0d0 + ((-1.0d0) - t_1)))))
else if (l <= 5.4d+51) then
tmp = asin(((1.0d0 / t) * (l / sqrt(2.0d0))))
else
tmp = asin(sqrt((1.0d0 - t_1)))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double t_1 = (Om / Omc) / (Omc / Om);
double tmp;
if (l <= 1.25e-44) {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
} else if (l <= 4.1e-8) {
tmp = Math.asin(Math.sqrt((1.0 + (1.0 + (-1.0 - t_1)))));
} else if (l <= 5.4e+51) {
tmp = Math.asin(((1.0 / t) * (l / Math.sqrt(2.0))));
} else {
tmp = Math.asin(Math.sqrt((1.0 - t_1)));
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = (Om / Omc) / (Omc / Om) tmp = 0 if l <= 1.25e-44: tmp = math.asin((l / (t * math.sqrt(2.0)))) elif l <= 4.1e-8: tmp = math.asin(math.sqrt((1.0 + (1.0 + (-1.0 - t_1))))) elif l <= 5.4e+51: tmp = math.asin(((1.0 / t) * (l / math.sqrt(2.0)))) else: tmp = math.asin(math.sqrt((1.0 - t_1))) return tmp
function code(t, l, Om, Omc) t_1 = Float64(Float64(Om / Omc) / Float64(Omc / Om)) tmp = 0.0 if (l <= 1.25e-44) tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); elseif (l <= 4.1e-8) tmp = asin(sqrt(Float64(1.0 + Float64(1.0 + Float64(-1.0 - t_1))))); elseif (l <= 5.4e+51) tmp = asin(Float64(Float64(1.0 / t) * Float64(l / sqrt(2.0)))); else tmp = asin(sqrt(Float64(1.0 - t_1))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = (Om / Omc) / (Omc / Om); tmp = 0.0; if (l <= 1.25e-44) tmp = asin((l / (t * sqrt(2.0)))); elseif (l <= 4.1e-8) tmp = asin(sqrt((1.0 + (1.0 + (-1.0 - t_1))))); elseif (l <= 5.4e+51) tmp = asin(((1.0 / t) * (l / sqrt(2.0)))); else tmp = asin(sqrt((1.0 - t_1))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 1.25e-44], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 4.1e-8], N[ArcSin[N[Sqrt[N[(1.0 + N[(1.0 + N[(-1.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 5.4e+51], N[ArcSin[N[(N[(1.0 / t), $MachinePrecision] * N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\\
\mathbf{if}\;\ell \leq 1.25 \cdot 10^{-44}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\ell \leq 4.1 \cdot 10^{-8}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 + \left(1 + \left(-1 - t\_1\right)\right)}\right)\\
\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+51}:\\
\;\;\;\;\sin^{-1} \left(\frac{1}{t} \cdot \frac{\ell}{\sqrt{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - t\_1}\right)\\
\end{array}
\end{array}
if l < 1.2500000000000001e-44Initial program 81.6%
sqrt-div81.5%
div-inv81.5%
add-sqr-sqrt81.5%
hypot-1-def81.5%
*-commutative81.5%
sqrt-prod81.4%
sqrt-pow199.2%
metadata-eval99.2%
pow199.2%
Applied egg-rr99.2%
associate-*r/99.2%
*-rgt-identity99.2%
associate-*l/99.2%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in Om around 0 98.4%
Taylor expanded in t around inf 35.0%
if 1.2500000000000001e-44 < l < 4.10000000000000032e-8Initial program 92.2%
Taylor expanded in t around 0 52.0%
unpow252.0%
unpow252.0%
times-frac64.5%
unpow264.5%
Simplified64.5%
expm1-log1p-u64.5%
expm1-undefine64.5%
log1p-undefine64.5%
add-exp-log64.5%
Applied egg-rr64.5%
unpow264.5%
clear-num64.5%
un-div-inv64.5%
Applied egg-rr64.5%
if 4.10000000000000032e-8 < l < 5.39999999999999983e51Initial program 100.0%
sqrt-div99.6%
div-inv99.6%
add-sqr-sqrt99.6%
hypot-1-def99.6%
*-commutative99.6%
sqrt-prod98.8%
sqrt-pow198.8%
metadata-eval98.8%
pow198.8%
Applied egg-rr98.8%
associate-*r/98.8%
*-rgt-identity98.8%
associate-*l/98.8%
associate-/l*98.4%
Simplified98.4%
Taylor expanded in Om around 0 98.4%
Taylor expanded in t around inf 2.3%
*-un-lft-identity2.3%
times-frac2.3%
Applied egg-rr2.3%
if 5.39999999999999983e51 < l Initial program 99.3%
Taylor expanded in t around 0 74.1%
unpow274.1%
unpow274.1%
times-frac78.1%
unpow278.1%
Simplified78.1%
unpow278.1%
clear-num78.1%
un-div-inv78.1%
Applied egg-rr78.1%
Final simplification44.1%
(FPCore (t l Om Omc)
:precision binary64
(if (<= l 7.6e-47)
(asin (/ l (* t (sqrt 2.0))))
(if (<= l 7.8e-8)
(asin 1.0)
(if (<= l 5.4e+51) (asin (* (/ 1.0 t) (/ l (sqrt 2.0)))) (asin 1.0)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= 7.6e-47) {
tmp = asin((l / (t * sqrt(2.0))));
} else if (l <= 7.8e-8) {
tmp = asin(1.0);
} else if (l <= 5.4e+51) {
tmp = asin(((1.0 / t) * (l / sqrt(2.0))));
} else {
tmp = asin(1.0);
}
return tmp;
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: tmp
if (l <= 7.6d-47) then
tmp = asin((l / (t * sqrt(2.0d0))))
else if (l <= 7.8d-8) then
tmp = asin(1.0d0)
else if (l <= 5.4d+51) then
tmp = asin(((1.0d0 / t) * (l / sqrt(2.0d0))))
else
tmp = asin(1.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= 7.6e-47) {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
} else if (l <= 7.8e-8) {
tmp = Math.asin(1.0);
} else if (l <= 5.4e+51) {
tmp = Math.asin(((1.0 / t) * (l / Math.sqrt(2.0))));
} else {
tmp = Math.asin(1.0);
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if l <= 7.6e-47: tmp = math.asin((l / (t * math.sqrt(2.0)))) elif l <= 7.8e-8: tmp = math.asin(1.0) elif l <= 5.4e+51: tmp = math.asin(((1.0 / t) * (l / math.sqrt(2.0)))) else: tmp = math.asin(1.0) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (l <= 7.6e-47) tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); elseif (l <= 7.8e-8) tmp = asin(1.0); elseif (l <= 5.4e+51) tmp = asin(Float64(Float64(1.0 / t) * Float64(l / sqrt(2.0)))); else tmp = asin(1.0); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (l <= 7.6e-47) tmp = asin((l / (t * sqrt(2.0)))); elseif (l <= 7.8e-8) tmp = asin(1.0); elseif (l <= 5.4e+51) tmp = asin(((1.0 / t) * (l / sqrt(2.0)))); else tmp = asin(1.0); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, 7.6e-47], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 7.8e-8], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, 5.4e+51], N[ArcSin[N[(N[(1.0 / t), $MachinePrecision] * N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 7.6 \cdot 10^{-47}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\ell \leq 7.8 \cdot 10^{-8}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+51}:\\
\;\;\;\;\sin^{-1} \left(\frac{1}{t} \cdot \frac{\ell}{\sqrt{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < 7.60000000000000029e-47Initial program 81.6%
sqrt-div81.5%
div-inv81.5%
add-sqr-sqrt81.5%
hypot-1-def81.5%
*-commutative81.5%
sqrt-prod81.4%
sqrt-pow199.2%
metadata-eval99.2%
pow199.2%
Applied egg-rr99.2%
associate-*r/99.2%
*-rgt-identity99.2%
associate-*l/99.2%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in Om around 0 98.4%
Taylor expanded in t around inf 35.0%
if 7.60000000000000029e-47 < l < 7.7999999999999997e-8 or 5.39999999999999983e51 < l Initial program 98.3%
Taylor expanded in t around 0 71.1%
unpow271.1%
unpow271.1%
times-frac76.3%
unpow276.3%
Simplified76.3%
Taylor expanded in Om around 0 76.3%
if 7.7999999999999997e-8 < l < 5.39999999999999983e51Initial program 100.0%
sqrt-div99.6%
div-inv99.6%
add-sqr-sqrt99.6%
hypot-1-def99.6%
*-commutative99.6%
sqrt-prod98.8%
sqrt-pow198.8%
metadata-eval98.8%
pow198.8%
Applied egg-rr98.8%
associate-*r/98.8%
*-rgt-identity98.8%
associate-*l/98.8%
associate-/l*98.4%
Simplified98.4%
Taylor expanded in Om around 0 98.4%
Taylor expanded in t around inf 2.3%
*-un-lft-identity2.3%
times-frac2.3%
Applied egg-rr2.3%
Final simplification44.1%
(FPCore (t l Om Omc) :precision binary64 (if (or (<= l 1.65e-45) (and (not (<= l 5.5e-10)) (<= l 5.4e+51))) (asin (/ l (* t (sqrt 2.0)))) (asin 1.0)))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((l <= 1.65e-45) || (!(l <= 5.5e-10) && (l <= 5.4e+51))) {
tmp = asin((l / (t * sqrt(2.0))));
} else {
tmp = asin(1.0);
}
return tmp;
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: tmp
if ((l <= 1.65d-45) .or. (.not. (l <= 5.5d-10)) .and. (l <= 5.4d+51)) then
tmp = asin((l / (t * sqrt(2.0d0))))
else
tmp = asin(1.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((l <= 1.65e-45) || (!(l <= 5.5e-10) && (l <= 5.4e+51))) {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
} else {
tmp = Math.asin(1.0);
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (l <= 1.65e-45) or (not (l <= 5.5e-10) and (l <= 5.4e+51)): tmp = math.asin((l / (t * math.sqrt(2.0)))) else: tmp = math.asin(1.0) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if ((l <= 1.65e-45) || (!(l <= 5.5e-10) && (l <= 5.4e+51))) tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); else tmp = asin(1.0); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((l <= 1.65e-45) || (~((l <= 5.5e-10)) && (l <= 5.4e+51))) tmp = asin((l / (t * sqrt(2.0)))); else tmp = asin(1.0); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[Or[LessEqual[l, 1.65e-45], And[N[Not[LessEqual[l, 5.5e-10]], $MachinePrecision], LessEqual[l, 5.4e+51]]], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.65 \cdot 10^{-45} \lor \neg \left(\ell \leq 5.5 \cdot 10^{-10}\right) \land \ell \leq 5.4 \cdot 10^{+51}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < 1.65e-45 or 5.4999999999999996e-10 < l < 5.39999999999999983e51Initial program 81.9%
sqrt-div81.9%
div-inv81.9%
add-sqr-sqrt81.9%
hypot-1-def81.9%
*-commutative81.9%
sqrt-prod81.8%
sqrt-pow199.2%
metadata-eval99.2%
pow199.2%
Applied egg-rr99.2%
associate-*r/99.2%
*-rgt-identity99.2%
associate-*l/99.2%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in Om around 0 98.4%
Taylor expanded in t around inf 34.3%
if 1.65e-45 < l < 5.4999999999999996e-10 or 5.39999999999999983e51 < l Initial program 98.3%
Taylor expanded in t around 0 71.1%
unpow271.1%
unpow271.1%
times-frac76.3%
unpow276.3%
Simplified76.3%
Taylor expanded in Om around 0 76.3%
Final simplification44.1%
(FPCore (t l Om Omc) :precision binary64 (asin 1.0))
double code(double t, double l, double Om, double Omc) {
return asin(1.0);
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
code = asin(1.0d0)
end function
public static double code(double t, double l, double Om, double Omc) {
return Math.asin(1.0);
}
def code(t, l, Om, Omc): return math.asin(1.0)
function code(t, l, Om, Omc) return asin(1.0) end
function tmp = code(t, l, Om, Omc) tmp = asin(1.0); end
code[t_, l_, Om_, Omc_] := N[ArcSin[1.0], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} 1
\end{array}
Initial program 85.8%
Taylor expanded in t around 0 48.9%
unpow248.9%
unpow248.9%
times-frac53.5%
unpow253.5%
Simplified53.5%
Taylor expanded in Om around 0 52.9%
Final simplification52.9%
herbie shell --seed 2024100
(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)))))))