
(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 8 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}
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(if (<= (/ t_m l) -2e+160)
(asin (/ (- l) (* t_m (sqrt 2.0))))
(if (<= (/ t_m l) 5e+105)
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ (/ t_m l) (/ l t_m)))))))
(asin (/ l (/ t_m (sqrt 0.5)))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double tmp;
if ((t_m / l) <= -2e+160) {
tmp = asin((-l / (t_m * sqrt(2.0))));
} else if ((t_m / l) <= 5e+105) {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t_m / l) / (l / t_m)))))));
} else {
tmp = asin((l / (t_m / sqrt(0.5))));
}
return tmp;
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: tmp
if ((t_m / l) <= (-2d+160)) then
tmp = asin((-l / (t_m * sqrt(2.0d0))))
else if ((t_m / l) <= 5d+105) then
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t_m / l) / (l / t_m)))))))
else
tmp = asin((l / (t_m / sqrt(0.5d0))))
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
double tmp;
if ((t_m / l) <= -2e+160) {
tmp = Math.asin((-l / (t_m * Math.sqrt(2.0))));
} else if ((t_m / l) <= 5e+105) {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t_m / l) / (l / t_m)))))));
} else {
tmp = Math.asin((l / (t_m / Math.sqrt(0.5))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): tmp = 0 if (t_m / l) <= -2e+160: tmp = math.asin((-l / (t_m * math.sqrt(2.0)))) elif (t_m / l) <= 5e+105: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t_m / l) / (l / t_m))))))) else: tmp = math.asin((l / (t_m / math.sqrt(0.5)))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) tmp = 0.0 if (Float64(t_m / l) <= -2e+160) tmp = asin(Float64(Float64(-l) / Float64(t_m * sqrt(2.0)))); elseif (Float64(t_m / l) <= 5e+105) tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(Float64(t_m / l) / Float64(l / t_m))))))); else tmp = asin(Float64(l / Float64(t_m / sqrt(0.5)))); end return tmp end
t_m = abs(t); function tmp_2 = code(t_m, l, Om, Omc) tmp = 0.0; if ((t_m / l) <= -2e+160) tmp = asin((-l / (t_m * sqrt(2.0)))); elseif ((t_m / l) <= 5e+105) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t_m / l) / (l / t_m))))))); else tmp = asin((l / (t_m / sqrt(0.5)))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := If[LessEqual[N[(t$95$m / l), $MachinePrecision], -2e+160], N[ArcSin[N[((-l) / N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t$95$m / l), $MachinePrecision], 5e+105], 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$95$m / l), $MachinePrecision] / N[(l / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(l / N[(t$95$m / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{t_m}{\ell} \leq -2 \cdot 10^{+160}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_m \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\frac{t_m}{\ell} \leq 5 \cdot 10^{+105}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{\frac{t_m}{\ell}}{\frac{\ell}{t_m}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{\frac{t_m}{\sqrt{0.5}}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -2.00000000000000001e160Initial program 48.2%
sqrt-div48.2%
div-inv48.2%
add-sqr-sqrt48.2%
hypot-1-def48.2%
*-commutative48.2%
sqrt-prod48.2%
unpow248.2%
sqrt-prod0.0%
add-sqr-sqrt95.8%
Applied egg-rr95.8%
associate-*r/95.8%
*-rgt-identity95.8%
Simplified95.8%
Taylor expanded in Om around 0 95.8%
Taylor expanded in t around -inf 99.6%
associate-*r/99.6%
mul-1-neg99.6%
Simplified99.6%
if -2.00000000000000001e160 < (/.f64 t l) < 5.00000000000000046e105Initial program 97.5%
unpow297.5%
clear-num97.5%
un-div-inv97.5%
Applied egg-rr97.5%
unpow297.5%
clear-num97.5%
un-div-inv97.5%
Applied egg-rr97.5%
if 5.00000000000000046e105 < (/.f64 t l) Initial program 59.0%
Taylor expanded in t around inf 83.3%
*-commutative83.3%
unpow283.3%
unpow283.3%
times-frac99.4%
unpow299.4%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in Om around 0 98.8%
Final simplification98.0%
t_m = (fabs.f64 t) (FPCore (t_m l Om Omc) :precision binary64 (asin (/ (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (hypot 1.0 (* (/ t_m l) (sqrt 2.0))))))
t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
return asin((sqrt((1.0 - pow((Om / Omc), 2.0))) / hypot(1.0, ((t_m / l) * sqrt(2.0)))));
}
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
return Math.asin((Math.sqrt((1.0 - Math.pow((Om / Omc), 2.0))) / Math.hypot(1.0, ((t_m / l) * Math.sqrt(2.0)))));
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): return math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) / math.hypot(1.0, ((t_m / l) * math.sqrt(2.0)))))
t_m = abs(t) function code(t_m, l, Om, Omc) return asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) / hypot(1.0, Float64(Float64(t_m / l) * sqrt(2.0))))) end
t_m = abs(t); function tmp = code(t_m, l, Om, Omc) tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) / hypot(1.0, ((t_m / l) * sqrt(2.0))))); end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, 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$95$m / l), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sin^{-1} \left(\frac{\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}}{\mathsf{hypot}\left(1, \frac{t_m}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Initial program 84.0%
sqrt-div84.0%
div-inv84.0%
add-sqr-sqrt84.0%
hypot-1-def84.0%
*-commutative84.0%
sqrt-prod83.9%
unpow283.9%
sqrt-prod53.7%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
associate-*r/98.4%
*-rgt-identity98.4%
Simplified98.4%
Final simplification98.4%
t_m = (fabs.f64 t) (FPCore (t_m l Om Omc) :precision binary64 (asin (/ 1.0 (hypot 1.0 (* (/ t_m l) (sqrt 2.0))))))
t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
return asin((1.0 / hypot(1.0, ((t_m / l) * sqrt(2.0)))));
}
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
return Math.asin((1.0 / Math.hypot(1.0, ((t_m / l) * Math.sqrt(2.0)))));
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): return math.asin((1.0 / math.hypot(1.0, ((t_m / l) * math.sqrt(2.0)))))
t_m = abs(t) function code(t_m, l, Om, Omc) return asin(Float64(1.0 / hypot(1.0, Float64(Float64(t_m / l) * sqrt(2.0))))) end
t_m = abs(t); function tmp = code(t_m, l, Om, Omc) tmp = asin((1.0 / hypot(1.0, ((t_m / l) * sqrt(2.0))))); end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(t$95$m / l), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{t_m}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Initial program 84.0%
sqrt-div84.0%
div-inv84.0%
add-sqr-sqrt84.0%
hypot-1-def84.0%
*-commutative84.0%
sqrt-prod83.9%
unpow283.9%
sqrt-prod53.7%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
associate-*r/98.4%
*-rgt-identity98.4%
Simplified98.4%
Taylor expanded in Om around 0 97.8%
Final simplification97.8%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(if (<= (/ t_m l) -4e+17)
(asin (/ (- l) (* t_m (sqrt 2.0))))
(if (<= (/ t_m l) 1e-5)
(asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(asin (/ l (/ t_m (sqrt 0.5)))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double tmp;
if ((t_m / l) <= -4e+17) {
tmp = asin((-l / (t_m * sqrt(2.0))));
} else if ((t_m / l) <= 1e-5) {
tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else {
tmp = asin((l / (t_m / sqrt(0.5))));
}
return tmp;
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: tmp
if ((t_m / l) <= (-4d+17)) then
tmp = asin((-l / (t_m * sqrt(2.0d0))))
else if ((t_m / l) <= 1d-5) then
tmp = asin(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
else
tmp = asin((l / (t_m / sqrt(0.5d0))))
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
double tmp;
if ((t_m / l) <= -4e+17) {
tmp = Math.asin((-l / (t_m * Math.sqrt(2.0))));
} else if ((t_m / l) <= 1e-5) {
tmp = Math.asin(Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else {
tmp = Math.asin((l / (t_m / Math.sqrt(0.5))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): tmp = 0 if (t_m / l) <= -4e+17: tmp = math.asin((-l / (t_m * math.sqrt(2.0)))) elif (t_m / l) <= 1e-5: tmp = math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om))))) else: tmp = math.asin((l / (t_m / math.sqrt(0.5)))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) tmp = 0.0 if (Float64(t_m / l) <= -4e+17) tmp = asin(Float64(Float64(-l) / Float64(t_m * sqrt(2.0)))); elseif (Float64(t_m / l) <= 1e-5) tmp = asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))); else tmp = asin(Float64(l / Float64(t_m / sqrt(0.5)))); end return tmp end
t_m = abs(t); function tmp_2 = code(t_m, l, Om, Omc) tmp = 0.0; if ((t_m / l) <= -4e+17) tmp = asin((-l / (t_m * sqrt(2.0)))); elseif ((t_m / l) <= 1e-5) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); else tmp = asin((l / (t_m / sqrt(0.5)))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := If[LessEqual[N[(t$95$m / l), $MachinePrecision], -4e+17], N[ArcSin[N[((-l) / N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t$95$m / l), $MachinePrecision], 1e-5], 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$95$m / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{t_m}{\ell} \leq -4 \cdot 10^{+17}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_m \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\frac{t_m}{\ell} \leq 10^{-5}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{\frac{t_m}{\sqrt{0.5}}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -4e17Initial program 64.9%
sqrt-div64.8%
div-inv64.8%
add-sqr-sqrt64.8%
hypot-1-def64.8%
*-commutative64.8%
sqrt-prod64.8%
unpow264.8%
sqrt-prod0.0%
add-sqr-sqrt97.3%
Applied egg-rr97.3%
associate-*r/97.3%
*-rgt-identity97.3%
Simplified97.3%
Taylor expanded in Om around 0 96.4%
Taylor expanded in t around -inf 98.7%
associate-*r/98.7%
mul-1-neg98.7%
Simplified98.7%
if -4e17 < (/.f64 t l) < 1.00000000000000008e-5Initial program 98.9%
Taylor expanded in t around 0 89.5%
unpow289.5%
unpow289.5%
times-frac98.0%
unpow298.0%
Simplified98.0%
unpow298.9%
clear-num98.9%
un-div-inv98.9%
Applied egg-rr98.0%
if 1.00000000000000008e-5 < (/.f64 t l) Initial program 74.9%
Taylor expanded in t around inf 79.1%
*-commutative79.1%
unpow279.1%
unpow279.1%
times-frac98.7%
unpow298.7%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in Om around 0 98.1%
Final simplification98.2%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(let* ((t_1 (* t_m (sqrt 2.0))))
(if (<= l -4e-28)
(asin 1.0)
(if (<= l -2e-308)
(asin (/ (- l) t_1))
(if (or (<= l 4.8e-73) (and (not (<= l 6500000000.0)) (<= l 1.35e+54)))
(asin (/ l t_1))
(asin 1.0))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double t_1 = t_m * sqrt(2.0);
double tmp;
if (l <= -4e-28) {
tmp = asin(1.0);
} else if (l <= -2e-308) {
tmp = asin((-l / t_1));
} else if ((l <= 4.8e-73) || (!(l <= 6500000000.0) && (l <= 1.35e+54))) {
tmp = asin((l / t_1));
} else {
tmp = asin(1.0);
}
return tmp;
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
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_m * sqrt(2.0d0)
if (l <= (-4d-28)) then
tmp = asin(1.0d0)
else if (l <= (-2d-308)) then
tmp = asin((-l / t_1))
else if ((l <= 4.8d-73) .or. (.not. (l <= 6500000000.0d0)) .and. (l <= 1.35d+54)) then
tmp = asin((l / t_1))
else
tmp = asin(1.0d0)
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
double t_1 = t_m * Math.sqrt(2.0);
double tmp;
if (l <= -4e-28) {
tmp = Math.asin(1.0);
} else if (l <= -2e-308) {
tmp = Math.asin((-l / t_1));
} else if ((l <= 4.8e-73) || (!(l <= 6500000000.0) && (l <= 1.35e+54))) {
tmp = Math.asin((l / t_1));
} else {
tmp = Math.asin(1.0);
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): t_1 = t_m * math.sqrt(2.0) tmp = 0 if l <= -4e-28: tmp = math.asin(1.0) elif l <= -2e-308: tmp = math.asin((-l / t_1)) elif (l <= 4.8e-73) or (not (l <= 6500000000.0) and (l <= 1.35e+54)): tmp = math.asin((l / t_1)) else: tmp = math.asin(1.0) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) t_1 = Float64(t_m * sqrt(2.0)) tmp = 0.0 if (l <= -4e-28) tmp = asin(1.0); elseif (l <= -2e-308) tmp = asin(Float64(Float64(-l) / t_1)); elseif ((l <= 4.8e-73) || (!(l <= 6500000000.0) && (l <= 1.35e+54))) tmp = asin(Float64(l / t_1)); else tmp = asin(1.0); end return tmp end
t_m = abs(t); function tmp_2 = code(t_m, l, Om, Omc) t_1 = t_m * sqrt(2.0); tmp = 0.0; if (l <= -4e-28) tmp = asin(1.0); elseif (l <= -2e-308) tmp = asin((-l / t_1)); elseif ((l <= 4.8e-73) || (~((l <= 6500000000.0)) && (l <= 1.35e+54))) tmp = asin((l / t_1)); else tmp = asin(1.0); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[t$95$m_, l_, Om_, Omc_] := Block[{t$95$1 = N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4e-28], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, -2e-308], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[l, 4.8e-73], And[N[Not[LessEqual[l, 6500000000.0]], $MachinePrecision], LessEqual[l, 1.35e+54]]], N[ArcSin[N[(l / t$95$1), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := t_m \cdot \sqrt{2}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-28}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-308}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{-73} \lor \neg \left(\ell \leq 6500000000\right) \land \ell \leq 1.35 \cdot 10^{+54}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -3.99999999999999988e-28 or 4.80000000000000011e-73 < l < 6.5e9 or 1.35000000000000005e54 < l Initial program 90.3%
Taylor expanded in t around 0 69.2%
unpow269.2%
unpow269.2%
times-frac75.7%
unpow275.7%
Simplified75.7%
Taylor expanded in Om around 0 75.7%
if -3.99999999999999988e-28 < l < -1.9999999999999998e-308Initial program 74.1%
sqrt-div74.1%
div-inv74.1%
add-sqr-sqrt74.1%
hypot-1-def74.1%
*-commutative74.1%
sqrt-prod74.1%
unpow274.1%
sqrt-prod47.2%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
associate-*r/97.2%
*-rgt-identity97.2%
Simplified97.2%
Taylor expanded in Om around 0 95.8%
Taylor expanded in t around -inf 56.8%
associate-*r/56.8%
mul-1-neg56.8%
Simplified56.8%
if -1.9999999999999998e-308 < l < 4.80000000000000011e-73 or 6.5e9 < l < 1.35000000000000005e54Initial program 78.0%
sqrt-div78.0%
div-inv78.0%
add-sqr-sqrt78.0%
hypot-1-def78.0%
*-commutative78.0%
sqrt-prod77.9%
unpow277.9%
sqrt-prod47.5%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
associate-*r/97.2%
*-rgt-identity97.2%
Simplified97.2%
Taylor expanded in Om around 0 97.0%
Taylor expanded in t around inf 53.3%
Final simplification66.5%
t_m = (fabs.f64 t) (FPCore (t_m l Om Omc) :precision binary64 (if (<= (/ t_m l) -4e+17) (asin (/ (- l) (* t_m (sqrt 2.0)))) (if (<= (/ t_m l) 1e-5) (asin 1.0) (asin (/ l (/ t_m (sqrt 0.5)))))))
t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double tmp;
if ((t_m / l) <= -4e+17) {
tmp = asin((-l / (t_m * sqrt(2.0))));
} else if ((t_m / l) <= 1e-5) {
tmp = asin(1.0);
} else {
tmp = asin((l / (t_m / sqrt(0.5))));
}
return tmp;
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: tmp
if ((t_m / l) <= (-4d+17)) then
tmp = asin((-l / (t_m * sqrt(2.0d0))))
else if ((t_m / l) <= 1d-5) then
tmp = asin(1.0d0)
else
tmp = asin((l / (t_m / sqrt(0.5d0))))
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
double tmp;
if ((t_m / l) <= -4e+17) {
tmp = Math.asin((-l / (t_m * Math.sqrt(2.0))));
} else if ((t_m / l) <= 1e-5) {
tmp = Math.asin(1.0);
} else {
tmp = Math.asin((l / (t_m / Math.sqrt(0.5))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): tmp = 0 if (t_m / l) <= -4e+17: tmp = math.asin((-l / (t_m * math.sqrt(2.0)))) elif (t_m / l) <= 1e-5: tmp = math.asin(1.0) else: tmp = math.asin((l / (t_m / math.sqrt(0.5)))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) tmp = 0.0 if (Float64(t_m / l) <= -4e+17) tmp = asin(Float64(Float64(-l) / Float64(t_m * sqrt(2.0)))); elseif (Float64(t_m / l) <= 1e-5) tmp = asin(1.0); else tmp = asin(Float64(l / Float64(t_m / sqrt(0.5)))); end return tmp end
t_m = abs(t); function tmp_2 = code(t_m, l, Om, Omc) tmp = 0.0; if ((t_m / l) <= -4e+17) tmp = asin((-l / (t_m * sqrt(2.0)))); elseif ((t_m / l) <= 1e-5) tmp = asin(1.0); else tmp = asin((l / (t_m / sqrt(0.5)))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := If[LessEqual[N[(t$95$m / l), $MachinePrecision], -4e+17], N[ArcSin[N[((-l) / N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t$95$m / l), $MachinePrecision], 1e-5], N[ArcSin[1.0], $MachinePrecision], N[ArcSin[N[(l / N[(t$95$m / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{t_m}{\ell} \leq -4 \cdot 10^{+17}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_m \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\frac{t_m}{\ell} \leq 10^{-5}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{\frac{t_m}{\sqrt{0.5}}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -4e17Initial program 64.9%
sqrt-div64.8%
div-inv64.8%
add-sqr-sqrt64.8%
hypot-1-def64.8%
*-commutative64.8%
sqrt-prod64.8%
unpow264.8%
sqrt-prod0.0%
add-sqr-sqrt97.3%
Applied egg-rr97.3%
associate-*r/97.3%
*-rgt-identity97.3%
Simplified97.3%
Taylor expanded in Om around 0 96.4%
Taylor expanded in t around -inf 98.7%
associate-*r/98.7%
mul-1-neg98.7%
Simplified98.7%
if -4e17 < (/.f64 t l) < 1.00000000000000008e-5Initial program 98.9%
Taylor expanded in t around 0 89.5%
unpow289.5%
unpow289.5%
times-frac98.0%
unpow298.0%
Simplified98.0%
Taylor expanded in Om around 0 97.3%
if 1.00000000000000008e-5 < (/.f64 t l) Initial program 74.9%
Taylor expanded in t around inf 79.1%
*-commutative79.1%
unpow279.1%
unpow279.1%
times-frac98.7%
unpow298.7%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in Om around 0 98.1%
Final simplification97.9%
t_m = (fabs.f64 t) (FPCore (t_m l Om Omc) :precision binary64 (if (<= t_m 3.8e+44) (asin 1.0) (asin (/ l (* t_m (sqrt 2.0))))))
t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double tmp;
if (t_m <= 3.8e+44) {
tmp = asin(1.0);
} else {
tmp = asin((l / (t_m * sqrt(2.0))));
}
return tmp;
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
real(8) :: tmp
if (t_m <= 3.8d+44) then
tmp = asin(1.0d0)
else
tmp = asin((l / (t_m * sqrt(2.0d0))))
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
double tmp;
if (t_m <= 3.8e+44) {
tmp = Math.asin(1.0);
} else {
tmp = Math.asin((l / (t_m * Math.sqrt(2.0))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): tmp = 0 if t_m <= 3.8e+44: tmp = math.asin(1.0) else: tmp = math.asin((l / (t_m * math.sqrt(2.0)))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) tmp = 0.0 if (t_m <= 3.8e+44) tmp = asin(1.0); else tmp = asin(Float64(l / Float64(t_m * sqrt(2.0)))); end return tmp end
t_m = abs(t); function tmp_2 = code(t_m, l, Om, Omc) tmp = 0.0; if (t_m <= 3.8e+44) tmp = asin(1.0); else tmp = asin((l / (t_m * sqrt(2.0)))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := If[LessEqual[t$95$m, 3.8e+44], N[ArcSin[1.0], $MachinePrecision], N[ArcSin[N[(l / N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;t_m \leq 3.8 \cdot 10^{+44}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_m \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if t < 3.8000000000000002e44Initial program 87.8%
Taylor expanded in t around 0 53.6%
unpow253.6%
unpow253.6%
times-frac59.2%
unpow259.2%
Simplified59.2%
Taylor expanded in Om around 0 58.8%
if 3.8000000000000002e44 < t Initial program 69.9%
sqrt-div69.9%
div-inv69.9%
add-sqr-sqrt69.9%
hypot-1-def69.9%
*-commutative69.9%
sqrt-prod69.8%
unpow269.8%
sqrt-prod43.2%
add-sqr-sqrt97.3%
Applied egg-rr97.3%
associate-*r/97.3%
*-rgt-identity97.3%
Simplified97.3%
Taylor expanded in Om around 0 95.6%
Taylor expanded in t around inf 54.5%
Final simplification57.9%
t_m = (fabs.f64 t) (FPCore (t_m l Om Omc) :precision binary64 (asin 1.0))
t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
return asin(1.0);
}
t_m = abs(t)
real(8) function code(t_m, l, om, omc)
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: omc
code = asin(1.0d0)
end function
t_m = Math.abs(t);
public static double code(double t_m, double l, double Om, double Omc) {
return Math.asin(1.0);
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): return math.asin(1.0)
t_m = abs(t) function code(t_m, l, Om, Omc) return asin(1.0) end
t_m = abs(t); function tmp = code(t_m, l, Om, Omc) tmp = asin(1.0); end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := N[ArcSin[1.0], $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sin^{-1} 1
\end{array}
Initial program 84.0%
Taylor expanded in t around 0 46.3%
unpow246.3%
unpow246.3%
times-frac50.8%
unpow250.8%
Simplified50.8%
Taylor expanded in Om around 0 50.4%
Final simplification50.4%
herbie shell --seed 2023333
(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)))))))