
(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 9 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.0%
sqrt-div85.0%
div-inv85.0%
add-sqr-sqrt85.0%
hypot-1-def84.9%
*-commutative84.9%
sqrt-prod84.9%
unpow284.9%
sqrt-prod56.2%
add-sqr-sqrt98.6%
Applied egg-rr98.6%
associate-*r/98.6%
*-rgt-identity98.6%
associate-*l/98.6%
associate-/l*98.7%
Simplified98.7%
Final simplification98.7%
(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.0%
sqrt-div85.0%
div-inv85.0%
add-sqr-sqrt85.0%
hypot-1-def84.9%
*-commutative84.9%
sqrt-prod84.9%
unpow284.9%
sqrt-prod56.2%
add-sqr-sqrt98.6%
Applied egg-rr98.6%
associate-*r/98.6%
*-rgt-identity98.6%
associate-*l/98.6%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in Om around 0 97.7%
Final simplification97.7%
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) 1e+141)
(asin
(sqrt
(/
(- 1.0 (/ Om (* Omc (/ Omc Om))))
(+ 1.0 (* 2.0 (/ 1.0 (* (/ l t) (/ l t))))))))
(asin (* (/ 1.0 t) (/ l (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 1e+141) {
tmp = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t))))))));
} 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 ((t / l) <= 1d+141) then
tmp = asin(sqrt(((1.0d0 - (om / (omc * (omc / om)))) / (1.0d0 + (2.0d0 * (1.0d0 / ((l / t) * (l / t))))))))
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 ((t / l) <= 1e+141) {
tmp = Math.asin(Math.sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t))))))));
} else {
tmp = Math.asin(((1.0 / t) * (l / Math.sqrt(2.0))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 1e+141: tmp = math.asin(math.sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t)))))))) else: tmp = math.asin(((1.0 / t) * (l / math.sqrt(2.0)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= 1e+141) tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Om / Float64(Omc * Float64(Omc / Om)))) / Float64(1.0 + Float64(2.0 * Float64(1.0 / Float64(Float64(l / t) * Float64(l / t)))))))); 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 ((t / l) <= 1e+141) tmp = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t)))))))); else tmp = asin(((1.0 / t) * (l / sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], 1e+141], 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[(1.0 / N[(N[(l / t), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}\;\frac{t}{\ell} \leq 10^{+141}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{Om}{Omc \cdot \frac{Omc}{Om}}}{1 + 2 \cdot \frac{1}{\frac{\ell}{t} \cdot \frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{1}{t} \cdot \frac{\ell}{\sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 1.00000000000000002e141Initial program 90.5%
unpow290.5%
clear-num90.5%
clear-num90.5%
frac-times90.5%
metadata-eval90.5%
Applied egg-rr90.5%
unpow259.5%
clear-num59.5%
frac-times59.5%
*-un-lft-identity59.5%
Applied egg-rr90.5%
if 1.00000000000000002e141 < (/.f64 t l) Initial program 41.7%
sqrt-div41.7%
add-sqr-sqrt41.7%
hypot-1-def41.7%
*-commutative41.7%
sqrt-prod41.7%
unpow241.7%
sqrt-prod99.4%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
Taylor expanded in Om around 0 97.0%
Taylor expanded in t around inf 97.0%
*-un-lft-identity97.0%
times-frac97.0%
Applied egg-rr97.0%
Final simplification91.3%
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) 5e+71)
(asin
(sqrt
(/
(- 1.0 (/ Om (* Omc (/ Omc Om))))
(+ 1.0 (* 2.0 (/ (* t (/ t l)) l))))))
(asin (/ l (* t (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 5e+71) {
tmp = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t * (t / l)) / l))))));
} 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) <= 5d+71) then
tmp = asin(sqrt(((1.0d0 - (om / (omc * (omc / om)))) / (1.0d0 + (2.0d0 * ((t * (t / l)) / l))))))
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) <= 5e+71) {
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(2.0))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 5e+71: 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(2.0)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= 5e+71) 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(l / Float64(t * sqrt(2.0)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= 5e+71) tmp = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t * (t / l)) / l)))))); else tmp = asin((l / (t * sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], 5e+71], 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[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 5 \cdot 10^{+71}:\\
\;\;\;\;\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}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 4.99999999999999972e71Initial program 89.8%
unpow289.8%
associate-*r/89.8%
Applied egg-rr89.8%
unpow263.9%
clear-num63.9%
frac-times63.9%
*-un-lft-identity63.9%
Applied egg-rr89.8%
if 4.99999999999999972e71 < (/.f64 t l) Initial program 63.1%
sqrt-div63.1%
add-sqr-sqrt63.1%
hypot-1-def63.1%
*-commutative63.1%
sqrt-prod63.0%
unpow263.0%
sqrt-prod99.2%
add-sqr-sqrt99.4%
Applied egg-rr99.4%
Taylor expanded in Om around 0 97.8%
Taylor expanded in t around inf 97.8%
Final simplification91.3%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) 0.1) (asin (sqrt (- 1.0 (/ Om (* Omc (/ Omc Om)))))) (asin (/ l (* t (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 0.1) {
tmp = asin(sqrt((1.0 - (Om / (Omc * (Omc / Om))))));
} 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.1d0) then
tmp = asin(sqrt((1.0d0 - (om / (omc * (omc / om))))))
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.1) {
tmp = Math.asin(Math.sqrt((1.0 - (Om / (Omc * (Omc / Om))))));
} else {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 0.1: tmp = math.asin(math.sqrt((1.0 - (Om / (Omc * (Omc / Om)))))) 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.1) tmp = asin(sqrt(Float64(1.0 - Float64(Om / Float64(Omc * Float64(Omc / Om)))))); else tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= 0.1) tmp = asin(sqrt((1.0 - (Om / (Omc * (Omc / Om)))))); 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.1], N[ArcSin[N[Sqrt[N[(1.0 - N[(Om / N[(Omc * N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 0.1:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{Om}{Omc \cdot \frac{Omc}{Om}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 0.10000000000000001Initial program 89.1%
Taylor expanded in t around 0 59.9%
unpow259.9%
unpow259.9%
times-frac68.1%
unpow268.1%
Simplified68.1%
unpow268.1%
clear-num68.1%
frac-times68.1%
*-un-lft-identity68.1%
Applied egg-rr68.1%
if 0.10000000000000001 < (/.f64 t l) Initial program 71.9%
sqrt-div72.0%
add-sqr-sqrt72.0%
hypot-1-def72.0%
*-commutative72.0%
sqrt-prod71.9%
unpow271.9%
sqrt-prod99.2%
add-sqr-sqrt99.4%
Applied egg-rr99.4%
Taylor expanded in Om around 0 97.0%
Taylor expanded in t around inf 95.8%
Final simplification74.7%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) 0.1) (asin (- 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.1) {
tmp = asin((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.1d0) then
tmp = asin((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.1) {
tmp = Math.asin((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.1: tmp = math.asin((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.1) tmp = asin(Float64(1.0 - (Float64(t / l) ^ 2.0))); else tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= 0.1) tmp = asin((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.1], N[ArcSin[N[(1.0 - N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 0.1:\\
\;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 0.10000000000000001Initial program 89.1%
sqrt-div89.0%
div-inv89.0%
add-sqr-sqrt89.0%
hypot-1-def89.0%
*-commutative89.0%
sqrt-prod89.0%
unpow289.0%
sqrt-prod42.8%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
associate-*r/98.4%
*-rgt-identity98.4%
associate-*l/98.4%
associate-/l*98.4%
Simplified98.4%
Taylor expanded in Om around 0 97.9%
Taylor expanded in t around 0 60.9%
associate-*r/60.9%
*-commutative60.9%
unpow260.9%
rem-square-sqrt60.9%
associate-*r*60.9%
metadata-eval60.9%
*-commutative60.9%
associate-*l/60.9%
*-commutative60.9%
mul-1-neg60.9%
unsub-neg60.9%
unpow260.9%
unpow260.9%
times-frac66.2%
unpow266.2%
Simplified66.2%
if 0.10000000000000001 < (/.f64 t l) Initial program 71.9%
sqrt-div72.0%
add-sqr-sqrt72.0%
hypot-1-def72.0%
*-commutative72.0%
sqrt-prod71.9%
unpow271.9%
sqrt-prod99.2%
add-sqr-sqrt99.4%
Applied egg-rr99.4%
Taylor expanded in Om around 0 97.0%
Taylor expanded in t around inf 95.8%
Final simplification73.2%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) 0.1) (asin (/ 1.0 (+ 1.0 (* 0.5 (* 2.0 (* (/ t l) (/ t l))))))) (asin (/ l (* t (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 0.1) {
tmp = asin((1.0 / (1.0 + (0.5 * (2.0 * ((t / l) * (t / l)))))));
} 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.1d0) then
tmp = asin((1.0d0 / (1.0d0 + (0.5d0 * (2.0d0 * ((t / l) * (t / l)))))))
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.1) {
tmp = Math.asin((1.0 / (1.0 + (0.5 * (2.0 * ((t / l) * (t / l)))))));
} else {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 0.1: tmp = math.asin((1.0 / (1.0 + (0.5 * (2.0 * ((t / l) * (t / l))))))) 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.1) tmp = asin(Float64(1.0 / Float64(1.0 + Float64(0.5 * Float64(2.0 * Float64(Float64(t / l) * Float64(t / l))))))); else tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= 0.1) tmp = asin((1.0 / (1.0 + (0.5 * (2.0 * ((t / l) * (t / l))))))); 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.1], N[ArcSin[N[(1.0 / N[(1.0 + N[(0.5 * N[(2.0 * N[(N[(t / l), $MachinePrecision] * N[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 0.1:\\
\;\;\;\;\sin^{-1} \left(\frac{1}{1 + 0.5 \cdot \left(2 \cdot \left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 0.10000000000000001Initial program 89.1%
sqrt-div89.0%
add-sqr-sqrt89.0%
hypot-1-def89.0%
*-commutative89.0%
sqrt-prod89.0%
unpow289.0%
sqrt-prod42.8%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
Taylor expanded in Om around 0 97.9%
Taylor expanded in t around 0 68.7%
*-commutative68.7%
unpow268.7%
rem-square-sqrt68.7%
associate-*r/68.7%
unpow268.7%
unpow268.7%
times-frac74.4%
unpow274.4%
Simplified74.4%
unpow274.4%
Applied egg-rr74.4%
if 0.10000000000000001 < (/.f64 t l) Initial program 71.9%
sqrt-div72.0%
add-sqr-sqrt72.0%
hypot-1-def72.0%
*-commutative72.0%
sqrt-prod71.9%
unpow271.9%
sqrt-prod99.2%
add-sqr-sqrt99.4%
Applied egg-rr99.4%
Taylor expanded in Om around 0 97.0%
Taylor expanded in t around inf 95.8%
Final simplification79.5%
(FPCore (t l Om Omc) :precision binary64 (asin (/ 1.0 (+ 1.0 (* 0.5 (* 2.0 (* (/ t l) (/ t l))))))))
double code(double t, double l, double Om, double Omc) {
return asin((1.0 / (1.0 + (0.5 * (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((1.0d0 / (1.0d0 + (0.5d0 * (2.0d0 * ((t / l) * (t / l)))))))
end function
public static double code(double t, double l, double Om, double Omc) {
return Math.asin((1.0 / (1.0 + (0.5 * (2.0 * ((t / l) * (t / l)))))));
}
def code(t, l, Om, Omc): return math.asin((1.0 / (1.0 + (0.5 * (2.0 * ((t / l) * (t / l)))))))
function code(t, l, Om, Omc) return asin(Float64(1.0 / Float64(1.0 + Float64(0.5 * Float64(2.0 * Float64(Float64(t / l) * Float64(t / l))))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((1.0 / (1.0 + (0.5 * (2.0 * ((t / l) * (t / l))))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 / N[(1.0 + N[(0.5 * N[(2.0 * N[(N[(t / l), $MachinePrecision] * N[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{1}{1 + 0.5 \cdot \left(2 \cdot \left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)\right)}\right)
\end{array}
Initial program 85.0%
sqrt-div85.0%
add-sqr-sqrt85.0%
hypot-1-def85.0%
*-commutative85.0%
sqrt-prod84.9%
unpow284.9%
sqrt-prod56.2%
add-sqr-sqrt98.6%
Applied egg-rr98.6%
Taylor expanded in Om around 0 97.7%
Taylor expanded in t around 0 57.7%
*-commutative57.7%
unpow257.7%
rem-square-sqrt57.7%
associate-*r/57.7%
unpow257.7%
unpow257.7%
times-frac62.3%
unpow262.3%
Simplified62.3%
unpow262.3%
Applied egg-rr62.3%
Final simplification62.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 85.0%
Taylor expanded in t around 0 46.8%
unpow246.8%
unpow246.8%
times-frac53.2%
unpow253.2%
Simplified53.2%
Taylor expanded in Om around 0 52.9%
Final simplification52.9%
herbie shell --seed 2024044
(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)))))))