
(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
(let* ((t_1 (- 1.0 (pow (/ Om Omc) 2.0))) (t_2 (sqrt t_1)))
(if (<= (/ t_m l) -1e+91)
(asin (* t_2 (/ (* l (- (sqrt 0.5))) t_m)))
(if (<= (/ t_m l) 100.0)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (/ t_m (* l (/ l t_m))))))))
(asin (* t_2 (/ l (* t_m (sqrt 2.0)))))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double t_1 = 1.0 - pow((Om / Omc), 2.0);
double t_2 = sqrt(t_1);
double tmp;
if ((t_m / l) <= -1e+91) {
tmp = asin((t_2 * ((l * -sqrt(0.5)) / t_m)));
} else if ((t_m / l) <= 100.0) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * (t_m / (l * (l / t_m))))))));
} else {
tmp = asin((t_2 * (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 1.0d0 - ((om / omc) ** 2.0d0)
t_2 = sqrt(t_1)
if ((t_m / l) <= (-1d+91)) then
tmp = asin((t_2 * ((l * -sqrt(0.5d0)) / t_m)))
else if ((t_m / l) <= 100.0d0) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * (t_m / (l * (l / t_m))))))))
else
tmp = asin((t_2 * (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 t_1 = 1.0 - Math.pow((Om / Omc), 2.0);
double t_2 = Math.sqrt(t_1);
double tmp;
if ((t_m / l) <= -1e+91) {
tmp = Math.asin((t_2 * ((l * -Math.sqrt(0.5)) / t_m)));
} else if ((t_m / l) <= 100.0) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * (t_m / (l * (l / t_m))))))));
} else {
tmp = Math.asin((t_2 * (l / (t_m * Math.sqrt(2.0)))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): t_1 = 1.0 - math.pow((Om / Omc), 2.0) t_2 = math.sqrt(t_1) tmp = 0 if (t_m / l) <= -1e+91: tmp = math.asin((t_2 * ((l * -math.sqrt(0.5)) / t_m))) elif (t_m / l) <= 100.0: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * (t_m / (l * (l / t_m)))))))) else: tmp = math.asin((t_2 * (l / (t_m * math.sqrt(2.0))))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) t_1 = Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) t_2 = sqrt(t_1) tmp = 0.0 if (Float64(t_m / l) <= -1e+91) tmp = asin(Float64(t_2 * Float64(Float64(l * Float64(-sqrt(0.5))) / t_m))); elseif (Float64(t_m / l) <= 100.0) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(t_m / Float64(l * Float64(l / t_m)))))))); else tmp = asin(Float64(t_2 * 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) t_1 = 1.0 - ((Om / Omc) ^ 2.0); t_2 = sqrt(t_1); tmp = 0.0; if ((t_m / l) <= -1e+91) tmp = asin((t_2 * ((l * -sqrt(0.5)) / t_m))); elseif ((t_m / l) <= 100.0) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * (t_m / (l * (l / t_m)))))))); else tmp = asin((t_2 * (l / (t_m * sqrt(2.0))))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[t$95$m_, l_, Om_, Omc_] := Block[{t$95$1 = N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[t$95$1], $MachinePrecision]}, If[LessEqual[N[(t$95$m / l), $MachinePrecision], -1e+91], N[ArcSin[N[(t$95$2 * N[(N[(l * (-N[Sqrt[0.5], $MachinePrecision])), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t$95$m / l), $MachinePrecision], 100.0], N[ArcSin[N[Sqrt[N[(t$95$1 / N[(1.0 + N[(2.0 * N[(t$95$m / N[(l * N[(l / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(t$95$2 * N[(l / N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := 1 - {\left(\frac{Om}{Omc}\right)}^{2}\\
t_2 := \sqrt{t\_1}\\
\mathbf{if}\;\frac{t\_m}{\ell} \leq -1 \cdot 10^{+91}:\\
\;\;\;\;\sin^{-1} \left(t\_2 \cdot \frac{\ell \cdot \left(-\sqrt{0.5}\right)}{t\_m}\right)\\
\mathbf{elif}\;\frac{t\_m}{\ell} \leq 100:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t\_1}{1 + 2 \cdot \frac{t\_m}{\ell \cdot \frac{\ell}{t\_m}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(t\_2 \cdot \frac{\ell}{t\_m \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1.00000000000000008e91Initial program 58.6%
Taylor expanded in t around -inf 85.3%
mul-1-neg85.3%
*-commutative85.3%
distribute-rgt-neg-in85.3%
unpow285.3%
unpow285.3%
times-frac99.6%
unpow299.6%
associate-/l*99.6%
associate-/r/99.4%
Simplified99.4%
Taylor expanded in l around 0 99.6%
if -1.00000000000000008e91 < (/.f64 t l) < 100Initial program 98.6%
unpow298.6%
clear-num98.6%
frac-times98.0%
*-un-lft-identity98.0%
Applied egg-rr98.0%
if 100 < (/.f64 t l) Initial program 72.4%
sqrt-div72.3%
div-inv72.3%
add-sqr-sqrt72.3%
hypot-1-def72.3%
*-commutative72.3%
sqrt-prod72.3%
unpow272.3%
sqrt-prod98.3%
add-sqr-sqrt98.6%
Applied egg-rr98.6%
associate-*r/98.6%
*-rgt-identity98.6%
Simplified98.6%
Taylor expanded in t around inf 84.6%
*-commutative84.6%
unpow284.6%
unpow284.6%
times-frac99.4%
unpow299.4%
Simplified99.4%
Final simplification98.6%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(let* ((t_1 (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(if (<= (/ t_m l) -1e+152)
(asin (* (sqrt t_1) (* (sqrt 0.5) (/ (- l) t_m))))
(if (<= (/ t_m l) 4e+128)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (/ 1.0 (* (/ l t_m) (/ l t_m))))))))
(asin
(* (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (/ l (* t_m (sqrt 2.0)))))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
double tmp;
if ((t_m / l) <= -1e+152) {
tmp = asin((sqrt(t_1) * (sqrt(0.5) * (-l / t_m))));
} else if ((t_m / l) <= 4e+128) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))));
} else {
tmp = asin((sqrt((1.0 - pow((Om / Omc), 2.0))) * (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) :: t_1
real(8) :: tmp
t_1 = 1.0d0 - ((om / omc) / (omc / om))
if ((t_m / l) <= (-1d+152)) then
tmp = asin((sqrt(t_1) * (sqrt(0.5d0) * (-l / t_m))))
else if ((t_m / l) <= 4d+128) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * (1.0d0 / ((l / t_m) * (l / t_m))))))))
else
tmp = asin((sqrt((1.0d0 - ((om / omc) ** 2.0d0))) * (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 t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
double tmp;
if ((t_m / l) <= -1e+152) {
tmp = Math.asin((Math.sqrt(t_1) * (Math.sqrt(0.5) * (-l / t_m))));
} else if ((t_m / l) <= 4e+128) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))));
} else {
tmp = Math.asin((Math.sqrt((1.0 - Math.pow((Om / Omc), 2.0))) * (l / (t_m * Math.sqrt(2.0)))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): t_1 = 1.0 - ((Om / Omc) / (Omc / Om)) tmp = 0 if (t_m / l) <= -1e+152: tmp = math.asin((math.sqrt(t_1) * (math.sqrt(0.5) * (-l / t_m)))) elif (t_m / l) <= 4e+128: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m)))))))) else: tmp = math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) * (l / (t_m * math.sqrt(2.0))))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) t_1 = Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) tmp = 0.0 if (Float64(t_m / l) <= -1e+152) tmp = asin(Float64(sqrt(t_1) * Float64(sqrt(0.5) * Float64(Float64(-l) / t_m)))); elseif (Float64(t_m / l) <= 4e+128) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(1.0 / Float64(Float64(l / t_m) * Float64(l / t_m)))))))); else tmp = asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) * 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) t_1 = 1.0 - ((Om / Omc) / (Omc / Om)); tmp = 0.0; if ((t_m / l) <= -1e+152) tmp = asin((sqrt(t_1) * (sqrt(0.5) * (-l / t_m)))); elseif ((t_m / l) <= 4e+128) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m)))))))); else tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) * (l / (t_m * sqrt(2.0))))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[t$95$m_, l_, Om_, Omc_] := Block[{t$95$1 = N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$m / l), $MachinePrecision], -1e+152], N[ArcSin[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[(N[Sqrt[0.5], $MachinePrecision] * N[((-l) / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t$95$m / l), $MachinePrecision], 4e+128], N[ArcSin[N[Sqrt[N[(t$95$1 / N[(1.0 + N[(2.0 * N[(1.0 / N[(N[(l / t$95$m), $MachinePrecision] * N[(l / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(l / N[(t$95$m * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\\
\mathbf{if}\;\frac{t\_m}{\ell} \leq -1 \cdot 10^{+152}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{t\_1} \cdot \left(\sqrt{0.5} \cdot \frac{-\ell}{t\_m}\right)\right)\\
\mathbf{elif}\;\frac{t\_m}{\ell} \leq 4 \cdot 10^{+128}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t\_1}{1 + 2 \cdot \frac{1}{\frac{\ell}{t\_m} \cdot \frac{\ell}{t\_m}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \frac{\ell}{t\_m \cdot \sqrt{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1e152Initial program 46.5%
Taylor expanded in t around -inf 81.0%
mul-1-neg81.0%
*-commutative81.0%
distribute-rgt-neg-in81.0%
unpow281.0%
unpow281.0%
times-frac99.4%
unpow299.4%
associate-/l*99.6%
associate-/r/99.4%
Simplified99.4%
unpow23.5%
clear-num3.5%
un-div-inv3.5%
Applied egg-rr99.4%
if -1e152 < (/.f64 t l) < 4.0000000000000003e128Initial program 98.7%
unpow298.7%
clear-num98.8%
clear-num98.7%
frac-times98.8%
metadata-eval98.8%
Applied egg-rr98.8%
unpow277.1%
clear-num77.1%
un-div-inv77.1%
Applied egg-rr98.8%
if 4.0000000000000003e128 < (/.f64 t l) Initial program 57.2%
sqrt-div57.1%
div-inv57.1%
add-sqr-sqrt57.1%
hypot-1-def57.1%
*-commutative57.1%
sqrt-prod57.2%
unpow257.2%
sqrt-prod98.1%
add-sqr-sqrt98.3%
Applied egg-rr98.3%
associate-*r/98.3%
*-rgt-identity98.3%
Simplified98.3%
Taylor expanded in t around inf 85.6%
*-commutative85.6%
unpow285.6%
unpow285.6%
times-frac99.5%
unpow299.5%
Simplified99.5%
Final simplification99.0%
t_m = (fabs.f64 t) (FPCore (t_m l Om Omc) :precision binary64 (asin (/ (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))) (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 - ((Om / Omc) / (Omc / Om)))) / 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 - ((Om / Omc) / (Omc / Om)))) / 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 - ((Om / Omc) / (Omc / Om)))) / 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(Float64(Om / Omc) / Float64(Omc / Om)))) / 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) / (Omc / Om)))) / 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[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $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 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}{\mathsf{hypot}\left(1, \frac{t\_m}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Initial program 86.3%
sqrt-div86.2%
div-inv86.2%
add-sqr-sqrt86.2%
hypot-1-def86.2%
*-commutative86.2%
sqrt-prod86.2%
unpow286.2%
sqrt-prod58.1%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
associate-*r/98.5%
*-rgt-identity98.5%
Simplified98.5%
unpow257.0%
clear-num57.0%
un-div-inv57.0%
Applied egg-rr98.5%
Final simplification98.5%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(let* ((t_1 (- 1.0 (/ (/ Om Omc) (/ Omc Om)))) (t_2 (sqrt t_1)))
(if (<= (/ t_m l) -1e+152)
(asin (* t_2 (* (sqrt 0.5) (/ (- l) t_m))))
(if (<= (/ t_m l) 2e+128)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (/ 1.0 (* (/ l t_m) (/ l t_m))))))))
(asin (* t_2 (* l (/ (sqrt 0.5) t_m))))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
double t_2 = sqrt(t_1);
double tmp;
if ((t_m / l) <= -1e+152) {
tmp = asin((t_2 * (sqrt(0.5) * (-l / t_m))));
} else if ((t_m / l) <= 2e+128) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))));
} else {
tmp = asin((t_2 * (l * (sqrt(0.5) / t_m))));
}
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) :: t_2
real(8) :: tmp
t_1 = 1.0d0 - ((om / omc) / (omc / om))
t_2 = sqrt(t_1)
if ((t_m / l) <= (-1d+152)) then
tmp = asin((t_2 * (sqrt(0.5d0) * (-l / t_m))))
else if ((t_m / l) <= 2d+128) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * (1.0d0 / ((l / t_m) * (l / t_m))))))))
else
tmp = asin((t_2 * (l * (sqrt(0.5d0) / t_m))))
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 = 1.0 - ((Om / Omc) / (Omc / Om));
double t_2 = Math.sqrt(t_1);
double tmp;
if ((t_m / l) <= -1e+152) {
tmp = Math.asin((t_2 * (Math.sqrt(0.5) * (-l / t_m))));
} else if ((t_m / l) <= 2e+128) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))));
} else {
tmp = Math.asin((t_2 * (l * (Math.sqrt(0.5) / t_m))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): t_1 = 1.0 - ((Om / Omc) / (Omc / Om)) t_2 = math.sqrt(t_1) tmp = 0 if (t_m / l) <= -1e+152: tmp = math.asin((t_2 * (math.sqrt(0.5) * (-l / t_m)))) elif (t_m / l) <= 2e+128: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m)))))))) else: tmp = math.asin((t_2 * (l * (math.sqrt(0.5) / t_m)))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) t_1 = Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) t_2 = sqrt(t_1) tmp = 0.0 if (Float64(t_m / l) <= -1e+152) tmp = asin(Float64(t_2 * Float64(sqrt(0.5) * Float64(Float64(-l) / t_m)))); elseif (Float64(t_m / l) <= 2e+128) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(1.0 / Float64(Float64(l / t_m) * Float64(l / t_m)))))))); else tmp = asin(Float64(t_2 * Float64(l * Float64(sqrt(0.5) / t_m)))); end return tmp end
t_m = abs(t); function tmp_2 = code(t_m, l, Om, Omc) t_1 = 1.0 - ((Om / Omc) / (Omc / Om)); t_2 = sqrt(t_1); tmp = 0.0; if ((t_m / l) <= -1e+152) tmp = asin((t_2 * (sqrt(0.5) * (-l / t_m)))); elseif ((t_m / l) <= 2e+128) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m)))))))); else tmp = asin((t_2 * (l * (sqrt(0.5) / t_m)))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[t$95$m_, l_, Om_, Omc_] := Block[{t$95$1 = N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[t$95$1], $MachinePrecision]}, If[LessEqual[N[(t$95$m / l), $MachinePrecision], -1e+152], N[ArcSin[N[(t$95$2 * N[(N[Sqrt[0.5], $MachinePrecision] * N[((-l) / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t$95$m / l), $MachinePrecision], 2e+128], N[ArcSin[N[Sqrt[N[(t$95$1 / N[(1.0 + N[(2.0 * N[(1.0 / N[(N[(l / t$95$m), $MachinePrecision] * N[(l / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(t$95$2 * N[(l * N[(N[Sqrt[0.5], $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\\
t_2 := \sqrt{t\_1}\\
\mathbf{if}\;\frac{t\_m}{\ell} \leq -1 \cdot 10^{+152}:\\
\;\;\;\;\sin^{-1} \left(t\_2 \cdot \left(\sqrt{0.5} \cdot \frac{-\ell}{t\_m}\right)\right)\\
\mathbf{elif}\;\frac{t\_m}{\ell} \leq 2 \cdot 10^{+128}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t\_1}{1 + 2 \cdot \frac{1}{\frac{\ell}{t\_m} \cdot \frac{\ell}{t\_m}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(t\_2 \cdot \left(\ell \cdot \frac{\sqrt{0.5}}{t\_m}\right)\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1e152Initial program 46.5%
Taylor expanded in t around -inf 81.0%
mul-1-neg81.0%
*-commutative81.0%
distribute-rgt-neg-in81.0%
unpow281.0%
unpow281.0%
times-frac99.4%
unpow299.4%
associate-/l*99.6%
associate-/r/99.4%
Simplified99.4%
unpow23.5%
clear-num3.5%
un-div-inv3.5%
Applied egg-rr99.4%
if -1e152 < (/.f64 t l) < 2.0000000000000002e128Initial program 98.7%
unpow298.7%
clear-num98.8%
clear-num98.7%
frac-times98.8%
metadata-eval98.8%
Applied egg-rr98.8%
unpow277.1%
clear-num77.1%
un-div-inv77.1%
Applied egg-rr98.8%
if 2.0000000000000002e128 < (/.f64 t l) Initial program 57.2%
unpow257.2%
div-inv57.3%
associate-*r*55.0%
Applied egg-rr55.0%
Taylor expanded in t around inf 85.8%
associate-*r/85.8%
*-commutative85.8%
unpow285.8%
unpow285.8%
times-frac99.6%
unpow299.6%
Simplified99.6%
unpow23.7%
clear-num3.7%
un-div-inv3.7%
Applied egg-rr99.6%
Final simplification99.0%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(let* ((t_1 (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(if (<= (/ t_m l) 2e+128)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (/ 1.0 (* (/ l t_m) (/ l t_m))))))))
(asin (* (sqrt t_1) (* l (/ (sqrt 0.5) t_m)))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
double tmp;
if ((t_m / l) <= 2e+128) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))));
} else {
tmp = asin((sqrt(t_1) * (l * (sqrt(0.5) / t_m))));
}
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 = 1.0d0 - ((om / omc) / (omc / om))
if ((t_m / l) <= 2d+128) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * (1.0d0 / ((l / t_m) * (l / t_m))))))))
else
tmp = asin((sqrt(t_1) * (l * (sqrt(0.5d0) / t_m))))
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 = 1.0 - ((Om / Omc) / (Omc / Om));
double tmp;
if ((t_m / l) <= 2e+128) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))));
} else {
tmp = Math.asin((Math.sqrt(t_1) * (l * (Math.sqrt(0.5) / t_m))));
}
return tmp;
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): t_1 = 1.0 - ((Om / Omc) / (Omc / Om)) tmp = 0 if (t_m / l) <= 2e+128: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m)))))))) else: tmp = math.asin((math.sqrt(t_1) * (l * (math.sqrt(0.5) / t_m)))) return tmp
t_m = abs(t) function code(t_m, l, Om, Omc) t_1 = Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) tmp = 0.0 if (Float64(t_m / l) <= 2e+128) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(1.0 / Float64(Float64(l / t_m) * Float64(l / t_m)))))))); else tmp = asin(Float64(sqrt(t_1) * Float64(l * Float64(sqrt(0.5) / t_m)))); end return tmp end
t_m = abs(t); function tmp_2 = code(t_m, l, Om, Omc) t_1 = 1.0 - ((Om / Omc) / (Omc / Om)); tmp = 0.0; if ((t_m / l) <= 2e+128) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m)))))))); else tmp = asin((sqrt(t_1) * (l * (sqrt(0.5) / t_m)))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[t$95$m_, l_, Om_, Omc_] := Block[{t$95$1 = N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$m / l), $MachinePrecision], 2e+128], N[ArcSin[N[Sqrt[N[(t$95$1 / N[(1.0 + N[(2.0 * N[(1.0 / N[(N[(l / t$95$m), $MachinePrecision] * N[(l / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[(l * N[(N[Sqrt[0.5], $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\\
\mathbf{if}\;\frac{t\_m}{\ell} \leq 2 \cdot 10^{+128}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t\_1}{1 + 2 \cdot \frac{1}{\frac{\ell}{t\_m} \cdot \frac{\ell}{t\_m}}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{t\_1} \cdot \left(\ell \cdot \frac{\sqrt{0.5}}{t\_m}\right)\right)\\
\end{array}
\end{array}
if (/.f64 t l) < 2.0000000000000002e128Initial program 92.1%
unpow292.1%
clear-num92.1%
clear-num92.1%
frac-times92.1%
metadata-eval92.1%
Applied egg-rr92.1%
unpow267.8%
clear-num67.8%
un-div-inv67.8%
Applied egg-rr92.1%
if 2.0000000000000002e128 < (/.f64 t l) Initial program 57.2%
unpow257.2%
div-inv57.3%
associate-*r*55.0%
Applied egg-rr55.0%
Taylor expanded in t around inf 85.8%
associate-*r/85.8%
*-commutative85.8%
unpow285.8%
unpow285.8%
times-frac99.6%
unpow299.6%
Simplified99.6%
unpow23.7%
clear-num3.7%
un-div-inv3.7%
Applied egg-rr99.6%
Final simplification93.4%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ 1.0 (* (/ l t_m) (/ l t_m)))))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
return asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))));
}
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(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * (1.0d0 / ((l / t_m) * (l / t_m))))))))
end function
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 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))));
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): return math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m))))))))
t_m = abs(t) function code(t_m, l, Om, Omc) return asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(1.0 / Float64(Float64(l / t_m) * Float64(l / t_m)))))))) end
t_m = abs(t); function tmp = code(t_m, l, Om, Omc) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * (1.0 / ((l / t_m) * (l / t_m)))))))); end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[(1.0 / N[(N[(l / t$95$m), $MachinePrecision] * N[(l / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{1}{\frac{\ell}{t\_m} \cdot \frac{\ell}{t\_m}}}}\right)
\end{array}
Initial program 86.3%
unpow286.3%
clear-num86.3%
clear-num86.2%
frac-times86.3%
metadata-eval86.3%
Applied egg-rr86.3%
unpow257.0%
clear-num57.0%
un-div-inv57.0%
Applied egg-rr86.3%
Final simplification86.3%
t_m = (fabs.f64 t)
(FPCore (t_m l Om Omc)
:precision binary64
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (* (/ t_m l) (/ t_m l))))))))t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
return asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
}
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(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / (1.0d0 + (2.0d0 * ((t_m / l) * (t_m / l)))))))
end function
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 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): return math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))))
t_m = abs(t) function code(t_m, l, Om, Omc) return 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(t_m / l))))))) end
t_m = abs(t); function tmp = code(t_m, l, Om, Omc) tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))); end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := 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[(t$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \left(\frac{t\_m}{\ell} \cdot \frac{t\_m}{\ell}\right)}}\right)
\end{array}
Initial program 86.3%
unpow286.3%
associate-*r/82.2%
Applied egg-rr82.2%
unpow257.0%
clear-num57.0%
un-div-inv57.0%
Applied egg-rr82.2%
associate-*r/86.3%
Applied egg-rr86.3%
Final simplification86.3%
t_m = (fabs.f64 t) (FPCore (t_m l Om Omc) :precision binary64 (asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om))))))
t_m = fabs(t);
double code(double t_m, double l, double Om, double Omc) {
return asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
}
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(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
end function
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 - ((Om / Omc) / (Omc / Om)))));
}
t_m = math.fabs(t) def code(t_m, l, Om, Omc): return math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))))
t_m = abs(t) function code(t_m, l, Om, Omc) return asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))) end
t_m = abs(t); function tmp = code(t_m, l, Om, Omc) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); end
t_m = N[Abs[t], $MachinePrecision] code[t$95$m_, l_, Om_, Omc_] := N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)
\end{array}
Initial program 86.3%
Taylor expanded in t around 0 49.7%
unpow249.7%
unpow249.7%
times-frac57.0%
unpow257.0%
Simplified57.0%
unpow257.0%
clear-num57.0%
un-div-inv57.0%
Applied egg-rr57.0%
Final simplification57.0%
herbie shell --seed 2024040
(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)))))))