
(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 (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 82.7%
sqrt-div82.7%
div-inv82.7%
add-sqr-sqrt82.7%
hypot-1-def82.7%
*-commutative82.7%
sqrt-prod82.6%
unpow282.6%
sqrt-prod49.6%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate-*r/98.2%
*-rgt-identity98.2%
Simplified98.2%
Final simplification98.2%
(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 82.7%
sqrt-div82.7%
div-inv82.7%
add-sqr-sqrt82.7%
hypot-1-def82.7%
*-commutative82.7%
sqrt-prod82.6%
unpow282.6%
sqrt-prod49.6%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate-*r/98.2%
*-rgt-identity98.2%
Simplified98.2%
Taylor expanded in Om around 0 97.2%
Final simplification97.2%
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -1e+32)
(asin (/ (- l) (* t (sqrt 2.0))))
(if (<= (/ t l) 1e+66)
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (* t (/ (/ t l) l)))))))
(asin (/ (/ l (pow 0.5 -0.5)) t)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -1e+32) {
tmp = asin((-l / (t * sqrt(2.0))));
} else if ((t / l) <= 1e+66) {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t * ((t / l) / l)))))));
} else {
tmp = asin(((l / pow(0.5, -0.5)) / t));
}
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 ((t / l) <= (-1d+32)) then
tmp = asin((-l / (t * sqrt(2.0d0))))
else if ((t / l) <= 1d+66) then
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * (t * ((t / l) / l)))))))
else
tmp = asin(((l / (0.5d0 ** (-0.5d0))) / t))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -1e+32) {
tmp = Math.asin((-l / (t * Math.sqrt(2.0))));
} else if ((t / l) <= 1e+66) {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t * ((t / l) / l)))))));
} else {
tmp = Math.asin(((l / Math.pow(0.5, -0.5)) / t));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -1e+32: tmp = math.asin((-l / (t * math.sqrt(2.0)))) elif (t / l) <= 1e+66: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t * ((t / l) / l))))))) else: tmp = math.asin(((l / math.pow(0.5, -0.5)) / t)) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -1e+32) tmp = asin(Float64(Float64(-l) / Float64(t * sqrt(2.0)))); elseif (Float64(t / l) <= 1e+66) tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(t * Float64(Float64(t / l) / l))))))); else tmp = asin(Float64(Float64(l / (0.5 ^ -0.5)) / t)); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -1e+32) tmp = asin((-l / (t * sqrt(2.0)))); elseif ((t / l) <= 1e+66) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (t * ((t / l) / l))))))); else tmp = asin(((l / (0.5 ^ -0.5)) / t)); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -1e+32], N[ArcSin[N[((-l) / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 1e+66], N[ArcSin[N[Sqrt[N[(N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[(t * N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[(l / N[Power[0.5, -0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -1 \cdot 10^{+32}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 10^{+66}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \left(t \cdot \frac{\frac{t}{\ell}}{\ell}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\frac{\ell}{{0.5}^{-0.5}}}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1.00000000000000005e32Initial program 62.4%
sqrt-div62.4%
div-inv62.4%
add-sqr-sqrt62.4%
hypot-1-def62.4%
*-commutative62.4%
sqrt-prod62.3%
unpow262.3%
sqrt-prod0.0%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
Taylor expanded in Om around 0 98.6%
Taylor expanded in t around -inf 97.2%
associate-*r/97.2%
neg-mul-197.2%
Simplified97.2%
if -1.00000000000000005e32 < (/.f64 t l) < 9.99999999999999945e65Initial program 97.7%
unpow297.7%
clear-num97.6%
un-div-inv97.7%
Applied egg-rr97.7%
associate-/r/97.6%
Applied egg-rr97.6%
unpow287.5%
clear-num87.5%
un-div-inv87.5%
Applied egg-rr97.6%
if 9.99999999999999945e65 < (/.f64 t l) Initial program 58.2%
Taylor expanded in t around -inf 27.2%
associate-*r*27.2%
*-commutative27.2%
unpow227.2%
unpow227.2%
times-frac32.6%
unpow232.6%
associate-/l*32.6%
associate-*r/32.6%
neg-mul-132.6%
Simplified32.6%
*-un-lft-identity32.6%
div-inv32.6%
times-frac32.6%
add-sqr-sqrt11.7%
sqrt-unprod48.2%
sqr-neg48.2%
sqrt-unprod50.9%
add-sqr-sqrt99.4%
pow1/299.4%
pow-flip99.6%
metadata-eval99.6%
Applied egg-rr99.6%
associate-*l/99.4%
*-lft-identity99.4%
Simplified99.4%
Taylor expanded in Om around 0 97.1%
Final simplification97.5%
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -1e+148)
(asin (/ (- l) (/ t (sqrt 0.5))))
(if (<= (/ t l) 1e+143)
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ (/ t l) (/ l t)))))))
(asin (/ (/ l (pow 0.5 -0.5)) t)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -1e+148) {
tmp = asin((-l / (t / sqrt(0.5))));
} else if ((t / l) <= 1e+143) {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = asin(((l / pow(0.5, -0.5)) / t));
}
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 ((t / l) <= (-1d+148)) then
tmp = asin((-l / (t / sqrt(0.5d0))))
else if ((t / l) <= 1d+143) then
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
else
tmp = asin(((l / (0.5d0 ** (-0.5d0))) / t))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -1e+148) {
tmp = Math.asin((-l / (t / Math.sqrt(0.5))));
} else if ((t / l) <= 1e+143) {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
} else {
tmp = Math.asin(((l / Math.pow(0.5, -0.5)) / t));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -1e+148: tmp = math.asin((-l / (t / math.sqrt(0.5)))) elif (t / l) <= 1e+143: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))) else: tmp = math.asin(((l / math.pow(0.5, -0.5)) / t)) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -1e+148) tmp = asin(Float64(Float64(-l) / Float64(t / sqrt(0.5)))); elseif (Float64(t / l) <= 1e+143) 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 / (0.5 ^ -0.5)) / t)); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -1e+148) tmp = asin((-l / (t / sqrt(0.5)))); elseif ((t / l) <= 1e+143) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t / l) / (l / t))))))); else tmp = asin(((l / (0.5 ^ -0.5)) / t)); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -1e+148], N[ArcSin[N[((-l) / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 1e+143], 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 / N[Power[0.5, -0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -1 \cdot 10^{+148}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 10^{+143}:\\
\;\;\;\;\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{\frac{\ell}{{0.5}^{-0.5}}}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1e148Initial program 42.1%
Taylor expanded in t around -inf 82.3%
associate-*r*82.3%
*-commutative82.3%
unpow282.3%
unpow282.3%
times-frac99.5%
unpow299.5%
associate-/l*97.3%
associate-*r/97.3%
neg-mul-197.3%
Simplified97.3%
Taylor expanded in Om around 0 95.8%
if -1e148 < (/.f64 t l) < 1e143Initial program 98.0%
unpow298.0%
clear-num98.0%
un-div-inv98.0%
Applied egg-rr98.0%
unpow273.7%
clear-num73.7%
un-div-inv73.7%
Applied egg-rr98.0%
if 1e143 < (/.f64 t l) Initial program 47.5%
Taylor expanded in t around -inf 33.7%
associate-*r*33.7%
*-commutative33.7%
unpow233.7%
unpow233.7%
times-frac40.4%
unpow240.4%
associate-/l*40.4%
associate-*r/40.4%
neg-mul-140.4%
Simplified40.4%
*-un-lft-identity40.4%
div-inv40.4%
times-frac40.4%
add-sqr-sqrt14.4%
sqrt-unprod56.7%
sqr-neg56.7%
sqrt-unprod54.5%
add-sqr-sqrt99.4%
pow1/299.4%
pow-flip99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in Om around 0 97.3%
Final simplification97.5%
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -20000000.0)
(asin (/ (- l) (/ t (sqrt 0.5))))
(if (<= (/ t l) 0.1)
(asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(asin (/ l (* t (sqrt 2.0)))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -20000000.0) {
tmp = asin((-l / (t / sqrt(0.5))));
} else if ((t / l) <= 0.1) {
tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} 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 ((t / l) <= (-20000000.0d0)) then
tmp = asin((-l / (t / sqrt(0.5d0))))
else if ((t / l) <= 0.1d0) then
tmp = asin(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
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 ((t / l) <= -20000000.0) {
tmp = Math.asin((-l / (t / Math.sqrt(0.5))));
} else if ((t / l) <= 0.1) {
tmp = Math.asin(Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -20000000.0: tmp = math.asin((-l / (t / math.sqrt(0.5)))) elif (t / l) <= 0.1: tmp = math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om))))) else: tmp = math.asin((l / (t * math.sqrt(2.0)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -20000000.0) tmp = asin(Float64(Float64(-l) / Float64(t / sqrt(0.5)))); elseif (Float64(t / l) <= 0.1) tmp = asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))); 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 ((t / l) <= -20000000.0) tmp = asin((-l / (t / sqrt(0.5)))); elseif ((t / l) <= 0.1) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); else tmp = asin((l / (t * sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -20000000.0], N[ArcSin[N[((-l) / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.1], N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $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}\;\frac{t}{\ell} \leq -20000000:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.1:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -2e7Initial program 66.0%
Taylor expanded in t around -inf 78.4%
associate-*r*78.4%
*-commutative78.4%
unpow278.4%
unpow278.4%
times-frac99.5%
unpow299.5%
associate-/l*98.3%
associate-*r/98.3%
neg-mul-198.3%
Simplified98.3%
Taylor expanded in Om around 0 97.2%
if -2e7 < (/.f64 t l) < 0.10000000000000001Initial program 97.4%
Taylor expanded in t around 0 86.4%
unpow286.4%
unpow286.4%
times-frac96.2%
unpow296.2%
Simplified96.2%
unpow296.2%
clear-num96.2%
un-div-inv96.2%
Applied egg-rr96.2%
if 0.10000000000000001 < (/.f64 t l) Initial program 65.3%
sqrt-div65.3%
div-inv65.3%
add-sqr-sqrt65.3%
hypot-1-def65.3%
*-commutative65.3%
sqrt-prod65.1%
unpow265.1%
sqrt-prod98.6%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate-*r/98.7%
*-rgt-identity98.7%
Simplified98.7%
Taylor expanded in Om around 0 96.8%
Taylor expanded in t around inf 97.4%
Final simplification96.7%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0))))
(if (<= (/ t l) -20000000.0)
(asin (/ (- l) t_1))
(if (<= (/ t l) 0.1) (asin 1.0) (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) <= -20000000.0) {
tmp = asin((-l / t_1));
} else if ((t / l) <= 0.1) {
tmp = asin(1.0);
} 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) <= (-20000000.0d0)) then
tmp = asin((-l / t_1))
else if ((t / l) <= 0.1d0) then
tmp = asin(1.0d0)
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) <= -20000000.0) {
tmp = Math.asin((-l / t_1));
} else if ((t / l) <= 0.1) {
tmp = Math.asin(1.0);
} 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) <= -20000000.0: tmp = math.asin((-l / t_1)) elif (t / l) <= 0.1: tmp = math.asin(1.0) 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) <= -20000000.0) tmp = asin(Float64(Float64(-l) / t_1)); elseif (Float64(t / l) <= 0.1) tmp = asin(1.0); 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) <= -20000000.0) tmp = asin((-l / t_1)); elseif ((t / l) <= 0.1) tmp = asin(1.0); 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], -20000000.0], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.1], N[ArcSin[1.0], $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 -20000000:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.1:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -2e7Initial program 66.0%
sqrt-div66.1%
div-inv66.1%
add-sqr-sqrt66.1%
hypot-1-def66.1%
*-commutative66.1%
sqrt-prod65.9%
unpow265.9%
sqrt-prod0.0%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
Taylor expanded in Om around 0 98.5%
Taylor expanded in t around -inf 97.2%
associate-*r/97.2%
neg-mul-197.2%
Simplified97.2%
if -2e7 < (/.f64 t l) < 0.10000000000000001Initial program 97.4%
Taylor expanded in t around 0 86.4%
unpow286.4%
unpow286.4%
times-frac96.2%
unpow296.2%
Simplified96.2%
Taylor expanded in Om around 0 95.4%
if 0.10000000000000001 < (/.f64 t l) Initial program 65.3%
sqrt-div65.3%
div-inv65.3%
add-sqr-sqrt65.3%
hypot-1-def65.3%
*-commutative65.3%
sqrt-prod65.1%
unpow265.1%
sqrt-prod98.6%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate-*r/98.7%
*-rgt-identity98.7%
Simplified98.7%
Taylor expanded in Om around 0 96.8%
Taylor expanded in t around inf 97.4%
Final simplification96.3%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) -20000000.0) (asin (/ (- l) (/ t (sqrt 0.5)))) (if (<= (/ t l) 0.1) (asin 1.0) (asin (/ l (* t (sqrt 2.0)))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -20000000.0) {
tmp = asin((-l / (t / sqrt(0.5))));
} else if ((t / l) <= 0.1) {
tmp = asin(1.0);
} 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 ((t / l) <= (-20000000.0d0)) then
tmp = asin((-l / (t / sqrt(0.5d0))))
else if ((t / l) <= 0.1d0) then
tmp = asin(1.0d0)
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 ((t / l) <= -20000000.0) {
tmp = Math.asin((-l / (t / Math.sqrt(0.5))));
} else if ((t / l) <= 0.1) {
tmp = Math.asin(1.0);
} else {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -20000000.0: tmp = math.asin((-l / (t / math.sqrt(0.5)))) elif (t / l) <= 0.1: tmp = math.asin(1.0) else: tmp = math.asin((l / (t * math.sqrt(2.0)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -20000000.0) tmp = asin(Float64(Float64(-l) / Float64(t / sqrt(0.5)))); elseif (Float64(t / l) <= 0.1) tmp = asin(1.0); 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 ((t / l) <= -20000000.0) tmp = asin((-l / (t / sqrt(0.5)))); elseif ((t / l) <= 0.1) tmp = asin(1.0); else tmp = asin((l / (t * sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -20000000.0], N[ArcSin[N[((-l) / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.1], N[ArcSin[1.0], $MachinePrecision], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -20000000:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{\frac{t}{\sqrt{0.5}}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.1:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -2e7Initial program 66.0%
Taylor expanded in t around -inf 78.4%
associate-*r*78.4%
*-commutative78.4%
unpow278.4%
unpow278.4%
times-frac99.5%
unpow299.5%
associate-/l*98.3%
associate-*r/98.3%
neg-mul-198.3%
Simplified98.3%
Taylor expanded in Om around 0 97.2%
if -2e7 < (/.f64 t l) < 0.10000000000000001Initial program 97.4%
Taylor expanded in t around 0 86.4%
unpow286.4%
unpow286.4%
times-frac96.2%
unpow296.2%
Simplified96.2%
Taylor expanded in Om around 0 95.4%
if 0.10000000000000001 < (/.f64 t l) Initial program 65.3%
sqrt-div65.3%
div-inv65.3%
add-sqr-sqrt65.3%
hypot-1-def65.3%
*-commutative65.3%
sqrt-prod65.1%
unpow265.1%
sqrt-prod98.6%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate-*r/98.7%
*-rgt-identity98.7%
Simplified98.7%
Taylor expanded in Om around 0 96.8%
Taylor expanded in t around inf 97.4%
Final simplification96.3%
(FPCore (t l Om Omc) :precision binary64 (if (<= l -2.2e-199) (asin 1.0) (if (<= l 3.5e+37) (asin (/ l (* t (sqrt 2.0)))) (asin 1.0))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -2.2e-199) {
tmp = asin(1.0);
} else if (l <= 3.5e+37) {
tmp = asin((l / (t * sqrt(2.0))));
} else {
tmp = asin(1.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 <= (-2.2d-199)) then
tmp = asin(1.0d0)
else if (l <= 3.5d+37) then
tmp = asin((l / (t * sqrt(2.0d0))))
else
tmp = asin(1.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -2.2e-199) {
tmp = Math.asin(1.0);
} else if (l <= 3.5e+37) {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
} else {
tmp = Math.asin(1.0);
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if l <= -2.2e-199: tmp = math.asin(1.0) elif l <= 3.5e+37: tmp = math.asin((l / (t * math.sqrt(2.0)))) else: tmp = math.asin(1.0) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (l <= -2.2e-199) tmp = asin(1.0); elseif (l <= 3.5e+37) tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); else tmp = asin(1.0); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (l <= -2.2e-199) tmp = asin(1.0); elseif (l <= 3.5e+37) tmp = asin((l / (t * sqrt(2.0)))); else tmp = asin(1.0); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, -2.2e-199], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, 3.5e+37], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.2 \cdot 10^{-199}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;\ell \leq 3.5 \cdot 10^{+37}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -2.1999999999999998e-199 or 3.5e37 < l Initial program 87.9%
Taylor expanded in t around 0 63.4%
unpow263.4%
unpow263.4%
times-frac71.4%
unpow271.4%
Simplified71.4%
Taylor expanded in Om around 0 70.8%
if -2.1999999999999998e-199 < l < 3.5e37Initial program 71.9%
sqrt-div71.9%
div-inv71.9%
add-sqr-sqrt71.9%
hypot-1-def71.9%
*-commutative71.9%
sqrt-prod71.9%
unpow271.9%
sqrt-prod35.1%
add-sqr-sqrt98.7%
Applied egg-rr98.7%
associate-*r/98.7%
*-rgt-identity98.7%
Simplified98.7%
Taylor expanded in Om around 0 97.9%
Taylor expanded in t around inf 49.7%
Final simplification63.9%
(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 82.7%
Taylor expanded in t around 0 48.1%
unpow248.1%
unpow248.1%
times-frac53.7%
unpow253.7%
Simplified53.7%
Taylor expanded in Om around 0 53.3%
Final simplification53.3%
herbie shell --seed 2024011
(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)))))))