
(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}
NOTE: t should be positive before calling this function
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -5e+101)
(asin (/ (- l) (* t (sqrt 2.0))))
(if (<= (/ t l) 10000000.0)
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ t (* l (/ l t))))))))
(asin (* (/ 1.0 t) (/ l (sqrt 2.0)))))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -5e+101) {
tmp = asin((-l / (t * sqrt(2.0))));
} else if ((t / l) <= 10000000.0) {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t / (l * (l / t))))))));
} else {
tmp = asin(((1.0 / t) * (l / sqrt(2.0))));
}
return tmp;
}
NOTE: t should be positive before calling this function
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+101)) then
tmp = asin((-l / (t * sqrt(2.0d0))))
else if ((t / l) <= 10000000.0d0) then
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * (t / (l * (l / t))))))))
else
tmp = asin(((1.0d0 / t) * (l / sqrt(2.0d0))))
end if
code = tmp
end function
t = Math.abs(t);
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -5e+101) {
tmp = Math.asin((-l / (t * Math.sqrt(2.0))));
} else if ((t / l) <= 10000000.0) {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t / (l * (l / t))))))));
} else {
tmp = Math.asin(((1.0 / t) * (l / Math.sqrt(2.0))));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -5e+101: tmp = math.asin((-l / (t * math.sqrt(2.0)))) elif (t / l) <= 10000000.0: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t / (l * (l / t)))))))) else: tmp = math.asin(((1.0 / t) * (l / math.sqrt(2.0)))) return tmp
t = abs(t) function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -5e+101) tmp = asin(Float64(Float64(-l) / Float64(t * sqrt(2.0)))); elseif (Float64(t / l) <= 10000000.0) tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(t / Float64(l * Float64(l / t)))))))); else tmp = asin(Float64(Float64(1.0 / t) * Float64(l / sqrt(2.0)))); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -5e+101) tmp = asin((-l / (t * sqrt(2.0)))); elseif ((t / l) <= 10000000.0) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t / (l * (l / t)))))))); else tmp = asin(((1.0 / t) * (l / sqrt(2.0)))); end tmp_2 = tmp; end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -5e+101], N[ArcSin[N[((-l) / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 10000000.0], 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[(t / N[(l * 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}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -5 \cdot 10^{+101}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 10000000:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{t}{\ell \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) < -4.99999999999999989e101Initial program 53.8%
sqrt-div53.8%
div-inv53.8%
add-sqr-sqrt53.8%
hypot-1-def53.8%
*-commutative53.8%
sqrt-prod53.7%
unpow253.7%
sqrt-prod0.0%
add-sqr-sqrt98.6%
Applied egg-rr98.6%
associate-*r/98.6%
*-rgt-identity98.6%
Simplified98.6%
Taylor expanded in Om around 0 98.6%
Taylor expanded in t around -inf 99.5%
associate-*r/99.5%
neg-mul-199.5%
Simplified99.5%
if -4.99999999999999989e101 < (/.f64 t l) < 1e7Initial program 97.9%
unpow297.9%
clear-num97.9%
frac-times97.9%
*-un-lft-identity97.9%
Applied egg-rr97.9%
unpow297.9%
clear-num97.9%
un-div-inv97.9%
Applied egg-rr97.9%
if 1e7 < (/.f64 t l) Initial program 70.5%
sqrt-div70.6%
div-inv70.6%
add-sqr-sqrt70.6%
hypot-1-def70.6%
*-commutative70.6%
sqrt-prod70.4%
unpow270.4%
sqrt-prod98.8%
add-sqr-sqrt99.1%
Applied egg-rr99.1%
associate-*r/99.1%
*-rgt-identity99.1%
Simplified99.1%
Taylor expanded in Om around 0 97.7%
Taylor expanded in t around inf 98.2%
*-un-lft-identity98.2%
times-frac98.2%
Applied egg-rr98.2%
Final simplification98.3%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (asin (/ (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (hypot 1.0 (* (/ t l) (sqrt 2.0))))))
t = abs(t);
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)))));
}
t = Math.abs(t);
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)))));
}
t = abs(t) 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)))))
t = abs(t) 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
t = abs(t) 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
NOTE: t should be positive before calling this function 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}
t = |t|\\
\\
\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.9%
sqrt-div83.9%
div-inv83.9%
add-sqr-sqrt83.8%
hypot-1-def83.9%
*-commutative83.9%
sqrt-prod83.8%
unpow283.8%
sqrt-prod54.1%
add-sqr-sqrt98.3%
Applied egg-rr98.3%
associate-*r/98.3%
*-rgt-identity98.3%
Simplified98.3%
Final simplification98.3%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (let* ((t_1 (pow (/ t l) 2.0))) (if (<= t_1 1.0) (asin (- 1.0 t_1)) (asin (/ l (* t (sqrt 2.0)))))))
t = abs(t);
double code(double t, double l, double Om, double Omc) {
double t_1 = pow((t / l), 2.0);
double tmp;
if (t_1 <= 1.0) {
tmp = asin((1.0 - t_1));
} else {
tmp = asin((l / (t * sqrt(2.0))));
}
return tmp;
}
NOTE: t should be positive before calling this function
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 = (t / l) ** 2.0d0
if (t_1 <= 1.0d0) then
tmp = asin((1.0d0 - t_1))
else
tmp = asin((l / (t * sqrt(2.0d0))))
end if
code = tmp
end function
t = Math.abs(t);
public static double code(double t, double l, double Om, double Omc) {
double t_1 = Math.pow((t / l), 2.0);
double tmp;
if (t_1 <= 1.0) {
tmp = Math.asin((1.0 - t_1));
} else {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): t_1 = math.pow((t / l), 2.0) tmp = 0 if t_1 <= 1.0: tmp = math.asin((1.0 - t_1)) else: tmp = math.asin((l / (t * math.sqrt(2.0)))) return tmp
t = abs(t) function code(t, l, Om, Omc) t_1 = Float64(t / l) ^ 2.0 tmp = 0.0 if (t_1 <= 1.0) tmp = asin(Float64(1.0 - t_1)); else tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) t_1 = (t / l) ^ 2.0; tmp = 0.0; if (t_1 <= 1.0) tmp = asin((1.0 - t_1)); else tmp = asin((l / (t * sqrt(2.0)))); end tmp_2 = tmp; end
NOTE: t should be positive before calling this function
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$1, 1.0], N[ArcSin[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
t_1 := {\left(\frac{t}{\ell}\right)}^{2}\\
\mathbf{if}\;t_1 \leq 1:\\
\;\;\;\;\sin^{-1} \left(1 - t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if (pow.f64 (/.f64 t l) 2) < 1Initial program 97.7%
sqrt-div97.6%
div-inv97.6%
add-sqr-sqrt97.6%
hypot-1-def97.6%
*-commutative97.6%
sqrt-prod97.6%
unpow297.6%
sqrt-prod57.9%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.6%
*-rgt-identity97.6%
Simplified97.6%
Taylor expanded in Om around 0 96.7%
Taylor expanded in t around 0 96.7%
associate-/l*96.7%
Simplified96.7%
Taylor expanded in t around 0 80.0%
associate-*r/80.0%
*-commutative80.0%
unpow280.0%
rem-square-sqrt80.0%
associate-*r*80.0%
metadata-eval80.0%
associate-*r/80.0%
mul-1-neg80.0%
unsub-neg80.0%
unpow280.0%
unpow280.0%
times-frac95.5%
unpow295.5%
Simplified95.5%
if 1 < (pow.f64 (/.f64 t l) 2) Initial program 69.7%
sqrt-div69.6%
div-inv69.6%
add-sqr-sqrt69.6%
hypot-1-def69.6%
*-commutative69.6%
sqrt-prod69.5%
unpow269.5%
sqrt-prod50.2%
add-sqr-sqrt98.9%
Applied egg-rr98.9%
associate-*r/98.9%
*-rgt-identity98.9%
Simplified98.9%
Taylor expanded in Om around 0 98.2%
Taylor expanded in t around inf 60.3%
Final simplification78.2%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (asin (/ 1.0 (hypot 1.0 (* (/ t l) (sqrt 2.0))))))
t = abs(t);
double code(double t, double l, double Om, double Omc) {
return asin((1.0 / hypot(1.0, ((t / l) * sqrt(2.0)))));
}
t = Math.abs(t);
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)))));
}
t = abs(t) def code(t, l, Om, Omc): return math.asin((1.0 / math.hypot(1.0, ((t / l) * math.sqrt(2.0)))))
t = abs(t) function code(t, l, Om, Omc) return asin(Float64(1.0 / hypot(1.0, Float64(Float64(t / l) * sqrt(2.0))))) end
t = abs(t) function tmp = code(t, l, Om, Omc) tmp = asin((1.0 / hypot(1.0, ((t / l) * sqrt(2.0))))); end
NOTE: t should be positive before calling this function 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}
t = |t|\\
\\
\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Initial program 83.9%
sqrt-div83.9%
div-inv83.9%
add-sqr-sqrt83.8%
hypot-1-def83.9%
*-commutative83.9%
sqrt-prod83.8%
unpow283.8%
sqrt-prod54.1%
add-sqr-sqrt98.3%
Applied egg-rr98.3%
associate-*r/98.3%
*-rgt-identity98.3%
Simplified98.3%
Taylor expanded in Om around 0 97.4%
Final simplification97.4%
NOTE: t should be positive before calling this function
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -0.5)
(asin (/ (- l) (* t (sqrt 2.0))))
(if (<= (/ t l) 0.01)
(asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(asin (* (/ 1.0 t) (/ l (sqrt 2.0)))))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -0.5) {
tmp = asin((-l / (t * sqrt(2.0))));
} else if ((t / l) <= 0.01) {
tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else {
tmp = asin(((1.0 / t) * (l / sqrt(2.0))));
}
return tmp;
}
NOTE: t should be positive before calling this function
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((-l / (t * sqrt(2.0d0))))
else if ((t / l) <= 0.01d0) 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
t = Math.abs(t);
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -0.5) {
tmp = Math.asin((-l / (t * Math.sqrt(2.0))));
} else if ((t / l) <= 0.01) {
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;
}
t = abs(t) def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -0.5: tmp = math.asin((-l / (t * math.sqrt(2.0)))) elif (t / l) <= 0.01: 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
t = abs(t) function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -0.5) tmp = asin(Float64(Float64(-l) / Float64(t * sqrt(2.0)))); elseif (Float64(t / l) <= 0.01) 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
t = abs(t) function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -0.5) tmp = asin((-l / (t * sqrt(2.0)))); elseif ((t / l) <= 0.01) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); else tmp = asin(((1.0 / t) * (l / sqrt(2.0)))); end tmp_2 = tmp; end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -0.5], N[ArcSin[N[((-l) / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.01], 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}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -0.5:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.01:\\
\;\;\;\;\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 (/.f64 t l) < -0.5Initial program 68.3%
sqrt-div68.3%
div-inv68.3%
add-sqr-sqrt68.3%
hypot-1-def68.3%
*-commutative68.3%
sqrt-prod68.1%
unpow268.1%
sqrt-prod0.0%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate-*r/98.7%
*-rgt-identity98.7%
Simplified98.7%
Taylor expanded in Om around 0 98.7%
Taylor expanded in t around -inf 95.9%
associate-*r/95.9%
neg-mul-195.9%
Simplified95.9%
if -0.5 < (/.f64 t l) < 0.0100000000000000002Initial program 97.7%
Taylor expanded in t around 0 83.9%
unpow283.9%
unpow283.9%
times-frac96.4%
unpow296.4%
Simplified96.4%
unpow297.7%
clear-num97.7%
un-div-inv97.7%
Applied egg-rr96.4%
if 0.0100000000000000002 < (/.f64 t l) Initial program 71.4%
sqrt-div71.5%
div-inv71.5%
add-sqr-sqrt71.4%
hypot-1-def71.4%
*-commutative71.4%
sqrt-prod71.3%
unpow271.3%
sqrt-prod98.8%
add-sqr-sqrt99.1%
Applied egg-rr99.1%
associate-*r/99.1%
*-rgt-identity99.1%
Simplified99.1%
Taylor expanded in Om around 0 97.7%
Taylor expanded in t around inf 97.7%
*-un-lft-identity97.7%
times-frac97.7%
Applied egg-rr97.7%
Final simplification96.6%
NOTE: t should be positive before calling this function
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -1.0)
(asin (/ (- l) (* t (sqrt 2.0))))
(if (<= (/ t l) 0.01)
(asin (- 1.0 (pow (/ t l) 2.0)))
(asin (* (/ 1.0 t) (/ l (sqrt 2.0)))))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -1.0) {
tmp = asin((-l / (t * sqrt(2.0))));
} else if ((t / l) <= 0.01) {
tmp = asin((1.0 - pow((t / l), 2.0)));
} else {
tmp = asin(((1.0 / t) * (l / sqrt(2.0))));
}
return tmp;
}
NOTE: t should be positive before calling this function
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) <= (-1.0d0)) then
tmp = asin((-l / (t * sqrt(2.0d0))))
else if ((t / l) <= 0.01d0) then
tmp = asin((1.0d0 - ((t / l) ** 2.0d0)))
else
tmp = asin(((1.0d0 / t) * (l / sqrt(2.0d0))))
end if
code = tmp
end function
t = Math.abs(t);
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -1.0) {
tmp = Math.asin((-l / (t * Math.sqrt(2.0))));
} else if ((t / l) <= 0.01) {
tmp = Math.asin((1.0 - Math.pow((t / l), 2.0)));
} else {
tmp = Math.asin(((1.0 / t) * (l / Math.sqrt(2.0))));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -1.0: tmp = math.asin((-l / (t * math.sqrt(2.0)))) elif (t / l) <= 0.01: tmp = math.asin((1.0 - math.pow((t / l), 2.0))) else: tmp = math.asin(((1.0 / t) * (l / math.sqrt(2.0)))) return tmp
t = abs(t) function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -1.0) tmp = asin(Float64(Float64(-l) / Float64(t * sqrt(2.0)))); elseif (Float64(t / l) <= 0.01) tmp = asin(Float64(1.0 - (Float64(t / l) ^ 2.0))); else tmp = asin(Float64(Float64(1.0 / t) * Float64(l / sqrt(2.0)))); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -1.0) tmp = asin((-l / (t * sqrt(2.0)))); elseif ((t / l) <= 0.01) tmp = asin((1.0 - ((t / l) ^ 2.0))); else tmp = asin(((1.0 / t) * (l / sqrt(2.0)))); end tmp_2 = tmp; end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -1.0], N[ArcSin[N[((-l) / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.01], N[ArcSin[N[(1.0 - N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(1.0 / t), $MachinePrecision] * N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -1:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.01:\\
\;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{1}{t} \cdot \frac{\ell}{\sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1Initial program 67.9%
sqrt-div67.8%
div-inv67.8%
add-sqr-sqrt67.8%
hypot-1-def67.8%
*-commutative67.8%
sqrt-prod67.6%
unpow267.6%
sqrt-prod0.0%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate-*r/98.7%
*-rgt-identity98.7%
Simplified98.7%
Taylor expanded in Om around 0 98.7%
Taylor expanded in t around -inf 97.2%
associate-*r/97.2%
neg-mul-197.2%
Simplified97.2%
if -1 < (/.f64 t l) < 0.0100000000000000002Initial program 97.7%
sqrt-div97.6%
div-inv97.6%
add-sqr-sqrt97.6%
hypot-1-def97.6%
*-commutative97.6%
sqrt-prod97.6%
unpow297.6%
sqrt-prod57.9%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.6%
*-rgt-identity97.6%
Simplified97.6%
Taylor expanded in Om around 0 96.7%
Taylor expanded in t around 0 96.7%
associate-/l*96.7%
Simplified96.7%
Taylor expanded in t around 0 80.0%
associate-*r/80.0%
*-commutative80.0%
unpow280.0%
rem-square-sqrt80.0%
associate-*r*80.0%
metadata-eval80.0%
associate-*r/80.0%
mul-1-neg80.0%
unsub-neg80.0%
unpow280.0%
unpow280.0%
times-frac95.5%
unpow295.5%
Simplified95.5%
if 0.0100000000000000002 < (/.f64 t l) Initial program 71.4%
sqrt-div71.5%
div-inv71.5%
add-sqr-sqrt71.4%
hypot-1-def71.4%
*-commutative71.4%
sqrt-prod71.3%
unpow271.3%
sqrt-prod98.8%
add-sqr-sqrt99.1%
Applied egg-rr99.1%
associate-*r/99.1%
*-rgt-identity99.1%
Simplified99.1%
Taylor expanded in Om around 0 97.7%
Taylor expanded in t around inf 97.7%
*-un-lft-identity97.7%
times-frac97.7%
Applied egg-rr97.7%
Final simplification96.5%
NOTE: t should be positive before calling this function
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0))))
(if (<= (/ t l) -1.0)
(asin (/ (- l) t_1))
(if (<= (/ t l) 0.01)
(asin (- 1.0 (pow (/ t l) 2.0)))
(asin (/ l t_1))))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double t_1 = t * sqrt(2.0);
double tmp;
if ((t / l) <= -1.0) {
tmp = asin((-l / t_1));
} else if ((t / l) <= 0.01) {
tmp = asin((1.0 - pow((t / l), 2.0)));
} else {
tmp = asin((l / t_1));
}
return tmp;
}
NOTE: t should be positive before calling this function
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 = t * sqrt(2.0d0)
if ((t / l) <= (-1.0d0)) then
tmp = asin((-l / t_1))
else if ((t / l) <= 0.01d0) then
tmp = asin((1.0d0 - ((t / l) ** 2.0d0)))
else
tmp = asin((l / t_1))
end if
code = tmp
end function
t = Math.abs(t);
public static double code(double t, double l, double Om, double Omc) {
double t_1 = t * Math.sqrt(2.0);
double tmp;
if ((t / l) <= -1.0) {
tmp = Math.asin((-l / t_1));
} else if ((t / l) <= 0.01) {
tmp = Math.asin((1.0 - Math.pow((t / l), 2.0)));
} else {
tmp = Math.asin((l / t_1));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): t_1 = t * math.sqrt(2.0) tmp = 0 if (t / l) <= -1.0: tmp = math.asin((-l / t_1)) elif (t / l) <= 0.01: tmp = math.asin((1.0 - math.pow((t / l), 2.0))) else: tmp = math.asin((l / t_1)) return tmp
t = abs(t) function code(t, l, Om, Omc) t_1 = Float64(t * sqrt(2.0)) tmp = 0.0 if (Float64(t / l) <= -1.0) tmp = asin(Float64(Float64(-l) / t_1)); elseif (Float64(t / l) <= 0.01) tmp = asin(Float64(1.0 - (Float64(t / l) ^ 2.0))); else tmp = asin(Float64(l / t_1)); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) t_1 = t * sqrt(2.0); tmp = 0.0; if ((t / l) <= -1.0) tmp = asin((-l / t_1)); elseif ((t / l) <= 0.01) tmp = asin((1.0 - ((t / l) ^ 2.0))); else tmp = asin((l / t_1)); end tmp_2 = tmp; end
NOTE: t should be positive before calling this function
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t / l), $MachinePrecision], -1.0], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.01], N[ArcSin[N[(1.0 - N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / t$95$1), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
t_1 := t \cdot \sqrt{2}\\
\mathbf{if}\;\frac{t}{\ell} \leq -1:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.01:\\
\;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1Initial program 67.9%
sqrt-div67.8%
div-inv67.8%
add-sqr-sqrt67.8%
hypot-1-def67.8%
*-commutative67.8%
sqrt-prod67.6%
unpow267.6%
sqrt-prod0.0%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate-*r/98.7%
*-rgt-identity98.7%
Simplified98.7%
Taylor expanded in Om around 0 98.7%
Taylor expanded in t around -inf 97.2%
associate-*r/97.2%
neg-mul-197.2%
Simplified97.2%
if -1 < (/.f64 t l) < 0.0100000000000000002Initial program 97.7%
sqrt-div97.6%
div-inv97.6%
add-sqr-sqrt97.6%
hypot-1-def97.6%
*-commutative97.6%
sqrt-prod97.6%
unpow297.6%
sqrt-prod57.9%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
associate-*r/97.6%
*-rgt-identity97.6%
Simplified97.6%
Taylor expanded in Om around 0 96.7%
Taylor expanded in t around 0 96.7%
associate-/l*96.7%
Simplified96.7%
Taylor expanded in t around 0 80.0%
associate-*r/80.0%
*-commutative80.0%
unpow280.0%
rem-square-sqrt80.0%
associate-*r*80.0%
metadata-eval80.0%
associate-*r/80.0%
mul-1-neg80.0%
unsub-neg80.0%
unpow280.0%
unpow280.0%
times-frac95.5%
unpow295.5%
Simplified95.5%
if 0.0100000000000000002 < (/.f64 t l) Initial program 71.4%
sqrt-div71.5%
div-inv71.5%
add-sqr-sqrt71.4%
hypot-1-def71.4%
*-commutative71.4%
sqrt-prod71.3%
unpow271.3%
sqrt-prod98.8%
add-sqr-sqrt99.1%
Applied egg-rr99.1%
associate-*r/99.1%
*-rgt-identity99.1%
Simplified99.1%
Taylor expanded in Om around 0 97.7%
Taylor expanded in t around inf 97.7%
Final simplification96.5%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (if (<= l -1.1e-109) (asin 1.0) (if (<= l 27.0) (asin (/ l (* t (sqrt 2.0)))) (asin 1.0))))
t = abs(t);
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -1.1e-109) {
tmp = asin(1.0);
} else if (l <= 27.0) {
tmp = asin((l / (t * sqrt(2.0))));
} else {
tmp = asin(1.0);
}
return tmp;
}
NOTE: t should be positive before calling this function
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.1d-109)) then
tmp = asin(1.0d0)
else if (l <= 27.0d0) then
tmp = asin((l / (t * sqrt(2.0d0))))
else
tmp = asin(1.0d0)
end if
code = tmp
end function
t = Math.abs(t);
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -1.1e-109) {
tmp = Math.asin(1.0);
} else if (l <= 27.0) {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
} else {
tmp = Math.asin(1.0);
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): tmp = 0 if l <= -1.1e-109: tmp = math.asin(1.0) elif l <= 27.0: tmp = math.asin((l / (t * math.sqrt(2.0)))) else: tmp = math.asin(1.0) return tmp
t = abs(t) function code(t, l, Om, Omc) tmp = 0.0 if (l <= -1.1e-109) tmp = asin(1.0); elseif (l <= 27.0) tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); else tmp = asin(1.0); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (l <= -1.1e-109) tmp = asin(1.0); elseif (l <= 27.0) tmp = asin((l / (t * sqrt(2.0)))); else tmp = asin(1.0); end tmp_2 = tmp; end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := If[LessEqual[l, -1.1e-109], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, 27.0], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{-109}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;\ell \leq 27:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -1.1e-109 or 27 < l Initial program 88.3%
Taylor expanded in t around 0 61.3%
unpow261.3%
unpow261.3%
times-frac70.6%
unpow270.6%
Simplified70.6%
Taylor expanded in Om around 0 70.1%
if -1.1e-109 < l < 27Initial program 76.4%
sqrt-div76.3%
div-inv76.3%
add-sqr-sqrt76.3%
hypot-1-def76.3%
*-commutative76.3%
sqrt-prod76.3%
unpow276.3%
sqrt-prod46.7%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
associate-*r/97.8%
*-rgt-identity97.8%
Simplified97.8%
Taylor expanded in Om around 0 96.5%
Taylor expanded in t around inf 54.9%
Final simplification64.5%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (asin 1.0))
t = abs(t);
double code(double t, double l, double Om, double Omc) {
return asin(1.0);
}
NOTE: t should be positive before calling this function
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
t = Math.abs(t);
public static double code(double t, double l, double Om, double Omc) {
return Math.asin(1.0);
}
t = abs(t) def code(t, l, Om, Omc): return math.asin(1.0)
t = abs(t) function code(t, l, Om, Omc) return asin(1.0) end
t = abs(t) function tmp = code(t, l, Om, Omc) tmp = asin(1.0); end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := N[ArcSin[1.0], $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\sin^{-1} 1
\end{array}
Initial program 83.9%
Taylor expanded in t around 0 44.6%
unpow244.6%
unpow244.6%
times-frac51.2%
unpow251.2%
Simplified51.2%
Taylor expanded in Om around 0 50.7%
Final simplification50.7%
herbie shell --seed 2023320
(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)))))))