
(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(Float64(t * 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[(N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / l), $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 \cdot \sqrt{2}}{\ell}\right)}\right)
\end{array}
Initial program 85.7%
sqrt-div85.8%
div-inv85.7%
add-sqr-sqrt85.7%
hypot-1-def85.7%
*-commutative85.7%
sqrt-prod85.7%
sqrt-pow198.4%
metadata-eval98.4%
pow198.4%
Applied egg-rr98.4%
associate-*r/98.4%
*-rgt-identity98.4%
associate-*l/98.4%
Simplified98.4%
(FPCore (t l Om Omc) :precision binary64 (asin (/ (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (hypot 1.0 (* (sqrt 2.0) (/ t l))))))
double code(double t, double l, double Om, double Omc) {
return asin((sqrt((1.0 - pow((Om / Omc), 2.0))) / hypot(1.0, (sqrt(2.0) * (t / 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, (Math.sqrt(2.0) * (t / l)))));
}
def code(t, l, Om, Omc): return math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) / math.hypot(1.0, (math.sqrt(2.0) * (t / l)))))
function code(t, l, Om, Omc) return asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) / hypot(1.0, Float64(sqrt(2.0) * Float64(t / l))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) / hypot(1.0, (sqrt(2.0) * (t / 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[(N[Sqrt[2.0], $MachinePrecision] * N[(t / 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, \sqrt{2} \cdot \frac{t}{\ell}\right)}\right)
\end{array}
Initial program 85.7%
sqrt-div85.8%
add-sqr-sqrt85.8%
hypot-1-def85.8%
*-commutative85.8%
sqrt-prod85.7%
sqrt-pow198.4%
metadata-eval98.4%
pow198.4%
Applied egg-rr98.4%
Final simplification98.4%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) 0.02) (asin (sqrt (- 1.0 (pow (/ Om Omc) 2.0)))) (asin (* l (/ (sqrt 0.5) t)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 0.02) {
tmp = asin(sqrt((1.0 - pow((Om / Omc), 2.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 / l) <= 0.02d0) then
tmp = asin(sqrt((1.0d0 - ((om / omc) ** 2.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 / l) <= 0.02) {
tmp = Math.asin(Math.sqrt((1.0 - Math.pow((Om / Omc), 2.0))));
} else {
tmp = Math.asin((l * (Math.sqrt(0.5) / t)));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 0.02: tmp = math.asin(math.sqrt((1.0 - math.pow((Om / Omc), 2.0)))) else: tmp = math.asin((l * (math.sqrt(0.5) / t))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= 0.02) tmp = asin(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.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 / l) <= 0.02) tmp = asin(sqrt((1.0 - ((Om / Omc) ^ 2.0)))); else tmp = asin((l * (sqrt(0.5) / t))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], 0.02], N[ArcSin[N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l * N[(N[Sqrt[0.5], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 0.02:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 0.0200000000000000004Initial program 91.6%
Taylor expanded in t around 0 65.2%
unpow265.2%
unpow265.2%
times-frac71.6%
unpow271.6%
Simplified71.6%
if 0.0200000000000000004 < (/.f64 t l) Initial program 70.2%
Taylor expanded in t around inf 89.5%
*-commutative89.5%
associate-/l*89.5%
unpow289.5%
unpow289.5%
times-frac99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in Om around 0 98.4%
Final simplification78.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 85.7%
sqrt-div85.8%
div-inv85.7%
add-sqr-sqrt85.7%
hypot-1-def85.7%
*-commutative85.7%
sqrt-prod85.7%
sqrt-pow198.4%
metadata-eval98.4%
pow198.4%
Applied egg-rr98.4%
associate-*r/98.4%
*-rgt-identity98.4%
associate-*l/98.4%
Simplified98.4%
Taylor expanded in Om around 0 97.7%
expm1-log1p-u97.6%
expm1-undefine65.9%
associate-/l*65.9%
Applied egg-rr65.9%
log1p-undefine65.9%
rem-exp-log65.9%
+-commutative65.9%
associate--l+97.7%
metadata-eval97.7%
+-commutative97.7%
+-lft-identity97.7%
Simplified97.7%
(FPCore (t l Om Omc) :precision binary64 (if (or (<= t 1.7e-22) (and (not (<= t 115000.0)) (<= t 2.55e+91))) (asin 1.0) (asin (/ l (* t (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t <= 1.7e-22) || (!(t <= 115000.0) && (t <= 2.55e+91))) {
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.7d-22) .or. (.not. (t <= 115000.0d0)) .and. (t <= 2.55d+91)) 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.7e-22) || (!(t <= 115000.0) && (t <= 2.55e+91))) {
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.7e-22) or (not (t <= 115000.0) and (t <= 2.55e+91)): 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.7e-22) || (!(t <= 115000.0) && (t <= 2.55e+91))) 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.7e-22) || (~((t <= 115000.0)) && (t <= 2.55e+91))) tmp = asin(1.0); else tmp = asin((l / (t * sqrt(2.0)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[Or[LessEqual[t, 1.7e-22], And[N[Not[LessEqual[t, 115000.0]], $MachinePrecision], LessEqual[t, 2.55e+91]]], 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.7 \cdot 10^{-22} \lor \neg \left(t \leq 115000\right) \land t \leq 2.55 \cdot 10^{+91}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if t < 1.6999999999999999e-22 or 115000 < t < 2.55000000000000007e91Initial program 89.7%
Taylor expanded in t around 0 56.8%
unpow256.8%
unpow256.8%
times-frac62.4%
unpow262.4%
Simplified62.4%
Taylor expanded in Om around 0 61.9%
if 1.6999999999999999e-22 < t < 115000 or 2.55000000000000007e91 < t Initial program 72.5%
sqrt-div72.5%
div-inv72.5%
add-sqr-sqrt72.5%
hypot-1-def72.5%
*-commutative72.5%
sqrt-prod72.5%
sqrt-pow197.5%
metadata-eval97.5%
pow197.5%
Applied egg-rr97.5%
associate-*r/97.5%
*-rgt-identity97.5%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in Om around 0 97.4%
Taylor expanded in t around inf 57.1%
Final simplification60.8%
(FPCore (t l Om Omc)
:precision binary64
(if (<= t 1.7e-22)
(asin 1.0)
(if (<= t 60000.0)
(asin (/ l (* t (sqrt 2.0))))
(if (<= t 4.2e+91) (asin 1.0) (asin (* l (/ (sqrt 0.5) t)))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (t <= 1.7e-22) {
tmp = asin(1.0);
} else if (t <= 60000.0) {
tmp = asin((l / (t * sqrt(2.0))));
} else if (t <= 4.2e+91) {
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 <= 1.7d-22) then
tmp = asin(1.0d0)
else if (t <= 60000.0d0) then
tmp = asin((l / (t * sqrt(2.0d0))))
else if (t <= 4.2d+91) 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 <= 1.7e-22) {
tmp = Math.asin(1.0);
} else if (t <= 60000.0) {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
} else if (t <= 4.2e+91) {
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 <= 1.7e-22: tmp = math.asin(1.0) elif t <= 60000.0: tmp = math.asin((l / (t * math.sqrt(2.0)))) elif t <= 4.2e+91: 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 <= 1.7e-22) tmp = asin(1.0); elseif (t <= 60000.0) tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); elseif (t <= 4.2e+91) 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 <= 1.7e-22) tmp = asin(1.0); elseif (t <= 60000.0) tmp = asin((l / (t * sqrt(2.0)))); elseif (t <= 4.2e+91) tmp = asin(1.0); else tmp = asin((l * (sqrt(0.5) / t))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[t, 1.7e-22], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[t, 60000.0], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 4.2e+91], 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 1.7 \cdot 10^{-22}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;t \leq 60000:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;t \leq 4.2 \cdot 10^{+91}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\\
\end{array}
\end{array}
if t < 1.6999999999999999e-22 or 6e4 < t < 4.20000000000000015e91Initial program 89.7%
Taylor expanded in t around 0 56.8%
unpow256.8%
unpow256.8%
times-frac62.4%
unpow262.4%
Simplified62.4%
Taylor expanded in Om around 0 61.9%
if 1.6999999999999999e-22 < t < 6e4Initial program 65.8%
sqrt-div65.8%
div-inv65.8%
add-sqr-sqrt65.8%
hypot-1-def65.8%
*-commutative65.8%
sqrt-prod65.6%
sqrt-pow199.6%
metadata-eval99.6%
pow199.6%
Applied egg-rr99.6%
associate-*r/99.6%
*-rgt-identity99.6%
associate-*l/99.3%
Simplified99.3%
Taylor expanded in Om around 0 99.3%
Taylor expanded in t around inf 37.9%
if 4.20000000000000015e91 < t Initial program 74.0%
Taylor expanded in t around inf 52.7%
*-commutative52.7%
associate-/l*52.8%
unpow252.8%
unpow252.8%
times-frac61.4%
unpow261.4%
Simplified61.4%
Taylor expanded in Om around 0 61.4%
Final simplification60.7%
(FPCore (t l Om Omc)
:precision binary64
(if (<= t 1.7e-22)
(asin 1.0)
(if (<= t 195000.0)
(asin (/ l (* t (sqrt 2.0))))
(if (<= t 2.3e+91) (asin 1.0) (asin (/ (/ l t) (sqrt 2.0)))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (t <= 1.7e-22) {
tmp = asin(1.0);
} else if (t <= 195000.0) {
tmp = asin((l / (t * sqrt(2.0))));
} else if (t <= 2.3e+91) {
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.7d-22) then
tmp = asin(1.0d0)
else if (t <= 195000.0d0) then
tmp = asin((l / (t * sqrt(2.0d0))))
else if (t <= 2.3d+91) 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.7e-22) {
tmp = Math.asin(1.0);
} else if (t <= 195000.0) {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
} else if (t <= 2.3e+91) {
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.7e-22: tmp = math.asin(1.0) elif t <= 195000.0: tmp = math.asin((l / (t * math.sqrt(2.0)))) elif t <= 2.3e+91: 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.7e-22) tmp = asin(1.0); elseif (t <= 195000.0) tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); elseif (t <= 2.3e+91) tmp = asin(1.0); else tmp = asin(Float64(Float64(l / t) / sqrt(2.0))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (t <= 1.7e-22) tmp = asin(1.0); elseif (t <= 195000.0) tmp = asin((l / (t * sqrt(2.0)))); elseif (t <= 2.3e+91) 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.7e-22], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[t, 195000.0], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 2.3e+91], N[ArcSin[1.0], $MachinePrecision], N[ArcSin[N[(N[(l / t), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.7 \cdot 10^{-22}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;t \leq 195000:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{+91}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\frac{\ell}{t}}{\sqrt{2}}\right)\\
\end{array}
\end{array}
if t < 1.6999999999999999e-22 or 195000 < t < 2.29999999999999991e91Initial program 89.7%
Taylor expanded in t around 0 56.8%
unpow256.8%
unpow256.8%
times-frac62.4%
unpow262.4%
Simplified62.4%
Taylor expanded in Om around 0 61.9%
if 1.6999999999999999e-22 < t < 195000Initial program 65.8%
sqrt-div65.8%
div-inv65.8%
add-sqr-sqrt65.8%
hypot-1-def65.8%
*-commutative65.8%
sqrt-prod65.6%
sqrt-pow199.6%
metadata-eval99.6%
pow199.6%
Applied egg-rr99.6%
associate-*r/99.6%
*-rgt-identity99.6%
associate-*l/99.3%
Simplified99.3%
Taylor expanded in Om around 0 99.3%
Taylor expanded in t around inf 37.9%
if 2.29999999999999991e91 < t Initial program 74.0%
sqrt-div74.1%
div-inv74.1%
add-sqr-sqrt74.1%
hypot-1-def74.1%
*-commutative74.1%
sqrt-prod74.1%
sqrt-pow197.0%
metadata-eval97.0%
pow197.0%
Applied egg-rr97.0%
associate-*r/97.0%
*-rgt-identity97.0%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in Om around 0 97.0%
Taylor expanded in t around inf 61.4%
associate-/r*61.5%
Simplified61.5%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) 0.02) (asin (- 1.0 (pow (/ t l) 2.0))) (asin (* l (/ (sqrt 0.5) t)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= 0.02) {
tmp = asin((1.0 - pow((t / l), 2.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 / l) <= 0.02d0) then
tmp = asin((1.0d0 - ((t / l) ** 2.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 / l) <= 0.02) {
tmp = Math.asin((1.0 - Math.pow((t / l), 2.0)));
} else {
tmp = Math.asin((l * (Math.sqrt(0.5) / t)));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= 0.02: tmp = math.asin((1.0 - math.pow((t / l), 2.0))) else: tmp = math.asin((l * (math.sqrt(0.5) / t))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= 0.02) tmp = asin(Float64(1.0 - (Float64(t / l) ^ 2.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 / l) <= 0.02) tmp = asin((1.0 - ((t / l) ^ 2.0))); else tmp = asin((l * (sqrt(0.5) / t))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], 0.02], N[ArcSin[N[(1.0 - N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l * N[(N[Sqrt[0.5], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq 0.02:\\
\;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\ell \cdot \frac{\sqrt{0.5}}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 0.0200000000000000004Initial program 91.6%
sqrt-div91.6%
div-inv91.6%
add-sqr-sqrt91.6%
hypot-1-def91.6%
*-commutative91.6%
sqrt-prod91.6%
sqrt-pow198.1%
metadata-eval98.1%
pow198.1%
Applied egg-rr98.1%
associate-*r/98.1%
*-rgt-identity98.1%
associate-*l/98.0%
Simplified98.0%
Taylor expanded in Om around 0 97.5%
Taylor expanded in t around 0 59.8%
associate-/l*59.8%
*-commutative59.8%
associate-*l*59.8%
associate-*r/59.8%
associate-*l/59.8%
unpow259.8%
rem-square-sqrt59.8%
metadata-eval59.8%
associate-/l*59.8%
unpow259.8%
unpow259.8%
times-frac69.9%
unpow269.9%
Simplified69.9%
if 0.0200000000000000004 < (/.f64 t l) Initial program 70.2%
Taylor expanded in t around inf 89.5%
*-commutative89.5%
associate-/l*89.5%
unpow289.5%
unpow289.5%
times-frac99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in Om around 0 98.4%
Final simplification77.7%
(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 85.7%
Taylor expanded in t around 0 48.6%
unpow248.6%
unpow248.6%
times-frac53.4%
unpow253.4%
Simplified53.4%
Taylor expanded in Om around 0 53.0%
herbie shell --seed 2024111
(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)))))))