
(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 6 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
(let* ((t_1 (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(if (<= (/ t l) -2e+158)
(asin (* (/ (- l) t) (sqrt 0.5)))
(if (<= (/ t l) 1e+89)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (/ (/ t l) (/ l t)))))))
(asin (* (sqrt t_1) (* l (/ (sqrt 0.5) t))))))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
double tmp;
if ((t / l) <= -2e+158) {
tmp = asin(((-l / t) * sqrt(0.5)));
} else if ((t / l) <= 1e+89) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = asin((sqrt(t_1) * (l * (sqrt(0.5) / t))));
}
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 = 1.0d0 - ((om / omc) / (omc / om))
if ((t / l) <= (-2d+158)) then
tmp = asin(((-l / t) * sqrt(0.5d0)))
else if ((t / l) <= 1d+89) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
else
tmp = asin((sqrt(t_1) * (l * (sqrt(0.5d0) / t))))
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 = 1.0 - ((Om / Omc) / (Omc / Om));
double tmp;
if ((t / l) <= -2e+158) {
tmp = Math.asin(((-l / t) * Math.sqrt(0.5)));
} else if ((t / l) <= 1e+89) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = Math.asin((Math.sqrt(t_1) * (l * (Math.sqrt(0.5) / t))));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): t_1 = 1.0 - ((Om / Omc) / (Omc / Om)) tmp = 0 if (t / l) <= -2e+158: tmp = math.asin(((-l / t) * math.sqrt(0.5))) elif (t / l) <= 1e+89: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t))))))) else: tmp = math.asin((math.sqrt(t_1) * (l * (math.sqrt(0.5) / t)))) return tmp
t = abs(t) function code(t, l, Om, Omc) t_1 = Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) tmp = 0.0 if (Float64(t / l) <= -2e+158) tmp = asin(Float64(Float64(Float64(-l) / t) * sqrt(0.5))); elseif (Float64(t / l) <= 1e+89) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) / Float64(l / t))))))); else tmp = asin(Float64(sqrt(t_1) * Float64(l * Float64(sqrt(0.5) / t)))); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) t_1 = 1.0 - ((Om / Omc) / (Omc / Om)); tmp = 0.0; if ((t / l) <= -2e+158) tmp = asin(((-l / t) * sqrt(0.5))); elseif ((t / l) <= 1e+89) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t))))))); else tmp = asin((sqrt(t_1) * (l * (sqrt(0.5) / t)))); end tmp_2 = tmp; end
NOTE: t should be positive before calling this function
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t / l), $MachinePrecision], -2e+158], N[ArcSin[N[(N[((-l) / t), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 1e+89], N[ArcSin[N[Sqrt[N[(t$95$1 / N[(1.0 + N[(2.0 * N[(N[(t / l), $MachinePrecision] / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[(l * N[(N[Sqrt[0.5], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\\
\mathbf{if}\;\frac{t}{\ell} \leq -2 \cdot 10^{+158}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t} \cdot \sqrt{0.5}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 10^{+89}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t_1}{1 + 2 \cdot \frac{\frac{t}{\ell}}{\frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{t_1} \cdot \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1.99999999999999991e158Initial program 52.7%
unpow252.7%
Applied egg-rr52.7%
Taylor expanded in t around -inf 87.5%
associate-*r*87.5%
associate-*r/87.5%
neg-mul-187.5%
distribute-rgt-neg-in87.5%
associate-*l/87.7%
unpow287.7%
associate-/l/91.4%
unpow291.4%
associate-*r/99.7%
associate-*l/99.7%
unpow299.7%
Simplified99.7%
unpow299.7%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in Om around 0 97.8%
associate-*l/98.0%
associate-*r*98.0%
associate-*r/98.0%
neg-mul-198.0%
Simplified98.0%
if -1.99999999999999991e158 < (/.f64 t l) < 9.99999999999999995e88Initial program 97.8%
unpow297.8%
Applied egg-rr97.8%
unpow214.2%
clear-num14.2%
un-div-inv14.2%
Applied egg-rr97.8%
associate-*r/95.1%
associate-/l*97.8%
Applied egg-rr97.8%
if 9.99999999999999995e88 < (/.f64 t l) Initial program 59.8%
unpow259.8%
Applied egg-rr59.8%
Taylor expanded in t around inf 87.0%
*-commutative87.0%
unpow287.0%
associate-/l/92.0%
unpow292.0%
associate-*r/99.5%
associate-*l/99.5%
unpow299.5%
associate-*r/99.7%
Simplified99.7%
unpow244.6%
clear-num44.6%
un-div-inv44.6%
Applied egg-rr99.7%
Final simplification98.1%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (asin (/ (/ (sqrt (- 1.0 (pow (/ Om Omc) 4.0))) (hypot 1.0 (/ t (/ l (sqrt 2.0))))) (sqrt (+ 1.0 (pow (/ Om Omc) 2.0))))))
t = abs(t);
double code(double t, double l, double Om, double Omc) {
return asin(((sqrt((1.0 - pow((Om / Omc), 4.0))) / hypot(1.0, (t / (l / sqrt(2.0))))) / sqrt((1.0 + pow((Om / Omc), 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), 4.0))) / Math.hypot(1.0, (t / (l / Math.sqrt(2.0))))) / Math.sqrt((1.0 + Math.pow((Om / Omc), 2.0)))));
}
t = abs(t) def code(t, l, Om, Omc): return math.asin(((math.sqrt((1.0 - math.pow((Om / Omc), 4.0))) / math.hypot(1.0, (t / (l / math.sqrt(2.0))))) / math.sqrt((1.0 + math.pow((Om / Omc), 2.0)))))
t = abs(t) function code(t, l, Om, Omc) return asin(Float64(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 4.0))) / hypot(1.0, Float64(t / Float64(l / sqrt(2.0))))) / sqrt(Float64(1.0 + (Float64(Om / Omc) ^ 2.0))))) end
t = abs(t) function tmp = code(t, l, Om, Omc) tmp = asin(((sqrt((1.0 - ((Om / Omc) ^ 4.0))) / hypot(1.0, (t / (l / sqrt(2.0))))) / sqrt((1.0 + ((Om / Omc) ^ 2.0))))); end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := N[ArcSin[N[(N[(N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(t / N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(1.0 + N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\sin^{-1} \left(\frac{\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{4}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}}{\sqrt{1 + {\left(\frac{Om}{Omc}\right)}^{2}}}\right)
\end{array}
Initial program 84.6%
sqrt-div84.6%
flip--84.6%
sqrt-div84.6%
associate-/l/84.6%
metadata-eval84.6%
pow-sqr84.6%
metadata-eval84.6%
Applied egg-rr98.1%
associate-/r*98.1%
associate-*l/98.1%
associate-/l*98.2%
Simplified98.2%
Final simplification98.2%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (asin (/ (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))) (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 - ((Om / Omc) / (Omc / Om)))) / 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 - ((Om / Omc) / (Omc / Om)))) / 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 - ((Om / Omc) / (Omc / Om)))) / 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(Float64(Om / Omc) / Float64(Omc / Om)))) / hypot(1.0, Float64(t / Float64(l / sqrt(2.0)))))) end
t = abs(t) function tmp = code(t, l, Om, Omc) tmp = asin((sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / hypot(1.0, (t / (l / sqrt(2.0)))))); end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := N[ArcSin[N[(N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + N[(t / N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\sin^{-1} \left(\frac{\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)
\end{array}
Initial program 84.6%
sqrt-div84.6%
add-sqr-sqrt84.6%
hypot-1-def84.6%
*-commutative84.6%
sqrt-prod84.5%
unpow284.5%
sqrt-prod50.9%
add-sqr-sqrt98.1%
Applied egg-rr98.1%
associate-*l/98.1%
associate-/l*98.1%
Simplified98.1%
unpow232.6%
clear-num32.6%
un-div-inv32.6%
Applied egg-rr98.1%
Final simplification98.1%
NOTE: t should be positive before calling this function
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -2e+158)
(asin (* (/ (- l) t) (sqrt 0.5)))
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (* (/ t l) (/ t l)))))))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -2e+158) {
tmp = asin(((-l / t) * sqrt(0.5)));
} else {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l)))))));
}
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) <= (-2d+158)) then
tmp = asin(((-l / t) * sqrt(0.5d0)))
else
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t / l) * (t / l)))))))
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) <= -2e+158) {
tmp = Math.asin(((-l / t) * Math.sqrt(0.5)));
} else {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l)))))));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -2e+158: tmp = math.asin(((-l / t) * math.sqrt(0.5))) else: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l))))))) return tmp
t = abs(t) function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -2e+158) tmp = asin(Float64(Float64(Float64(-l) / t) * sqrt(0.5))); 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(t / l))))))); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -2e+158) tmp = asin(((-l / t) * sqrt(0.5))); else tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l))))))); 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], -2e+158], N[ArcSin[N[(N[((-l) / t), $MachinePrecision] * N[Sqrt[0.5], $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[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -2 \cdot 10^{+158}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t} \cdot \sqrt{0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1.99999999999999991e158Initial program 52.7%
unpow252.7%
Applied egg-rr52.7%
Taylor expanded in t around -inf 87.5%
associate-*r*87.5%
associate-*r/87.5%
neg-mul-187.5%
distribute-rgt-neg-in87.5%
associate-*l/87.7%
unpow287.7%
associate-/l/91.4%
unpow291.4%
associate-*r/99.7%
associate-*l/99.7%
unpow299.7%
Simplified99.7%
unpow299.7%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in Om around 0 97.8%
associate-*l/98.0%
associate-*r*98.0%
associate-*r/98.0%
neg-mul-198.0%
Simplified98.0%
if -1.99999999999999991e158 < (/.f64 t l) Initial program 90.7%
unpow290.7%
Applied egg-rr90.7%
unpow219.8%
clear-num19.8%
un-div-inv19.8%
Applied egg-rr90.7%
Final simplification91.9%
NOTE: t should be positive before calling this function
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -2e+158)
(asin (* (/ (- l) t) (sqrt 0.5)))
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ (/ t l) (/ l t)))))))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -2e+158) {
tmp = asin(((-l / t) * sqrt(0.5)));
} else {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
}
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) <= (-2d+158)) then
tmp = asin(((-l / t) * sqrt(0.5d0)))
else
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
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) <= -2e+158) {
tmp = Math.asin(((-l / t) * Math.sqrt(0.5)));
} else {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -2e+158: tmp = math.asin(((-l / t) * math.sqrt(0.5))) else: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))) return tmp
t = abs(t) function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -2e+158) tmp = asin(Float64(Float64(Float64(-l) / t) * sqrt(0.5))); 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
t = abs(t) function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -2e+158) tmp = asin(((-l / t) * sqrt(0.5))); else tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))); 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], -2e+158], N[ArcSin[N[(N[((-l) / t), $MachinePrecision] * N[Sqrt[0.5], $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}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -2 \cdot 10^{+158}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t} \cdot \sqrt{0.5}\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 (/.f64 t l) < -1.99999999999999991e158Initial program 52.7%
unpow252.7%
Applied egg-rr52.7%
Taylor expanded in t around -inf 87.5%
associate-*r*87.5%
associate-*r/87.5%
neg-mul-187.5%
distribute-rgt-neg-in87.5%
associate-*l/87.7%
unpow287.7%
associate-/l/91.4%
unpow291.4%
associate-*r/99.7%
associate-*l/99.7%
unpow299.7%
Simplified99.7%
unpow299.7%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr99.7%
Taylor expanded in Om around 0 97.8%
associate-*l/98.0%
associate-*r*98.0%
associate-*r/98.0%
neg-mul-198.0%
Simplified98.0%
if -1.99999999999999991e158 < (/.f64 t l) Initial program 90.7%
unpow290.7%
Applied egg-rr90.7%
unpow219.8%
clear-num19.8%
un-div-inv19.8%
Applied egg-rr90.7%
associate-*r/88.1%
associate-/l*90.7%
Applied egg-rr90.7%
Final simplification91.9%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (asin (* (/ (- l) t) (sqrt 0.5))))
t = abs(t);
double code(double t, double l, double Om, double Omc) {
return asin(((-l / t) * sqrt(0.5)));
}
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(((-l / t) * sqrt(0.5d0)))
end function
t = Math.abs(t);
public static double code(double t, double l, double Om, double Omc) {
return Math.asin(((-l / t) * Math.sqrt(0.5)));
}
t = abs(t) def code(t, l, Om, Omc): return math.asin(((-l / t) * math.sqrt(0.5)))
t = abs(t) function code(t, l, Om, Omc) return asin(Float64(Float64(Float64(-l) / t) * sqrt(0.5))) end
t = abs(t) function tmp = code(t, l, Om, Omc) tmp = asin(((-l / t) * sqrt(0.5))); end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := N[ArcSin[N[(N[((-l) / t), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\sin^{-1} \left(\frac{-\ell}{t} \cdot \sqrt{0.5}\right)
\end{array}
Initial program 84.6%
unpow284.6%
Applied egg-rr84.6%
Taylor expanded in t around -inf 27.5%
associate-*r*27.5%
associate-*r/27.5%
neg-mul-127.5%
distribute-rgt-neg-in27.5%
associate-*l/27.5%
unpow227.5%
associate-/l/30.1%
unpow230.1%
associate-*r/32.6%
associate-*l/32.6%
unpow232.6%
Simplified32.6%
unpow232.6%
clear-num32.6%
un-div-inv32.6%
Applied egg-rr32.6%
Taylor expanded in Om around 0 32.3%
associate-*l/32.3%
associate-*r*32.3%
associate-*r/32.3%
neg-mul-132.3%
Simplified32.3%
Final simplification32.3%
herbie shell --seed 2023301
(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)))))))