
(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 11 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 l) (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
return asin((sqrt((1.0 - pow((Om / Omc), 2.0))) / 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 - Math.pow((Om / Omc), 2.0))) / Math.hypot(1.0, ((t / l) * Math.sqrt(2.0)))));
}
def code(t, l, Om, Omc): return math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) / 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 / Omc) ^ 2.0))) / 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) ^ 2.0))) / hypot(1.0, ((t / l) * sqrt(2.0))))); 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[(N[(t / l), $MachinePrecision] * N[Sqrt[2.0], $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, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Initial program 83.7%
sqrt-div83.7%
add-sqr-sqrt83.7%
hypot-1-def83.7%
*-commutative83.7%
sqrt-prod83.6%
sqrt-pow198.1%
metadata-eval98.1%
pow198.1%
Applied egg-rr98.1%
(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 83.7%
sqrt-div83.7%
div-inv83.7%
add-sqr-sqrt83.7%
hypot-1-def83.7%
*-commutative83.7%
sqrt-prod83.6%
sqrt-pow198.1%
metadata-eval98.1%
pow198.1%
Applied egg-rr98.1%
associate-*r/98.1%
*-rgt-identity98.1%
associate-*l/98.1%
associate-/l*98.1%
Simplified98.1%
(FPCore (t l Om Omc) :precision binary64 (asin (/ 1.0 (hypot 1.0 (/ t (/ l (sqrt 2.0)))))))
double code(double t, double l, double Om, double Omc) {
return asin((1.0 / hypot(1.0, (t / (l / sqrt(2.0))))));
}
public static double code(double t, double l, double Om, double Omc) {
return Math.asin((1.0 / Math.hypot(1.0, (t / (l / Math.sqrt(2.0))))));
}
def code(t, l, Om, Omc): return math.asin((1.0 / math.hypot(1.0, (t / (l / math.sqrt(2.0))))))
function code(t, l, Om, Omc) return asin(Float64(1.0 / hypot(1.0, Float64(t / Float64(l / sqrt(2.0)))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((1.0 / hypot(1.0, (t / (l / sqrt(2.0)))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 / 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{1}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)
\end{array}
Initial program 83.7%
sqrt-div83.7%
div-inv83.7%
add-sqr-sqrt83.7%
hypot-1-def83.7%
*-commutative83.7%
sqrt-prod83.6%
sqrt-pow198.1%
metadata-eval98.1%
pow198.1%
Applied egg-rr98.1%
associate-*r/98.1%
*-rgt-identity98.1%
associate-*l/98.1%
associate-/l*98.1%
Simplified98.1%
Taylor expanded in Om around 0 97.2%
clear-num97.2%
un-div-inv97.2%
Applied egg-rr97.2%
(FPCore (t l Om Omc) :precision binary64 (asin (/ 1.0 (hypot 1.0 (* (/ t l) (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
return asin((1.0 / hypot(1.0, ((t / l) * sqrt(2.0)))));
}
public static double code(double t, double l, double Om, double Omc) {
return Math.asin((1.0 / Math.hypot(1.0, ((t / l) * Math.sqrt(2.0)))));
}
def code(t, l, Om, Omc): return math.asin((1.0 / math.hypot(1.0, ((t / l) * math.sqrt(2.0)))))
function code(t, l, Om, Omc) return asin(Float64(1.0 / hypot(1.0, Float64(Float64(t / l) * sqrt(2.0))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((1.0 / hypot(1.0, ((t / l) * sqrt(2.0))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 / 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{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Initial program 83.7%
sqrt-div83.7%
add-sqr-sqrt83.7%
hypot-1-def83.7%
*-commutative83.7%
sqrt-prod83.6%
sqrt-pow198.1%
metadata-eval98.1%
pow198.1%
Applied egg-rr98.1%
Taylor expanded in Om around 0 97.2%
(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 83.7%
sqrt-div83.7%
div-inv83.7%
add-sqr-sqrt83.7%
hypot-1-def83.7%
*-commutative83.7%
sqrt-prod83.6%
sqrt-pow198.1%
metadata-eval98.1%
pow198.1%
Applied egg-rr98.1%
associate-*r/98.1%
*-rgt-identity98.1%
associate-*l/98.1%
associate-/l*98.1%
Simplified98.1%
Taylor expanded in Om around 0 97.2%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) 2e+114) (asin (sqrt (/ 1.0 (+ 1.0 (* 2.0 (/ 1.0 (* (/ l t) (/ l t)))))))) (asin (/ (/ l t) (sqrt 2.0)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 2e+114) {
tmp = asin(sqrt((1.0 / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t))))))));
} else {
tmp = asin(((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) <= 2d+114) then
tmp = asin(sqrt((1.0d0 / (1.0d0 + (2.0d0 * (1.0d0 / ((l / t) * (l / t))))))))
else
tmp = asin(((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 ((t / l) <= 2e+114) {
tmp = Math.asin(Math.sqrt((1.0 / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t))))))));
} else {
tmp = Math.asin(((l / t) / Math.sqrt(2.0)));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 2e+114: tmp = math.asin(math.sqrt((1.0 / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t)))))))) else: tmp = math.asin(((l / t) / math.sqrt(2.0))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= 2e+114) tmp = asin(sqrt(Float64(1.0 / Float64(1.0 + Float64(2.0 * Float64(1.0 / Float64(Float64(l / t) * Float64(l / t)))))))); else tmp = asin(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) <= 2e+114) tmp = asin(sqrt((1.0 / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t)))))))); else tmp = asin(((l / t) / sqrt(2.0))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], 2e+114], N[ArcSin[N[Sqrt[N[(1.0 / N[(1.0 + N[(2.0 * N[(1.0 / N[(N[(l / t), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l / t), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 2 \cdot 10^{+114}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1}{1 + 2 \cdot \frac{1}{\frac{\ell}{t} \cdot \frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\frac{\ell}{t}}{\sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 2e114Initial program 90.7%
unpow290.7%
clear-num90.7%
clear-num90.6%
frac-times90.6%
metadata-eval90.6%
Applied egg-rr90.6%
Taylor expanded in Om around 0 90.1%
if 2e114 < (/.f64 t l) Initial program 55.0%
sqrt-div55.0%
add-sqr-sqrt55.0%
hypot-1-def55.0%
*-commutative55.0%
sqrt-prod55.0%
sqrt-pow199.4%
metadata-eval99.4%
pow199.4%
Applied egg-rr99.4%
Taylor expanded in Om around 0 99.4%
Taylor expanded in t around inf 99.6%
*-un-lft-identity99.6%
associate-/r*99.8%
Applied egg-rr99.8%
Final simplification92.0%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) 0.5) (asin (sqrt (- 1.0 (* (/ Om Omc) (/ Om Omc))))) (asin (/ (/ l t) (sqrt 2.0)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 0.5) {
tmp = asin(sqrt((1.0 - ((Om / Omc) * (Om / Omc)))));
} else {
tmp = asin(((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) <= 0.5d0) then
tmp = asin(sqrt((1.0d0 - ((om / omc) * (om / omc)))))
else
tmp = asin(((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 ((t / l) <= 0.5) {
tmp = Math.asin(Math.sqrt((1.0 - ((Om / Omc) * (Om / Omc)))));
} else {
tmp = Math.asin(((l / t) / Math.sqrt(2.0)));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 0.5: tmp = math.asin(math.sqrt((1.0 - ((Om / Omc) * (Om / Omc))))) else: tmp = math.asin(((l / t) / math.sqrt(2.0))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= 0.5) tmp = asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) * Float64(Om / Omc))))); else tmp = asin(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) <= 0.5) tmp = asin(sqrt((1.0 - ((Om / Omc) * (Om / Omc))))); else tmp = asin(((l / t) / sqrt(2.0))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], 0.5], N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] * N[(Om / Omc), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l / t), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 0.5:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{Om}{Omc} \cdot \frac{Om}{Omc}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\frac{\ell}{t}}{\sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 0.5Initial program 89.8%
Taylor expanded in t around 0 62.0%
unpow262.0%
unpow262.0%
times-frac69.3%
unpow269.3%
Simplified69.3%
unpow269.3%
Applied egg-rr69.3%
if 0.5 < (/.f64 t l) Initial program 66.8%
sqrt-div66.9%
add-sqr-sqrt66.9%
hypot-1-def66.9%
*-commutative66.9%
sqrt-prod66.8%
sqrt-pow199.4%
metadata-eval99.4%
pow199.4%
Applied egg-rr99.4%
Taylor expanded in Om around 0 99.4%
Taylor expanded in t around inf 98.7%
*-un-lft-identity98.7%
associate-/r*98.7%
Applied egg-rr98.7%
Final simplification77.1%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) 0.5) (asin (/ 1.0 (+ 1.0 (pow (/ t l) 2.0)))) (asin (/ (/ l t) (sqrt 2.0)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 0.5) {
tmp = asin((1.0 / (1.0 + pow((t / l), 2.0))));
} else {
tmp = asin(((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) <= 0.5d0) then
tmp = asin((1.0d0 / (1.0d0 + ((t / l) ** 2.0d0))))
else
tmp = asin(((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 ((t / l) <= 0.5) {
tmp = Math.asin((1.0 / (1.0 + Math.pow((t / l), 2.0))));
} else {
tmp = Math.asin(((l / t) / Math.sqrt(2.0)));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 0.5: tmp = math.asin((1.0 / (1.0 + math.pow((t / l), 2.0)))) else: tmp = math.asin(((l / t) / math.sqrt(2.0))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= 0.5) tmp = asin(Float64(1.0 / Float64(1.0 + (Float64(t / l) ^ 2.0)))); else tmp = asin(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) <= 0.5) tmp = asin((1.0 / (1.0 + ((t / l) ^ 2.0)))); else tmp = asin(((l / t) / sqrt(2.0))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], 0.5], N[ArcSin[N[(1.0 / N[(1.0 + N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l / t), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 0.5:\\
\;\;\;\;\sin^{-1} \left(\frac{1}{1 + {\left(\frac{t}{\ell}\right)}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\frac{\ell}{t}}{\sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 0.5Initial program 89.8%
sqrt-div89.8%
add-sqr-sqrt89.8%
hypot-1-def89.8%
*-commutative89.8%
sqrt-prod89.8%
sqrt-pow197.6%
metadata-eval97.6%
pow197.6%
Applied egg-rr97.6%
Taylor expanded in Om around 0 96.4%
Taylor expanded in t around 0 67.1%
*-commutative67.1%
associate-/l*66.0%
associate-*r*66.0%
*-commutative66.0%
associate-*r/66.0%
associate-*r/67.1%
unpow267.1%
rem-square-sqrt67.1%
metadata-eval67.1%
*-rgt-identity67.1%
unpow267.1%
unpow267.1%
times-frac76.4%
unpow276.4%
Simplified76.4%
if 0.5 < (/.f64 t l) Initial program 66.8%
sqrt-div66.9%
add-sqr-sqrt66.9%
hypot-1-def66.9%
*-commutative66.9%
sqrt-prod66.8%
sqrt-pow199.4%
metadata-eval99.4%
pow199.4%
Applied egg-rr99.4%
Taylor expanded in Om around 0 99.4%
Taylor expanded in t around inf 98.7%
*-un-lft-identity98.7%
associate-/r*98.7%
Applied egg-rr98.7%
Final simplification82.3%
(FPCore (t l Om Omc) :precision binary64 (if (<= l 0.62) (asin (* l (/ (pow 2.0 -0.5) t))) (asin 1.0)))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= 0.62) {
tmp = asin((l * (pow(2.0, -0.5) / t)));
} 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 <= 0.62d0) then
tmp = asin((l * ((2.0d0 ** (-0.5d0)) / t)))
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 <= 0.62) {
tmp = Math.asin((l * (Math.pow(2.0, -0.5) / t)));
} else {
tmp = Math.asin(1.0);
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if l <= 0.62: tmp = math.asin((l * (math.pow(2.0, -0.5) / t))) else: tmp = math.asin(1.0) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (l <= 0.62) tmp = asin(Float64(l * Float64((2.0 ^ -0.5) / t))); else tmp = asin(1.0); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (l <= 0.62) tmp = asin((l * ((2.0 ^ -0.5) / t))); else tmp = asin(1.0); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, 0.62], N[ArcSin[N[(l * N[(N[Power[2.0, -0.5], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 0.62:\\
\;\;\;\;\sin^{-1} \left(\ell \cdot \frac{{2}^{-0.5}}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < 0.619999999999999996Initial program 80.8%
sqrt-div80.7%
add-sqr-sqrt80.7%
hypot-1-def80.8%
*-commutative80.8%
sqrt-prod80.7%
sqrt-pow197.7%
metadata-eval97.7%
pow197.7%
Applied egg-rr97.7%
Taylor expanded in Om around 0 96.9%
Taylor expanded in t around inf 40.8%
associate-/r*40.8%
div-inv40.8%
pow1/240.8%
pow-flip40.8%
metadata-eval40.8%
Applied egg-rr40.8%
associate-*l/40.8%
associate-*r/40.7%
Simplified40.7%
if 0.619999999999999996 < l Initial program 90.7%
Taylor expanded in t around 0 64.9%
unpow264.9%
unpow264.9%
times-frac73.9%
unpow273.9%
Simplified73.9%
Taylor expanded in Om around 0 73.3%
(FPCore (t l Om Omc) :precision binary64 (if (<= l 0.00016) (asin (/ l (* t (sqrt 2.0)))) (asin 1.0)))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= 0.00016) {
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 <= 0.00016d0) 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 <= 0.00016) {
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 <= 0.00016: 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 <= 0.00016) 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 <= 0.00016) tmp = asin((l / (t * sqrt(2.0)))); else tmp = asin(1.0); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, 0.00016], 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 0.00016:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < 1.60000000000000013e-4Initial program 80.8%
sqrt-div80.7%
add-sqr-sqrt80.7%
hypot-1-def80.8%
*-commutative80.8%
sqrt-prod80.7%
sqrt-pow197.7%
metadata-eval97.7%
pow197.7%
Applied egg-rr97.7%
Taylor expanded in Om around 0 96.9%
Taylor expanded in t around inf 40.8%
if 1.60000000000000013e-4 < l Initial program 90.7%
Taylor expanded in t around 0 64.9%
unpow264.9%
unpow264.9%
times-frac73.9%
unpow273.9%
Simplified73.9%
Taylor expanded in Om around 0 73.3%
(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 83.7%
Taylor expanded in t around 0 46.6%
unpow246.6%
unpow246.6%
times-frac52.1%
unpow252.1%
Simplified52.1%
Taylor expanded in Om around 0 51.7%
herbie shell --seed 2024159
(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)))))))