
(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 7 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)))) (t_2 (sqrt t_1)))
(if (<= (/ t l) -5e+152)
(asin (* t_2 (/ (- l) (* t (sqrt 2.0)))))
(if (<= (/ t l) 1e+151)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (/ (/ t l) (/ l t)))))))
(asin (* t_2 (* (/ l t) (sqrt 0.5))))))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
double t_2 = sqrt(t_1);
double tmp;
if ((t / l) <= -5e+152) {
tmp = asin((t_2 * (-l / (t * sqrt(2.0)))));
} else if ((t / l) <= 1e+151) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = asin((t_2 * ((l / t) * sqrt(0.5))));
}
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) :: t_2
real(8) :: tmp
t_1 = 1.0d0 - ((om / omc) / (omc / om))
t_2 = sqrt(t_1)
if ((t / l) <= (-5d+152)) then
tmp = asin((t_2 * (-l / (t * sqrt(2.0d0)))))
else if ((t / l) <= 1d+151) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
else
tmp = asin((t_2 * ((l / t) * sqrt(0.5d0))))
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 t_2 = Math.sqrt(t_1);
double tmp;
if ((t / l) <= -5e+152) {
tmp = Math.asin((t_2 * (-l / (t * Math.sqrt(2.0)))));
} else if ((t / l) <= 1e+151) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = Math.asin((t_2 * ((l / t) * Math.sqrt(0.5))));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): t_1 = 1.0 - ((Om / Omc) / (Omc / Om)) t_2 = math.sqrt(t_1) tmp = 0 if (t / l) <= -5e+152: tmp = math.asin((t_2 * (-l / (t * math.sqrt(2.0))))) elif (t / l) <= 1e+151: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t))))))) else: tmp = math.asin((t_2 * ((l / t) * math.sqrt(0.5)))) return tmp
t = abs(t) function code(t, l, Om, Omc) t_1 = Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) t_2 = sqrt(t_1) tmp = 0.0 if (Float64(t / l) <= -5e+152) tmp = asin(Float64(t_2 * Float64(Float64(-l) / Float64(t * sqrt(2.0))))); elseif (Float64(t / l) <= 1e+151) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) / Float64(l / t))))))); else tmp = asin(Float64(t_2 * Float64(Float64(l / t) * sqrt(0.5)))); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) t_1 = 1.0 - ((Om / Omc) / (Omc / Om)); t_2 = sqrt(t_1); tmp = 0.0; if ((t / l) <= -5e+152) tmp = asin((t_2 * (-l / (t * sqrt(2.0))))); elseif ((t / l) <= 1e+151) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t))))))); else tmp = asin((t_2 * ((l / t) * sqrt(0.5)))); 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]}, Block[{t$95$2 = N[Sqrt[t$95$1], $MachinePrecision]}, If[LessEqual[N[(t / l), $MachinePrecision], -5e+152], N[ArcSin[N[(t$95$2 * N[((-l) / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 1e+151], 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[(t$95$2 * N[(N[(l / t), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\\
t_2 := \sqrt{t_1}\\
\mathbf{if}\;\frac{t}{\ell} \leq -5 \cdot 10^{+152}:\\
\;\;\;\;\sin^{-1} \left(t_2 \cdot \frac{-\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 10^{+151}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t_1}{1 + 2 \cdot \frac{\frac{t}{\ell}}{\frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(t_2 \cdot \left(\frac{\ell}{t} \cdot \sqrt{0.5}\right)\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -5e152Initial program 31.3%
sqrt-div31.3%
add-sqr-sqrt31.3%
hypot-1-def31.3%
*-commutative31.3%
sqrt-prod31.3%
unpow231.3%
sqrt-prod0.0%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
associate-*l/99.3%
associate-/l*99.4%
Applied egg-rr99.4%
Taylor expanded in t around -inf 94.3%
*-commutative94.3%
associate-*r*94.3%
unpow294.3%
associate-/r*94.3%
unpow294.3%
associate-*l/99.5%
associate-*r/99.5%
unpow299.5%
neg-mul-199.5%
Simplified99.5%
unpow299.5%
clear-num99.5%
un-div-inv99.5%
Applied egg-rr99.5%
if -5e152 < (/.f64 t l) < 1.00000000000000002e151Initial program 99.4%
unpow299.4%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
unpow29.9%
clear-num9.9%
un-div-inv9.9%
Applied egg-rr99.4%
if 1.00000000000000002e151 < (/.f64 t l) Initial program 47.0%
Taylor expanded in t around inf 89.7%
*-commutative89.7%
unpow289.7%
associate-/r*95.6%
unpow295.6%
associate-*r/99.5%
associate-*l/99.5%
unpow299.5%
associate-/l*99.5%
Simplified99.5%
unpow246.1%
clear-num46.1%
un-div-inv46.1%
Applied egg-rr99.5%
associate-/r/99.6%
Applied egg-rr99.6%
Final simplification99.5%
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(t / Float64(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[(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 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)
\end{array}
Initial program 78.8%
sqrt-div78.8%
add-sqr-sqrt78.8%
hypot-1-def78.8%
*-commutative78.8%
sqrt-prod78.8%
unpow278.8%
sqrt-prod62.4%
add-sqr-sqrt99.3%
Applied egg-rr99.3%
associate-*l/99.3%
associate-/l*99.4%
Applied egg-rr99.4%
Final simplification99.4%
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 (* (sqrt 2.0) (/ t l))))))
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, (sqrt(2.0) * (t / l)))));
}
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, (Math.sqrt(2.0) * (t / l)))));
}
t = abs(t) def code(t, l, Om, Omc): return math.asin((math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / math.hypot(1.0, (math.sqrt(2.0) * (t / l)))))
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(sqrt(2.0) * Float64(t / l))))) end
t = abs(t) function tmp = code(t, l, Om, Omc) tmp = asin((sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / hypot(1.0, (sqrt(2.0) * (t / l))))); 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[(N[Sqrt[2.0], $MachinePrecision] * N[(t / l), $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, \sqrt{2} \cdot \frac{t}{\ell}\right)}\right)
\end{array}
Initial program 78.8%
sqrt-div78.8%
add-sqr-sqrt78.8%
hypot-1-def78.8%
*-commutative78.8%
sqrt-prod78.8%
unpow278.8%
sqrt-prod62.4%
add-sqr-sqrt99.3%
Applied egg-rr99.3%
unpow230.4%
clear-num30.4%
un-div-inv30.4%
Applied egg-rr99.3%
Final simplification99.3%
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) 1e+151)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (/ (/ t l) (/ l t)))))))
(asin (* (sqrt t_1) (* (/ l t) (sqrt 0.5)))))))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) <= 1e+151) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = asin((sqrt(t_1) * ((l / t) * sqrt(0.5))));
}
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) <= 1d+151) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
else
tmp = asin((sqrt(t_1) * ((l / t) * sqrt(0.5d0))))
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) <= 1e+151) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = Math.asin((Math.sqrt(t_1) * ((l / t) * Math.sqrt(0.5))));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): t_1 = 1.0 - ((Om / Omc) / (Omc / Om)) tmp = 0 if (t / l) <= 1e+151: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t))))))) else: tmp = math.asin((math.sqrt(t_1) * ((l / t) * math.sqrt(0.5)))) 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) <= 1e+151) 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(Float64(l / t) * sqrt(0.5)))); 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) <= 1e+151) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t / l) / (l / t))))))); else tmp = asin((sqrt(t_1) * ((l / t) * sqrt(0.5)))); 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], 1e+151], 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[(N[(l / t), $MachinePrecision] * N[Sqrt[0.5], $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 10^{+151}:\\
\;\;\;\;\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(\frac{\ell}{t} \cdot \sqrt{0.5}\right)\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 1.00000000000000002e151Initial program 86.8%
unpow286.8%
clear-num86.8%
un-div-inv86.8%
Applied egg-rr86.8%
unpow226.5%
clear-num26.5%
un-div-inv26.5%
Applied egg-rr86.8%
if 1.00000000000000002e151 < (/.f64 t l) Initial program 47.0%
Taylor expanded in t around inf 89.7%
*-commutative89.7%
unpow289.7%
associate-/r*95.6%
unpow295.6%
associate-*r/99.5%
associate-*l/99.5%
unpow299.5%
associate-/l*99.5%
Simplified99.5%
unpow246.1%
clear-num46.1%
un-div-inv46.1%
Applied egg-rr99.5%
associate-/r/99.6%
Applied egg-rr99.6%
Final simplification89.4%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (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) {
return asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l)))))));
}
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(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t / l) * (t / l)))))))
end function
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))) / (1.0 + (2.0 * ((t / l) * (t / l)))))));
}
t = abs(t) def code(t, l, Om, Omc): return math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l)))))))
t = abs(t) function code(t, l, Om, Omc) return 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
t = abs(t) function tmp = code(t, l, Om, Omc) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l))))))); end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := 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|\\
\\
\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}
Initial program 78.8%
unpow278.8%
clear-num78.9%
un-div-inv78.9%
Applied egg-rr78.9%
unpow230.4%
clear-num30.4%
un-div-inv30.4%
Applied egg-rr78.9%
div-inv78.9%
clear-num78.8%
Applied egg-rr78.8%
Final simplification78.8%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (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) {
return asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
}
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(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
end function
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))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
}
t = abs(t) def code(t, l, Om, Omc): return math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))))
t = abs(t) function code(t, l, Om, Omc) return 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
t = abs(t) function tmp = code(t, l, Om, Omc) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))); end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := 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|\\
\\
\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}
Initial program 78.8%
unpow278.8%
clear-num78.9%
un-div-inv78.9%
Applied egg-rr78.9%
unpow230.4%
clear-num30.4%
un-div-inv30.4%
Applied egg-rr78.9%
Final simplification78.9%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om))))))
t = abs(t);
double code(double t, double l, double Om, double Omc) {
return asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
}
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(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
end function
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)))));
}
t = abs(t) def code(t, l, Om, Omc): return math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))))
t = abs(t) function code(t, l, Om, Omc) return asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))) end
t = abs(t) function tmp = code(t, l, Om, Omc) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)
\end{array}
Initial program 78.8%
Taylor expanded in t around 0 45.0%
unpow245.0%
associate-/r*47.4%
unpow247.4%
associate-*r/49.6%
associate-*l/49.6%
unpow249.6%
Simplified49.6%
unpow230.4%
clear-num30.4%
un-div-inv30.4%
Applied egg-rr49.6%
Final simplification49.6%
herbie shell --seed 2023305
(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)))))))