
(FPCore (t l Om Omc) :precision binary64 (asin (sqrt (/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (* 2.0 (pow (/ t l) 2.0)))))))
double code(double t, double l, double Om, double Omc) {
return asin(sqrt(((1.0 - pow((Om / Omc), 2.0)) / (1.0 + (2.0 * pow((t / l), 2.0))))));
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
code = asin(sqrt(((1.0d0 - ((om / omc) ** 2.0d0)) / (1.0d0 + (2.0d0 * ((t / l) ** 2.0d0))))))
end function
public static double code(double t, double l, double Om, double Omc) {
return Math.asin(Math.sqrt(((1.0 - Math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * Math.pow((t / l), 2.0))))));
}
def code(t, l, Om, Omc): return math.asin(math.sqrt(((1.0 - math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * math.pow((t / l), 2.0))))))
function code(t, l, Om, Omc) return asin(sqrt(Float64(Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) / Float64(1.0 + Float64(2.0 * (Float64(t / l) ^ 2.0)))))) end
function tmp = code(t, l, Om, Omc) tmp = asin(sqrt(((1.0 - ((Om / Omc) ^ 2.0)) / (1.0 + (2.0 * ((t / l) ^ 2.0)))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (t l Om Omc) :precision binary64 (asin (sqrt (/ (- 1.0 (pow (/ Om Omc) 2.0)) (+ 1.0 (* 2.0 (pow (/ t l) 2.0)))))))
double code(double t, double l, double Om, double Omc) {
return asin(sqrt(((1.0 - pow((Om / Omc), 2.0)) / (1.0 + (2.0 * pow((t / l), 2.0))))));
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
code = asin(sqrt(((1.0d0 - ((om / omc) ** 2.0d0)) / (1.0d0 + (2.0d0 * ((t / l) ** 2.0d0))))))
end function
public static double code(double t, double l, double Om, double Omc) {
return Math.asin(Math.sqrt(((1.0 - Math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * Math.pow((t / l), 2.0))))));
}
def code(t, l, Om, Omc): return math.asin(math.sqrt(((1.0 - math.pow((Om / Omc), 2.0)) / (1.0 + (2.0 * math.pow((t / l), 2.0))))))
function code(t, l, Om, Omc) return asin(sqrt(Float64(Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) / Float64(1.0 + Float64(2.0 * (Float64(t / l) ^ 2.0)))))) end
function tmp = code(t, l, Om, Omc) tmp = asin(sqrt(((1.0 - ((Om / Omc) ^ 2.0)) / (1.0 + (2.0 * ((t / l) ^ 2.0)))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\sqrt{\frac{1 - {\left(\frac{Om}{Omc}\right)}^{2}}{1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}}}\right)
\end{array}
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0))))
(if (<= (/ t l) -1e+157)
(asin (/ (- l) t_1))
(if (<= (/ t l) 2e+145)
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ 1.0 (* (/ l t) (/ l t))))))))
(asin (/ l t_1))))))
double code(double t, double l, double Om, double Omc) {
double t_1 = t * sqrt(2.0);
double tmp;
if ((t / l) <= -1e+157) {
tmp = asin((-l / t_1));
} else if ((t / l) <= 2e+145) {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t))))))));
} else {
tmp = asin((l / t_1));
}
return tmp;
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: t_1
real(8) :: tmp
t_1 = t * sqrt(2.0d0)
if ((t / l) <= (-1d+157)) then
tmp = asin((-l / t_1))
else if ((t / l) <= 2d+145) then
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * (1.0d0 / ((l / t) * (l / t))))))))
else
tmp = asin((l / t_1))
end if
code = tmp
end function
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) <= -1e+157) {
tmp = Math.asin((-l / t_1));
} else if ((t / l) <= 2e+145) {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t))))))));
} else {
tmp = Math.asin((l / t_1));
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = t * math.sqrt(2.0) tmp = 0 if (t / l) <= -1e+157: tmp = math.asin((-l / t_1)) elif (t / l) <= 2e+145: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t)))))))) else: tmp = math.asin((l / t_1)) return tmp
function code(t, l, Om, Omc) t_1 = Float64(t * sqrt(2.0)) tmp = 0.0 if (Float64(t / l) <= -1e+157) tmp = asin(Float64(Float64(-l) / t_1)); elseif (Float64(t / l) <= 2e+145) tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(1.0 / Float64(Float64(l / t) * Float64(l / t)))))))); else tmp = asin(Float64(l / t_1)); end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = t * sqrt(2.0); tmp = 0.0; if ((t / l) <= -1e+157) tmp = asin((-l / t_1)); elseif ((t / l) <= 2e+145) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t) * (l / t)))))))); else tmp = asin((l / t_1)); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t / l), $MachinePrecision], -1e+157], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 2e+145], 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[(1.0 / N[(N[(l / t), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / t$95$1), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \sqrt{2}\\
\mathbf{if}\;\frac{t}{\ell} \leq -1 \cdot 10^{+157}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{+145}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{1}{\frac{\ell}{t} \cdot \frac{\ell}{t}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -9.99999999999999983e156Initial program 40.8%
sqrt-div40.8%
div-inv40.8%
add-sqr-sqrt40.8%
hypot-1-def40.8%
*-commutative40.8%
sqrt-prod40.8%
unpow240.8%
sqrt-prod0.0%
add-sqr-sqrt98.9%
Applied egg-rr98.9%
unpow298.9%
times-frac91.0%
unpow291.0%
unpow291.0%
associate-*r/91.0%
*-rgt-identity91.0%
unpow291.0%
unpow291.0%
times-frac98.9%
unpow298.9%
Simplified98.9%
Taylor expanded in Om around 0 97.7%
Taylor expanded in t around -inf 98.4%
associate-*r/98.4%
mul-1-neg98.4%
Simplified98.4%
if -9.99999999999999983e156 < (/.f64 t l) < 2e145Initial program 98.3%
unpow298.3%
clear-num98.3%
clear-num98.3%
frac-times98.4%
metadata-eval98.4%
Applied egg-rr98.4%
unpow298.4%
clear-num98.4%
un-div-inv98.4%
Applied egg-rr98.4%
if 2e145 < (/.f64 t l) Initial program 36.4%
sqrt-div36.5%
div-inv36.5%
add-sqr-sqrt36.5%
hypot-1-def36.5%
*-commutative36.5%
sqrt-prod36.5%
unpow236.5%
sqrt-prod98.5%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
unpow298.7%
times-frac86.2%
unpow286.2%
unpow286.2%
associate-*r/86.2%
*-rgt-identity86.2%
unpow286.2%
unpow286.2%
times-frac98.7%
unpow298.7%
Simplified98.7%
Taylor expanded in Om around 0 98.7%
Taylor expanded in t around inf 99.5%
Final simplification98.6%
(FPCore (t l Om Omc) :precision binary64 (asin (/ (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (hypot 1.0 (* (/ t l) (sqrt 2.0))))))
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)))));
}
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)))));
}
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)))))
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
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
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}
\\
\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 80.1%
sqrt-div80.1%
div-inv80.1%
add-sqr-sqrt80.1%
hypot-1-def80.1%
*-commutative80.1%
sqrt-prod80.0%
unpow280.0%
sqrt-prod53.7%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
unpow298.4%
times-frac89.6%
unpow289.6%
unpow289.6%
associate-*r/89.6%
*-rgt-identity89.6%
unpow289.6%
unpow289.6%
times-frac98.4%
unpow298.4%
Simplified98.4%
Final simplification98.4%
(FPCore (t l Om Omc) :precision binary64 (asin (/ 1.0 (hypot 1.0 (* (/ t l) (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
return asin((1.0 / hypot(1.0, ((t / l) * sqrt(2.0)))));
}
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)))));
}
def code(t, l, Om, Omc): return math.asin((1.0 / math.hypot(1.0, ((t / l) * math.sqrt(2.0)))))
function code(t, l, Om, Omc) return asin(Float64(1.0 / hypot(1.0, Float64(Float64(t / l) * sqrt(2.0))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((1.0 / hypot(1.0, ((t / l) * sqrt(2.0))))); end
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}
\\
\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Initial program 80.1%
sqrt-div80.1%
div-inv80.1%
add-sqr-sqrt80.1%
hypot-1-def80.1%
*-commutative80.1%
sqrt-prod80.0%
unpow280.0%
sqrt-prod53.7%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
unpow298.4%
times-frac89.6%
unpow289.6%
unpow289.6%
associate-*r/89.6%
*-rgt-identity89.6%
unpow289.6%
unpow289.6%
times-frac98.4%
unpow298.4%
Simplified98.4%
Taylor expanded in Om around 0 97.6%
Final simplification97.6%
(FPCore (t l Om Omc) :precision binary64 (asin (/ 1.0 (hypot 1.0 (* t (/ (sqrt 2.0) l))))))
double code(double t, double l, double Om, double Omc) {
return asin((1.0 / hypot(1.0, (t * (sqrt(2.0) / l)))));
}
public static double code(double t, double l, double Om, double Omc) {
return Math.asin((1.0 / Math.hypot(1.0, (t * (Math.sqrt(2.0) / l)))));
}
def code(t, l, Om, Omc): return math.asin((1.0 / math.hypot(1.0, (t * (math.sqrt(2.0) / l)))))
function code(t, l, Om, Omc) return asin(Float64(1.0 / hypot(1.0, Float64(t * Float64(sqrt(2.0) / l))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((1.0 / hypot(1.0, (t * (sqrt(2.0) / l))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, t \cdot \frac{\sqrt{2}}{\ell}\right)}\right)
\end{array}
Initial program 80.1%
sqrt-div80.1%
div-inv80.1%
add-sqr-sqrt80.1%
hypot-1-def80.1%
*-commutative80.1%
sqrt-prod80.0%
unpow280.0%
sqrt-prod53.7%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
unpow298.4%
times-frac89.6%
unpow289.6%
unpow289.6%
associate-*r/89.6%
*-rgt-identity89.6%
unpow289.6%
unpow289.6%
times-frac98.4%
unpow298.4%
Simplified98.4%
Taylor expanded in Om around 0 97.6%
Taylor expanded in t around 0 97.6%
associate-/l*97.6%
Simplified97.6%
associate-/r/97.6%
Applied egg-rr97.6%
Final simplification97.6%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0))))
(if (<= (/ t l) -500.0)
(asin (/ (- l) t_1))
(if (<= (/ t l) 1e-8)
(asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(asin (/ l t_1))))))
double code(double t, double l, double Om, double Omc) {
double t_1 = t * sqrt(2.0);
double tmp;
if ((t / l) <= -500.0) {
tmp = asin((-l / t_1));
} else if ((t / l) <= 1e-8) {
tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else {
tmp = asin((l / t_1));
}
return tmp;
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: t_1
real(8) :: tmp
t_1 = t * sqrt(2.0d0)
if ((t / l) <= (-500.0d0)) then
tmp = asin((-l / t_1))
else if ((t / l) <= 1d-8) then
tmp = asin(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
else
tmp = asin((l / t_1))
end if
code = tmp
end function
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) <= -500.0) {
tmp = Math.asin((-l / t_1));
} else if ((t / l) <= 1e-8) {
tmp = Math.asin(Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else {
tmp = Math.asin((l / t_1));
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = t * math.sqrt(2.0) tmp = 0 if (t / l) <= -500.0: tmp = math.asin((-l / t_1)) elif (t / l) <= 1e-8: tmp = math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om))))) else: tmp = math.asin((l / t_1)) return tmp
function code(t, l, Om, Omc) t_1 = Float64(t * sqrt(2.0)) tmp = 0.0 if (Float64(t / l) <= -500.0) tmp = asin(Float64(Float64(-l) / t_1)); elseif (Float64(t / l) <= 1e-8) tmp = asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))); else tmp = asin(Float64(l / t_1)); end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = t * sqrt(2.0); tmp = 0.0; if ((t / l) <= -500.0) tmp = asin((-l / t_1)); elseif ((t / l) <= 1e-8) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); else tmp = asin((l / t_1)); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t / l), $MachinePrecision], -500.0], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 1e-8], N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / t$95$1), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \sqrt{2}\\
\mathbf{if}\;\frac{t}{\ell} \leq -500:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 10^{-8}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -500Initial program 62.9%
sqrt-div62.9%
div-inv62.9%
add-sqr-sqrt62.9%
hypot-1-def62.9%
*-commutative62.9%
sqrt-prod62.8%
unpow262.8%
sqrt-prod0.0%
add-sqr-sqrt99.0%
Applied egg-rr99.0%
unpow299.0%
times-frac90.8%
unpow290.8%
unpow290.8%
associate-*r/90.8%
*-rgt-identity90.8%
unpow290.8%
unpow290.8%
times-frac99.0%
unpow299.0%
Simplified99.0%
Taylor expanded in Om around 0 98.2%
Taylor expanded in t around -inf 98.1%
associate-*r/98.1%
mul-1-neg98.1%
Simplified98.1%
if -500 < (/.f64 t l) < 1e-8Initial program 97.9%
Taylor expanded in t around 0 89.6%
unpow289.6%
unpow289.6%
times-frac97.4%
unpow297.4%
Simplified97.4%
unpow297.9%
clear-num97.9%
un-div-inv97.9%
Applied egg-rr97.4%
if 1e-8 < (/.f64 t l) Initial program 58.1%
sqrt-div58.1%
div-inv58.1%
add-sqr-sqrt58.1%
hypot-1-def58.1%
*-commutative58.1%
sqrt-prod58.0%
unpow258.0%
sqrt-prod98.7%
add-sqr-sqrt98.8%
Applied egg-rr98.8%
unpow298.8%
times-frac87.4%
unpow287.4%
unpow287.4%
associate-*r/87.4%
*-rgt-identity87.4%
unpow287.4%
unpow287.4%
times-frac98.8%
unpow298.8%
Simplified98.8%
Taylor expanded in Om around 0 98.6%
Taylor expanded in t around inf 97.9%
Final simplification97.7%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0))))
(if (<= (/ t l) -500.0)
(asin (/ (- l) t_1))
(if (<= (/ t l) 1e-8)
(asin (+ 1.0 (* -0.5 (* (/ Om Omc) (/ Om Omc)))))
(asin (/ l t_1))))))
double code(double t, double l, double Om, double Omc) {
double t_1 = t * sqrt(2.0);
double tmp;
if ((t / l) <= -500.0) {
tmp = asin((-l / t_1));
} else if ((t / l) <= 1e-8) {
tmp = asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc)))));
} else {
tmp = asin((l / t_1));
}
return tmp;
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: t_1
real(8) :: tmp
t_1 = t * sqrt(2.0d0)
if ((t / l) <= (-500.0d0)) then
tmp = asin((-l / t_1))
else if ((t / l) <= 1d-8) then
tmp = asin((1.0d0 + ((-0.5d0) * ((om / omc) * (om / omc)))))
else
tmp = asin((l / t_1))
end if
code = tmp
end function
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) <= -500.0) {
tmp = Math.asin((-l / t_1));
} else if ((t / l) <= 1e-8) {
tmp = Math.asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc)))));
} else {
tmp = Math.asin((l / t_1));
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = t * math.sqrt(2.0) tmp = 0 if (t / l) <= -500.0: tmp = math.asin((-l / t_1)) elif (t / l) <= 1e-8: tmp = math.asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc))))) else: tmp = math.asin((l / t_1)) return tmp
function code(t, l, Om, Omc) t_1 = Float64(t * sqrt(2.0)) tmp = 0.0 if (Float64(t / l) <= -500.0) tmp = asin(Float64(Float64(-l) / t_1)); elseif (Float64(t / l) <= 1e-8) tmp = asin(Float64(1.0 + Float64(-0.5 * Float64(Float64(Om / Omc) * Float64(Om / Omc))))); else tmp = asin(Float64(l / t_1)); end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = t * sqrt(2.0); tmp = 0.0; if ((t / l) <= -500.0) tmp = asin((-l / t_1)); elseif ((t / l) <= 1e-8) tmp = asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc))))); else tmp = asin((l / t_1)); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t / l), $MachinePrecision], -500.0], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 1e-8], N[ArcSin[N[(1.0 + N[(-0.5 * N[(N[(Om / Omc), $MachinePrecision] * N[(Om / Omc), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / t$95$1), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \sqrt{2}\\
\mathbf{if}\;\frac{t}{\ell} \leq -500:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 10^{-8}:\\
\;\;\;\;\sin^{-1} \left(1 + -0.5 \cdot \left(\frac{Om}{Omc} \cdot \frac{Om}{Omc}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -500Initial program 62.9%
sqrt-div62.9%
div-inv62.9%
add-sqr-sqrt62.9%
hypot-1-def62.9%
*-commutative62.9%
sqrt-prod62.8%
unpow262.8%
sqrt-prod0.0%
add-sqr-sqrt99.0%
Applied egg-rr99.0%
unpow299.0%
times-frac90.8%
unpow290.8%
unpow290.8%
associate-*r/90.8%
*-rgt-identity90.8%
unpow290.8%
unpow290.8%
times-frac99.0%
unpow299.0%
Simplified99.0%
Taylor expanded in Om around 0 98.2%
Taylor expanded in t around -inf 98.1%
associate-*r/98.1%
mul-1-neg98.1%
Simplified98.1%
if -500 < (/.f64 t l) < 1e-8Initial program 97.9%
Taylor expanded in t around 0 89.6%
unpow289.6%
unpow289.6%
times-frac97.4%
unpow297.4%
Simplified97.4%
Taylor expanded in Om around 0 89.4%
unpow289.4%
unpow289.4%
Simplified89.4%
times-frac97.2%
Applied egg-rr97.2%
if 1e-8 < (/.f64 t l) Initial program 58.1%
sqrt-div58.1%
div-inv58.1%
add-sqr-sqrt58.1%
hypot-1-def58.1%
*-commutative58.1%
sqrt-prod58.0%
unpow258.0%
sqrt-prod98.7%
add-sqr-sqrt98.8%
Applied egg-rr98.8%
unpow298.8%
times-frac87.4%
unpow287.4%
unpow287.4%
associate-*r/87.4%
*-rgt-identity87.4%
unpow287.4%
unpow287.4%
times-frac98.8%
unpow298.8%
Simplified98.8%
Taylor expanded in Om around 0 98.6%
Taylor expanded in t around inf 97.9%
Final simplification97.6%
(FPCore (t l Om Omc) :precision binary64 (if (or (<= l -7.5e-61) (not (<= l 3.4e-105))) (asin (+ 1.0 (* -0.5 (* (/ Om Omc) (/ Om Omc))))) (asin (/ l (* t (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((l <= -7.5e-61) || !(l <= 3.4e-105)) {
tmp = asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc)))));
} else {
tmp = asin((l / (t * sqrt(2.0))));
}
return tmp;
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: tmp
if ((l <= (-7.5d-61)) .or. (.not. (l <= 3.4d-105))) then
tmp = asin((1.0d0 + ((-0.5d0) * ((om / omc) * (om / omc)))))
else
tmp = asin((l / (t * sqrt(2.0d0))))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((l <= -7.5e-61) || !(l <= 3.4e-105)) {
tmp = Math.asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc)))));
} else {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (l <= -7.5e-61) or not (l <= 3.4e-105): tmp = math.asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc))))) else: tmp = math.asin((l / (t * math.sqrt(2.0)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if ((l <= -7.5e-61) || !(l <= 3.4e-105)) tmp = asin(Float64(1.0 + Float64(-0.5 * Float64(Float64(Om / Omc) * Float64(Om / Omc))))); else tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((l <= -7.5e-61) || ~((l <= 3.4e-105))) tmp = asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc))))); else tmp = asin((l / (t * sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[Or[LessEqual[l, -7.5e-61], N[Not[LessEqual[l, 3.4e-105]], $MachinePrecision]], N[ArcSin[N[(1.0 + N[(-0.5 * N[(N[(Om / Omc), $MachinePrecision] * N[(Om / Omc), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.5 \cdot 10^{-61} \lor \neg \left(\ell \leq 3.4 \cdot 10^{-105}\right):\\
\;\;\;\;\sin^{-1} \left(1 + -0.5 \cdot \left(\frac{Om}{Omc} \cdot \frac{Om}{Omc}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if l < -7.50000000000000047e-61 or 3.39999999999999992e-105 < l Initial program 89.4%
Taylor expanded in t around 0 66.1%
unpow266.1%
unpow266.1%
times-frac72.7%
unpow272.7%
Simplified72.7%
Taylor expanded in Om around 0 65.9%
unpow265.9%
unpow265.9%
Simplified65.9%
times-frac72.5%
Applied egg-rr72.5%
if -7.50000000000000047e-61 < l < 3.39999999999999992e-105Initial program 64.2%
sqrt-div64.1%
div-inv64.1%
add-sqr-sqrt64.1%
hypot-1-def64.1%
*-commutative64.1%
sqrt-prod64.1%
unpow264.1%
sqrt-prod50.8%
add-sqr-sqrt98.3%
Applied egg-rr98.3%
unpow298.3%
times-frac90.9%
unpow290.9%
unpow290.9%
associate-*r/90.9%
*-rgt-identity90.9%
unpow290.9%
unpow290.9%
times-frac98.3%
unpow298.3%
Simplified98.3%
Taylor expanded in Om around 0 97.7%
Taylor expanded in t around inf 60.1%
Final simplification68.0%
(FPCore (t l Om Omc) :precision binary64 (asin (+ 1.0 (* -0.5 (* (/ Om Omc) (/ Om Omc))))))
double code(double t, double l, double Om, double Omc) {
return asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc)))));
}
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 + ((-0.5d0) * ((om / omc) * (om / omc)))))
end function
public static double code(double t, double l, double Om, double Omc) {
return Math.asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc)))));
}
def code(t, l, Om, Omc): return math.asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc)))))
function code(t, l, Om, Omc) return asin(Float64(1.0 + Float64(-0.5 * Float64(Float64(Om / Omc) * Float64(Om / Omc))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((1.0 + (-0.5 * ((Om / Omc) * (Om / Omc))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 + N[(-0.5 * N[(N[(Om / Omc), $MachinePrecision] * N[(Om / Omc), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(1 + -0.5 \cdot \left(\frac{Om}{Omc} \cdot \frac{Om}{Omc}\right)\right)
\end{array}
Initial program 80.1%
Taylor expanded in t around 0 49.0%
unpow249.0%
unpow249.0%
times-frac53.4%
unpow253.4%
Simplified53.4%
Taylor expanded in Om around 0 48.9%
unpow248.9%
unpow248.9%
Simplified48.9%
times-frac53.3%
Applied egg-rr53.3%
Final simplification53.3%
(FPCore (t l Om Omc) :precision binary64 (asin 1.0))
double code(double t, double l, double Om, double Omc) {
return asin(1.0);
}
real(8) function code(t, l, om, omc)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
code = asin(1.0d0)
end function
public static double code(double t, double l, double Om, double Omc) {
return Math.asin(1.0);
}
def code(t, l, Om, Omc): return math.asin(1.0)
function code(t, l, Om, Omc) return asin(1.0) end
function tmp = code(t, l, Om, Omc) tmp = asin(1.0); end
code[t_, l_, Om_, Omc_] := N[ArcSin[1.0], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} 1
\end{array}
Initial program 80.1%
Taylor expanded in t around 0 49.0%
unpow249.0%
unpow249.0%
times-frac53.4%
unpow253.4%
Simplified53.4%
Taylor expanded in Om around 0 52.8%
Final simplification52.8%
herbie shell --seed 2023187
(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)))))))