
(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 (/ (sqrt 2.0) l))))))
double code(double t, double l, double Om, double Omc) {
return asin((sqrt((1.0 - pow((Om / Omc), 2.0))) / hypot(1.0, (t * (sqrt(2.0) / l)))));
}
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 * (Math.sqrt(2.0) / l)))));
}
def code(t, l, Om, Omc): return math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) / math.hypot(1.0, (t * (math.sqrt(2.0) / l)))))
function code(t, l, Om, Omc) return asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) / hypot(1.0, Float64(t * Float64(sqrt(2.0) / l))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) / hypot(1.0, (t * (sqrt(2.0) / l))))); 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[(t * N[(N[Sqrt[2.0], $MachinePrecision] / l), $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, t \cdot \frac{\sqrt{2}}{\ell}\right)}\right)
\end{array}
Initial program 80.7%
sqrt-div80.6%
div-inv80.6%
add-sqr-sqrt80.6%
hypot-1-def80.6%
*-commutative80.6%
sqrt-prod80.6%
unpow280.6%
sqrt-prod52.7%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
associate-*r/97.9%
*-rgt-identity97.9%
associate-*l/97.9%
associate-/l*97.9%
Simplified97.9%
Final simplification97.9%
(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.7%
sqrt-div80.6%
div-inv80.6%
add-sqr-sqrt80.6%
hypot-1-def80.6%
*-commutative80.6%
sqrt-prod80.6%
unpow280.6%
sqrt-prod52.7%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
associate-*r/97.9%
*-rgt-identity97.9%
associate-*l/97.9%
associate-/l*97.9%
Simplified97.9%
Taylor expanded in Om around 0 97.8%
metadata-eval97.8%
*-un-lft-identity97.8%
Applied egg-rr97.8%
*-lft-identity97.8%
Simplified97.8%
Final simplification97.8%
(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(t / Float64(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[(t / N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)
\end{array}
Initial program 80.7%
sqrt-div80.6%
div-inv80.6%
add-sqr-sqrt80.6%
hypot-1-def80.6%
*-commutative80.6%
sqrt-prod80.6%
unpow280.6%
sqrt-prod52.7%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
associate-*r/97.9%
*-rgt-identity97.9%
associate-*l/97.9%
associate-/l*97.9%
Simplified97.9%
Taylor expanded in Om around 0 97.8%
metadata-eval97.8%
*-un-lft-identity97.8%
Applied egg-rr97.8%
*-lft-identity97.8%
Simplified97.8%
clear-num97.8%
un-div-inv97.9%
Applied egg-rr97.9%
Final simplification97.9%
(FPCore (t l Om Omc) :precision binary64 (if (or (<= t 2.6e-12) (and (not (<= t 6.6e+62)) (<= t 9.5e+101))) (asin 1.0) (asin (* l (/ (sqrt 0.5) t)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t <= 2.6e-12) || (!(t <= 6.6e+62) && (t <= 9.5e+101))) {
tmp = asin(1.0);
} else {
tmp = asin((l * (sqrt(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 <= 2.6d-12) .or. (.not. (t <= 6.6d+62)) .and. (t <= 9.5d+101)) then
tmp = asin(1.0d0)
else
tmp = asin((l * (sqrt(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 <= 2.6e-12) || (!(t <= 6.6e+62) && (t <= 9.5e+101))) {
tmp = Math.asin(1.0);
} else {
tmp = Math.asin((l * (Math.sqrt(0.5) / t)));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t <= 2.6e-12) or (not (t <= 6.6e+62) and (t <= 9.5e+101)): tmp = math.asin(1.0) else: tmp = math.asin((l * (math.sqrt(0.5) / t))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if ((t <= 2.6e-12) || (!(t <= 6.6e+62) && (t <= 9.5e+101))) tmp = asin(1.0); else tmp = asin(Float64(l * Float64(sqrt(0.5) / t))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t <= 2.6e-12) || (~((t <= 6.6e+62)) && (t <= 9.5e+101))) tmp = asin(1.0); else tmp = asin((l * (sqrt(0.5) / t))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[Or[LessEqual[t, 2.6e-12], And[N[Not[LessEqual[t, 6.6e+62]], $MachinePrecision], LessEqual[t, 9.5e+101]]], N[ArcSin[1.0], $MachinePrecision], N[ArcSin[N[(l * N[(N[Sqrt[0.5], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.6 \cdot 10^{-12} \lor \neg \left(t \leq 6.6 \cdot 10^{+62}\right) \land t \leq 9.5 \cdot 10^{+101}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\\
\end{array}
\end{array}
if t < 2.59999999999999983e-12 or 6.6e62 < t < 9.49999999999999947e101Initial program 85.9%
sqrt-div85.8%
div-inv85.8%
add-sqr-sqrt85.7%
hypot-1-def85.7%
*-commutative85.7%
sqrt-prod85.7%
unpow285.7%
sqrt-prod53.9%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate-*r/98.2%
*-rgt-identity98.2%
associate-*l/98.3%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in Om around 0 98.2%
Taylor expanded in t around 0 59.4%
if 2.59999999999999983e-12 < t < 6.6e62 or 9.49999999999999947e101 < t Initial program 62.7%
Taylor expanded in t around inf 53.5%
associate-/l*53.4%
associate-*l*53.4%
unpow253.4%
unpow253.4%
times-frac56.1%
unpow256.1%
Simplified56.1%
Taylor expanded in Om around 0 56.1%
associate-/l*56.1%
Simplified56.1%
Final simplification58.7%
(FPCore (t l Om Omc)
:precision binary64
(if (<= t 1.35e-9)
(asin 1.0)
(if (<= t 5.2e+62)
(asin (* l (/ (sqrt 0.5) t)))
(if (<= t 9.5e+101) (asin 1.0) (asin (/ l (* t (sqrt 2.0))))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (t <= 1.35e-9) {
tmp = asin(1.0);
} else if (t <= 5.2e+62) {
tmp = asin((l * (sqrt(0.5) / t)));
} else if (t <= 9.5e+101) {
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 <= 1.35d-9) then
tmp = asin(1.0d0)
else if (t <= 5.2d+62) then
tmp = asin((l * (sqrt(0.5d0) / t)))
else if (t <= 9.5d+101) 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 <= 1.35e-9) {
tmp = Math.asin(1.0);
} else if (t <= 5.2e+62) {
tmp = Math.asin((l * (Math.sqrt(0.5) / t)));
} else if (t <= 9.5e+101) {
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 <= 1.35e-9: tmp = math.asin(1.0) elif t <= 5.2e+62: tmp = math.asin((l * (math.sqrt(0.5) / t))) elif t <= 9.5e+101: 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 (t <= 1.35e-9) tmp = asin(1.0); elseif (t <= 5.2e+62) tmp = asin(Float64(l * Float64(sqrt(0.5) / t))); elseif (t <= 9.5e+101) 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 <= 1.35e-9) tmp = asin(1.0); elseif (t <= 5.2e+62) tmp = asin((l * (sqrt(0.5) / t))); elseif (t <= 9.5e+101) tmp = asin(1.0); else tmp = asin((l / (t * sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[t, 1.35e-9], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[t, 5.2e+62], N[ArcSin[N[(l * N[(N[Sqrt[0.5], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 9.5e+101], 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}\;t \leq 1.35 \cdot 10^{-9}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{+62}:\\
\;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{+101}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if t < 1.3500000000000001e-9 or 5.19999999999999968e62 < t < 9.49999999999999947e101Initial program 85.9%
sqrt-div85.8%
div-inv85.8%
add-sqr-sqrt85.7%
hypot-1-def85.7%
*-commutative85.7%
sqrt-prod85.7%
unpow285.7%
sqrt-prod53.9%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate-*r/98.2%
*-rgt-identity98.2%
associate-*l/98.3%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in Om around 0 98.2%
Taylor expanded in t around 0 59.4%
if 1.3500000000000001e-9 < t < 5.19999999999999968e62Initial program 62.5%
Taylor expanded in t around inf 34.3%
associate-/l*34.2%
associate-*l*34.2%
unpow234.2%
unpow234.2%
times-frac41.5%
unpow241.5%
Simplified41.5%
Taylor expanded in Om around 0 41.6%
associate-/l*41.5%
Simplified41.5%
if 9.49999999999999947e101 < t Initial program 62.9%
sqrt-div62.9%
div-inv62.9%
add-sqr-sqrt62.9%
hypot-1-def62.9%
*-commutative62.9%
sqrt-prod62.9%
unpow262.9%
sqrt-prod52.1%
add-sqr-sqrt96.5%
Applied egg-rr96.5%
associate-*r/96.5%
*-rgt-identity96.5%
associate-*l/96.5%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in Om around 0 96.5%
Taylor expanded in t around inf 64.5%
Final simplification58.7%
(FPCore (t l Om Omc)
:precision binary64
(if (<= t 8e-12)
(asin 1.0)
(if (<= t 6e+62)
(asin (/ (* l (sqrt 0.5)) t))
(if (<= t 9.6e+101) (asin 1.0) (asin (/ l (* t (sqrt 2.0))))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (t <= 8e-12) {
tmp = asin(1.0);
} else if (t <= 6e+62) {
tmp = asin(((l * sqrt(0.5)) / t));
} else if (t <= 9.6e+101) {
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 <= 8d-12) then
tmp = asin(1.0d0)
else if (t <= 6d+62) then
tmp = asin(((l * sqrt(0.5d0)) / t))
else if (t <= 9.6d+101) 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 <= 8e-12) {
tmp = Math.asin(1.0);
} else if (t <= 6e+62) {
tmp = Math.asin(((l * Math.sqrt(0.5)) / t));
} else if (t <= 9.6e+101) {
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 <= 8e-12: tmp = math.asin(1.0) elif t <= 6e+62: tmp = math.asin(((l * math.sqrt(0.5)) / t)) elif t <= 9.6e+101: 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 (t <= 8e-12) tmp = asin(1.0); elseif (t <= 6e+62) tmp = asin(Float64(Float64(l * sqrt(0.5)) / t)); elseif (t <= 9.6e+101) 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 <= 8e-12) tmp = asin(1.0); elseif (t <= 6e+62) tmp = asin(((l * sqrt(0.5)) / t)); elseif (t <= 9.6e+101) tmp = asin(1.0); else tmp = asin((l / (t * sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[t, 8e-12], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[t, 6e+62], N[ArcSin[N[(N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 9.6e+101], 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}\;t \leq 8 \cdot 10^{-12}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+62}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\
\mathbf{elif}\;t \leq 9.6 \cdot 10^{+101}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if t < 7.99999999999999984e-12 or 6e62 < t < 9.59999999999999953e101Initial program 85.9%
sqrt-div85.8%
div-inv85.8%
add-sqr-sqrt85.7%
hypot-1-def85.7%
*-commutative85.7%
sqrt-prod85.7%
unpow285.7%
sqrt-prod53.9%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate-*r/98.2%
*-rgt-identity98.2%
associate-*l/98.3%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in Om around 0 98.2%
Taylor expanded in t around 0 59.4%
if 7.99999999999999984e-12 < t < 6e62Initial program 62.5%
Taylor expanded in t around inf 34.3%
associate-/l*34.2%
associate-*l*34.2%
unpow234.2%
unpow234.2%
times-frac41.5%
unpow241.5%
Simplified41.5%
Taylor expanded in Om around 0 41.6%
if 9.59999999999999953e101 < t Initial program 62.9%
sqrt-div62.9%
div-inv62.9%
add-sqr-sqrt62.9%
hypot-1-def62.9%
*-commutative62.9%
sqrt-prod62.9%
unpow262.9%
sqrt-prod52.1%
add-sqr-sqrt96.5%
Applied egg-rr96.5%
associate-*r/96.5%
*-rgt-identity96.5%
associate-*l/96.5%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in Om around 0 96.5%
Taylor expanded in t around inf 64.5%
Final simplification58.7%
(FPCore (t l Om Omc)
:precision binary64
(if (<= t 1.05e-10)
(asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(if (<= t 5.6e+62)
(asin (/ (* l (sqrt 0.5)) t))
(if (<= t 9.5e+101) (asin 1.0) (asin (/ l (* t (sqrt 2.0))))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (t <= 1.05e-10) {
tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else if (t <= 5.6e+62) {
tmp = asin(((l * sqrt(0.5)) / t));
} else if (t <= 9.5e+101) {
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 <= 1.05d-10) then
tmp = asin(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
else if (t <= 5.6d+62) then
tmp = asin(((l * sqrt(0.5d0)) / t))
else if (t <= 9.5d+101) 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 <= 1.05e-10) {
tmp = Math.asin(Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else if (t <= 5.6e+62) {
tmp = Math.asin(((l * Math.sqrt(0.5)) / t));
} else if (t <= 9.5e+101) {
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 <= 1.05e-10: tmp = math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om))))) elif t <= 5.6e+62: tmp = math.asin(((l * math.sqrt(0.5)) / t)) elif t <= 9.5e+101: 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 (t <= 1.05e-10) tmp = asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))); elseif (t <= 5.6e+62) tmp = asin(Float64(Float64(l * sqrt(0.5)) / t)); elseif (t <= 9.5e+101) 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 <= 1.05e-10) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); elseif (t <= 5.6e+62) tmp = asin(((l * sqrt(0.5)) / t)); elseif (t <= 9.5e+101) tmp = asin(1.0); else tmp = asin((l / (t * sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[t, 1.05e-10], N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 5.6e+62], N[ArcSin[N[(N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 9.5e+101], 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}\;t \leq 1.05 \cdot 10^{-10}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\
\mathbf{elif}\;t \leq 5.6 \cdot 10^{+62}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{+101}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if t < 1.05e-10Initial program 85.7%
Taylor expanded in t around 0 52.5%
unpow252.5%
unpow252.5%
times-frac58.8%
unpow258.8%
Simplified58.8%
unpow258.8%
clear-num58.8%
un-div-inv58.8%
Applied egg-rr58.8%
if 1.05e-10 < t < 5.60000000000000029e62Initial program 62.5%
Taylor expanded in t around inf 34.3%
associate-/l*34.2%
associate-*l*34.2%
unpow234.2%
unpow234.2%
times-frac41.5%
unpow241.5%
Simplified41.5%
Taylor expanded in Om around 0 41.6%
if 5.60000000000000029e62 < t < 9.49999999999999947e101Initial program 95.5%
sqrt-div95.5%
div-inv95.5%
add-sqr-sqrt95.5%
hypot-1-def95.5%
*-commutative95.5%
sqrt-prod95.5%
unpow295.5%
sqrt-prod50.0%
add-sqr-sqrt95.5%
Applied egg-rr95.5%
associate-*r/95.5%
*-rgt-identity95.5%
associate-*l/95.5%
associate-/l*95.5%
Simplified95.5%
Taylor expanded in Om around 0 95.5%
Taylor expanded in t around 0 95.5%
if 9.49999999999999947e101 < t Initial program 62.9%
sqrt-div62.9%
div-inv62.9%
add-sqr-sqrt62.9%
hypot-1-def62.9%
*-commutative62.9%
sqrt-prod62.9%
unpow262.9%
sqrt-prod52.1%
add-sqr-sqrt96.5%
Applied egg-rr96.5%
associate-*r/96.5%
*-rgt-identity96.5%
associate-*l/96.5%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in Om around 0 96.5%
Taylor expanded in t around inf 64.5%
Final simplification58.8%
(FPCore (t l Om Omc)
:precision binary64
(if (<= t 3.6e-10)
(asin (sqrt (+ 1.0 (+ 1.0 (- -1.0 (/ (/ Om Omc) (/ Omc Om)))))))
(if (<= t 6.6e+62)
(asin (/ (* l (sqrt 0.5)) t))
(if (<= t 9.5e+101) (asin 1.0) (asin (/ l (* t (sqrt 2.0))))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (t <= 3.6e-10) {
tmp = asin(sqrt((1.0 + (1.0 + (-1.0 - ((Om / Omc) / (Omc / Om)))))));
} else if (t <= 6.6e+62) {
tmp = asin(((l * sqrt(0.5)) / t));
} else if (t <= 9.5e+101) {
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 <= 3.6d-10) then
tmp = asin(sqrt((1.0d0 + (1.0d0 + ((-1.0d0) - ((om / omc) / (omc / om)))))))
else if (t <= 6.6d+62) then
tmp = asin(((l * sqrt(0.5d0)) / t))
else if (t <= 9.5d+101) 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 <= 3.6e-10) {
tmp = Math.asin(Math.sqrt((1.0 + (1.0 + (-1.0 - ((Om / Omc) / (Omc / Om)))))));
} else if (t <= 6.6e+62) {
tmp = Math.asin(((l * Math.sqrt(0.5)) / t));
} else if (t <= 9.5e+101) {
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 <= 3.6e-10: tmp = math.asin(math.sqrt((1.0 + (1.0 + (-1.0 - ((Om / Omc) / (Omc / Om))))))) elif t <= 6.6e+62: tmp = math.asin(((l * math.sqrt(0.5)) / t)) elif t <= 9.5e+101: 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 (t <= 3.6e-10) tmp = asin(sqrt(Float64(1.0 + Float64(1.0 + Float64(-1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))))); elseif (t <= 6.6e+62) tmp = asin(Float64(Float64(l * sqrt(0.5)) / t)); elseif (t <= 9.5e+101) 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 <= 3.6e-10) tmp = asin(sqrt((1.0 + (1.0 + (-1.0 - ((Om / Omc) / (Omc / Om))))))); elseif (t <= 6.6e+62) tmp = asin(((l * sqrt(0.5)) / t)); elseif (t <= 9.5e+101) tmp = asin(1.0); else tmp = asin((l / (t * sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[t, 3.6e-10], N[ArcSin[N[Sqrt[N[(1.0 + N[(1.0 + N[(-1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 6.6e+62], N[ArcSin[N[(N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 9.5e+101], 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}\;t \leq 3.6 \cdot 10^{-10}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 + \left(1 + \left(-1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\right)\right)}\right)\\
\mathbf{elif}\;t \leq 6.6 \cdot 10^{+62}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{+101}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if t < 3.6e-10Initial program 85.7%
Taylor expanded in t around 0 52.5%
unpow252.5%
unpow252.5%
times-frac58.8%
unpow258.8%
Simplified58.8%
expm1-log1p-u58.8%
expm1-undefine58.8%
log1p-undefine58.8%
add-exp-log58.8%
Applied egg-rr58.8%
unpow258.8%
clear-num58.8%
un-div-inv58.8%
Applied egg-rr58.8%
if 3.6e-10 < t < 6.6e62Initial program 62.5%
Taylor expanded in t around inf 34.3%
associate-/l*34.2%
associate-*l*34.2%
unpow234.2%
unpow234.2%
times-frac41.5%
unpow241.5%
Simplified41.5%
Taylor expanded in Om around 0 41.6%
if 6.6e62 < t < 9.49999999999999947e101Initial program 95.5%
sqrt-div95.5%
div-inv95.5%
add-sqr-sqrt95.5%
hypot-1-def95.5%
*-commutative95.5%
sqrt-prod95.5%
unpow295.5%
sqrt-prod50.0%
add-sqr-sqrt95.5%
Applied egg-rr95.5%
associate-*r/95.5%
*-rgt-identity95.5%
associate-*l/95.5%
associate-/l*95.5%
Simplified95.5%
Taylor expanded in Om around 0 95.5%
Taylor expanded in t around 0 95.5%
if 9.49999999999999947e101 < t Initial program 62.9%
sqrt-div62.9%
div-inv62.9%
add-sqr-sqrt62.9%
hypot-1-def62.9%
*-commutative62.9%
sqrt-prod62.9%
unpow262.9%
sqrt-prod52.1%
add-sqr-sqrt96.5%
Applied egg-rr96.5%
associate-*r/96.5%
*-rgt-identity96.5%
associate-*l/96.5%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in Om around 0 96.5%
Taylor expanded in t around inf 64.5%
Final simplification58.8%
(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.7%
sqrt-div80.6%
div-inv80.6%
add-sqr-sqrt80.6%
hypot-1-def80.6%
*-commutative80.6%
sqrt-prod80.6%
unpow280.6%
sqrt-prod52.7%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
associate-*r/97.9%
*-rgt-identity97.9%
associate-*l/97.9%
associate-/l*97.9%
Simplified97.9%
Taylor expanded in Om around 0 97.8%
Taylor expanded in t around 0 49.9%
Final simplification49.9%
herbie shell --seed 2024062
(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)))))))