
(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+152)
(asin (* (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (/ (- l) (* t (sqrt 2.0)))))
(if (<= (/ t l) 1e+151)
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ (* t (/ 1.0 l)) (/ l t)))))))
(asin (* (/ l t) (sqrt 0.5))))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -5e+152) {
tmp = asin((sqrt((1.0 - pow((Om / Omc), 2.0))) * (-l / (t * sqrt(2.0)))));
} else if ((t / l) <= 1e+151) {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t)))))));
} else {
tmp = asin(((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) :: tmp
if ((t / l) <= (-5d+152)) then
tmp = asin((sqrt((1.0d0 - ((om / omc) ** 2.0d0))) * (-l / (t * sqrt(2.0d0)))))
else if ((t / l) <= 1d+151) then
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t * (1.0d0 / l)) / (l / t)))))))
else
tmp = asin(((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 tmp;
if ((t / l) <= -5e+152) {
tmp = Math.asin((Math.sqrt((1.0 - Math.pow((Om / Omc), 2.0))) * (-l / (t * Math.sqrt(2.0)))));
} else if ((t / l) <= 1e+151) {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t)))))));
} else {
tmp = Math.asin(((l / t) * Math.sqrt(0.5)));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -5e+152: tmp = math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) * (-l / (t * math.sqrt(2.0))))) elif (t / l) <= 1e+151: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t))))))) else: tmp = math.asin(((l / t) * math.sqrt(0.5))) return tmp
t = abs(t) function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -5e+152) tmp = asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) * Float64(Float64(-l) / Float64(t * sqrt(2.0))))); elseif (Float64(t / l) <= 1e+151) tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(Float64(t * Float64(1.0 / l)) / Float64(l / t))))))); else tmp = asin(Float64(Float64(l / t) * sqrt(0.5))); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -5e+152) tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) * (-l / (t * sqrt(2.0))))); elseif ((t / l) <= 1e+151) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t))))))); else tmp = asin(((l / t) * sqrt(0.5))); 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+152], N[ArcSin[N[(N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 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[(N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[(N[(t * N[(1.0 / l), $MachinePrecision]), $MachinePrecision] / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l / t), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -5 \cdot 10^{+152}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{-\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 10^{+151}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{t \cdot \frac{1}{\ell}}{\frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t} \cdot \sqrt{0.5}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -5e152Initial program 31.3%
sqrt-div31.3%
div-inv31.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-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
Taylor expanded in t around -inf 94.3%
mul-1-neg94.3%
*-commutative94.3%
distribute-rgt-neg-in94.3%
unpow294.3%
unpow294.3%
times-frac99.5%
unpow299.5%
mul-1-neg99.5%
associate-*r/99.5%
neg-mul-199.5%
Simplified99.5%
if -5e152 < (/.f64 t l) < 1.00000000000000002e151Initial program 99.4%
unpow299.4%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
unpow299.4%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
div-inv99.4%
*-un-lft-identity99.4%
times-frac98.3%
Applied egg-rr98.3%
/-rgt-identity98.3%
*-commutative98.3%
/-rgt-identity98.3%
frac-times99.4%
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%
unpow289.7%
times-frac99.5%
unpow299.5%
associate-/l*99.5%
associate-/r/99.6%
Simplified99.6%
unpow247.0%
clear-num47.0%
un-div-inv47.0%
Applied egg-rr99.6%
Taylor expanded in Om around 0 99.5%
associate-*l/99.6%
*-commutative99.6%
Simplified99.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(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 78.8%
sqrt-div78.8%
div-inv78.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-*r/99.3%
*-rgt-identity99.3%
Simplified99.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) -5e+156)
(asin (* (sqrt t_1) (/ (- l) (/ t (sqrt 0.5)))))
(if (<= (/ t l) 1e+151)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (/ (* t (/ 1.0 l)) (/ l t)))))))
(asin (* (/ 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) <= -5e+156) {
tmp = asin((sqrt(t_1) * (-l / (t / sqrt(0.5)))));
} else if ((t / l) <= 1e+151) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t)))))));
} else {
tmp = asin(((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) <= (-5d+156)) then
tmp = asin((sqrt(t_1) * (-l / (t / sqrt(0.5d0)))))
else if ((t / l) <= 1d+151) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t * (1.0d0 / l)) / (l / t)))))))
else
tmp = asin(((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) <= -5e+156) {
tmp = Math.asin((Math.sqrt(t_1) * (-l / (t / Math.sqrt(0.5)))));
} else if ((t / l) <= 1e+151) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t)))))));
} else {
tmp = Math.asin(((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) <= -5e+156: tmp = math.asin((math.sqrt(t_1) * (-l / (t / math.sqrt(0.5))))) elif (t / l) <= 1e+151: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t))))))) else: tmp = math.asin(((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) <= -5e+156) tmp = asin(Float64(sqrt(t_1) * Float64(Float64(-l) / Float64(t / sqrt(0.5))))); elseif (Float64(t / l) <= 1e+151) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(Float64(t * Float64(1.0 / l)) / Float64(l / t))))))); else tmp = asin(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) <= -5e+156) tmp = asin((sqrt(t_1) * (-l / (t / sqrt(0.5))))); elseif ((t / l) <= 1e+151) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t))))))); else tmp = asin(((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], -5e+156], N[ArcSin[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[((-l) / N[(t / N[Sqrt[0.5], $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 * N[(1.0 / l), $MachinePrecision]), $MachinePrecision] / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l / t), $MachinePrecision] * N[Sqrt[0.5], $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 -5 \cdot 10^{+156}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{t_1} \cdot \frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 10^{+151}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t_1}{1 + 2 \cdot \frac{t \cdot \frac{1}{\ell}}{\frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t} \cdot \sqrt{0.5}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -4.99999999999999992e156Initial program 29.5%
Taylor expanded in t around -inf 94.1%
mul-1-neg94.1%
*-commutative94.1%
distribute-rgt-neg-in94.1%
unpow294.1%
unpow294.1%
times-frac99.5%
unpow299.5%
mul-1-neg99.5%
associate-/l*99.5%
associate-*r/99.5%
neg-mul-199.5%
Simplified99.5%
unpow229.5%
clear-num29.5%
un-div-inv29.5%
Applied egg-rr99.5%
if -4.99999999999999992e156 < (/.f64 t l) < 1.00000000000000002e151Initial program 99.4%
unpow299.4%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
unpow299.4%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
div-inv99.4%
*-un-lft-identity99.4%
times-frac97.7%
Applied egg-rr97.7%
/-rgt-identity97.7%
*-commutative97.7%
/-rgt-identity97.7%
frac-times99.4%
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%
unpow289.7%
times-frac99.5%
unpow299.5%
associate-/l*99.5%
associate-/r/99.6%
Simplified99.6%
unpow247.0%
clear-num47.0%
un-div-inv47.0%
Applied egg-rr99.6%
Taylor expanded in Om around 0 99.5%
associate-*l/99.6%
*-commutative99.6%
Simplified99.6%
Final simplification99.5%
NOTE: t should be positive before calling this function
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) 1e+151)
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ (* t (/ 1.0 l)) (/ l t)))))))
(asin (* (/ l t) (sqrt 0.5)))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 1e+151) {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t)))))));
} else {
tmp = asin(((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) :: tmp
if ((t / l) <= 1d+151) then
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t * (1.0d0 / l)) / (l / t)))))))
else
tmp = asin(((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 tmp;
if ((t / l) <= 1e+151) {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t)))))));
} else {
tmp = Math.asin(((l / t) * Math.sqrt(0.5)));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 1e+151: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t))))))) else: tmp = math.asin(((l / t) * math.sqrt(0.5))) return tmp
t = abs(t) function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= 1e+151) tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(Float64(t * Float64(1.0 / l)) / Float64(l / t))))))); else tmp = asin(Float64(Float64(l / t) * sqrt(0.5))); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= 1e+151) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t * (1.0 / l)) / (l / t))))))); else tmp = asin(((l / t) * sqrt(0.5))); 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], 1e+151], 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 * N[(1.0 / l), $MachinePrecision]), $MachinePrecision] / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l / t), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 10^{+151}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{t \cdot \frac{1}{\ell}}{\frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t} \cdot \sqrt{0.5}\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%
unpow286.8%
clear-num86.8%
un-div-inv86.8%
Applied egg-rr86.8%
div-inv86.8%
*-un-lft-identity86.8%
times-frac85.4%
Applied egg-rr85.4%
/-rgt-identity85.4%
*-commutative85.4%
/-rgt-identity85.4%
frac-times86.8%
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%
unpow289.7%
times-frac99.5%
unpow299.5%
associate-/l*99.5%
associate-/r/99.6%
Simplified99.6%
unpow247.0%
clear-num47.0%
un-div-inv47.0%
Applied egg-rr99.6%
Taylor expanded in Om around 0 99.5%
associate-*l/99.6%
*-commutative99.6%
Simplified99.6%
Final simplification89.4%
NOTE: t should be positive before calling this function
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) 1e+151)
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (* (/ t l) (/ t l)))))))
(asin (* (/ l t) (sqrt 0.5)))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 1e+151) {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l)))))));
} else {
tmp = asin(((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) :: tmp
if ((t / l) <= 1d+151) then
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t / l) * (t / l)))))))
else
tmp = asin(((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 tmp;
if ((t / l) <= 1e+151) {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l)))))));
} else {
tmp = Math.asin(((l / t) * Math.sqrt(0.5)));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 1e+151: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l))))))) else: tmp = math.asin(((l / t) * math.sqrt(0.5))) return tmp
t = abs(t) function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= 1e+151) 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))))))); else tmp = asin(Float64(Float64(l / t) * sqrt(0.5))); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= 1e+151) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) * (t / l))))))); else tmp = asin(((l / t) * sqrt(0.5))); 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], 1e+151], 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], N[ArcSin[N[(N[(l / t), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 10^{+151}:\\
\;\;\;\;\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)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t} \cdot \sqrt{0.5}\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%
unpow286.8%
clear-num86.8%
un-div-inv86.8%
Applied egg-rr86.8%
div-inv86.8%
clear-num86.8%
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%
unpow289.7%
times-frac99.5%
unpow299.5%
associate-/l*99.5%
associate-/r/99.6%
Simplified99.6%
unpow247.0%
clear-num47.0%
un-div-inv47.0%
Applied egg-rr99.6%
Taylor expanded in Om around 0 99.5%
associate-*l/99.6%
*-commutative99.6%
Simplified99.6%
Final simplification89.3%
NOTE: t should be positive before calling this function
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) 1e+151)
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ (/ t l) (/ l t)))))))
(asin (* (/ l t) (sqrt 0.5)))))t = abs(t);
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 1e+151) {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = asin(((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) :: tmp
if ((t / l) <= 1d+151) then
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
else
tmp = asin(((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 tmp;
if ((t / l) <= 1e+151) {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = Math.asin(((l / t) * Math.sqrt(0.5)));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 1e+151: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))) else: tmp = math.asin(((l / t) * math.sqrt(0.5))) return tmp
t = abs(t) function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= 1e+151) 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))))))); else tmp = asin(Float64(Float64(l / t) * sqrt(0.5))); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= 1e+151) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))); else tmp = asin(((l / t) * sqrt(0.5))); 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], 1e+151], 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], N[ArcSin[N[(N[(l / t), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 10^{+151}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{\frac{t}{\ell}}{\frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t} \cdot \sqrt{0.5}\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%
unpow286.8%
clear-num86.8%
un-div-inv86.8%
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%
unpow289.7%
times-frac99.5%
unpow299.5%
associate-/l*99.5%
associate-/r/99.6%
Simplified99.6%
unpow247.0%
clear-num47.0%
un-div-inv47.0%
Applied egg-rr99.6%
Taylor expanded in Om around 0 99.5%
associate-*l/99.6%
*-commutative99.6%
Simplified99.6%
Final simplification89.4%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (if (or (<= l -8.8e-125) (not (<= l 4.6e-5))) (asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om))))) (asin (/ (* l (sqrt 0.5)) t))))
t = abs(t);
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((l <= -8.8e-125) || !(l <= 4.6e-5)) {
tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else {
tmp = asin(((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) :: tmp
if ((l <= (-8.8d-125)) .or. (.not. (l <= 4.6d-5))) then
tmp = asin(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
else
tmp = asin(((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 tmp;
if ((l <= -8.8e-125) || !(l <= 4.6e-5)) {
tmp = Math.asin(Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else {
tmp = Math.asin(((l * Math.sqrt(0.5)) / t));
}
return tmp;
}
t = abs(t) def code(t, l, Om, Omc): tmp = 0 if (l <= -8.8e-125) or not (l <= 4.6e-5): tmp = math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om))))) else: tmp = math.asin(((l * math.sqrt(0.5)) / t)) return tmp
t = abs(t) function code(t, l, Om, Omc) tmp = 0.0 if ((l <= -8.8e-125) || !(l <= 4.6e-5)) tmp = asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))); else tmp = asin(Float64(Float64(l * sqrt(0.5)) / t)); end return tmp end
t = abs(t) function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((l <= -8.8e-125) || ~((l <= 4.6e-5))) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); else tmp = asin(((l * sqrt(0.5)) / t)); end tmp_2 = tmp; end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := If[Or[LessEqual[l, -8.8e-125], N[Not[LessEqual[l, 4.6e-5]], $MachinePrecision]], N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t = |t|\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.8 \cdot 10^{-125} \lor \neg \left(\ell \leq 4.6 \cdot 10^{-5}\right):\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\
\end{array}
\end{array}
if l < -8.79999999999999979e-125 or 4.6e-5 < l Initial program 88.7%
Taylor expanded in t around 0 65.7%
unpow265.7%
unpow265.7%
times-frac72.1%
unpow272.1%
Simplified72.1%
unpow288.8%
clear-num88.8%
un-div-inv88.8%
Applied egg-rr72.1%
if -8.79999999999999979e-125 < l < 4.6e-5Initial program 65.7%
Taylor expanded in t around inf 51.4%
*-commutative51.4%
unpow251.4%
unpow251.4%
times-frac57.9%
unpow257.9%
associate-/l*57.9%
associate-/r/57.9%
Simplified57.9%
unpow265.7%
clear-num65.7%
un-div-inv65.7%
Applied egg-rr57.9%
Taylor expanded in Om around 0 57.3%
Final simplification65.8%
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(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 78.8%
Taylor expanded in t around inf 30.8%
*-commutative30.8%
unpow230.8%
unpow230.8%
times-frac34.5%
unpow234.5%
associate-/l*34.5%
associate-/r/34.5%
Simplified34.5%
unpow278.9%
clear-num78.9%
un-div-inv78.9%
Applied egg-rr34.5%
Taylor expanded in Om around 0 34.1%
associate-*l/34.1%
*-commutative34.1%
Simplified34.1%
Final simplification34.1%
NOTE: t should be positive before calling this function (FPCore (t l Om Omc) :precision binary64 (asin (/ (* l (sqrt 0.5)) t)))
t = abs(t);
double code(double t, double l, double Om, double Omc) {
return asin(((l * sqrt(0.5)) / 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(((l * sqrt(0.5d0)) / t))
end function
t = Math.abs(t);
public static double code(double t, double l, double Om, double Omc) {
return Math.asin(((l * Math.sqrt(0.5)) / t));
}
t = abs(t) def code(t, l, Om, Omc): return math.asin(((l * math.sqrt(0.5)) / t))
t = abs(t) function code(t, l, Om, Omc) return asin(Float64(Float64(l * sqrt(0.5)) / t)) end
t = abs(t) function tmp = code(t, l, Om, Omc) tmp = asin(((l * sqrt(0.5)) / t)); end
NOTE: t should be positive before calling this function code[t_, l_, Om_, Omc_] := N[ArcSin[N[(N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t = |t|\\
\\
\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)
\end{array}
Initial program 78.8%
Taylor expanded in t around inf 30.8%
*-commutative30.8%
unpow230.8%
unpow230.8%
times-frac34.5%
unpow234.5%
associate-/l*34.5%
associate-/r/34.5%
Simplified34.5%
unpow278.9%
clear-num78.9%
un-div-inv78.9%
Applied egg-rr34.5%
Taylor expanded in Om around 0 34.1%
Final simplification34.1%
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)))))))