
(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 6 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 (/ (/ Om Omc) (/ Omc Om)))))
(if (<= (/ t_m l) -5e+141)
(asin (* (sqrt t_1) (* l (/ (- (sqrt 0.5)) t_m))))
(if (<= (/ t_m l) 2e+124)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (* (/ t_m l) (/ t_m l)))))))
(asin
(* (/ l (/ t_m (sqrt 0.5))) (sqrt (- 1.0 (pow (/ Om Omc) 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) <= -5e+141) {
tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5) / t_m))));
} else if ((t_m / l) <= 2e+124) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} else {
tmp = asin(((l / (t_m / sqrt(0.5))) * sqrt((1.0 - pow((Om / Omc), 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) <= (-5d+141)) then
tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5d0) / t_m))))
else if ((t_m / l) <= 2d+124) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t_m / l) * (t_m / l)))))))
else
tmp = asin(((l / (t_m / sqrt(0.5d0))) * sqrt((1.0d0 - ((om / omc) ** 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) <= -5e+141) {
tmp = Math.asin((Math.sqrt(t_1) * (l * (-Math.sqrt(0.5) / t_m))));
} else if ((t_m / l) <= 2e+124) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} else {
tmp = Math.asin(((l / (t_m / Math.sqrt(0.5))) * Math.sqrt((1.0 - Math.pow((Om / Omc), 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) <= -5e+141: tmp = math.asin((math.sqrt(t_1) * (l * (-math.sqrt(0.5) / t_m)))) elif (t_m / l) <= 2e+124: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))) else: tmp = math.asin(((l / (t_m / math.sqrt(0.5))) * math.sqrt((1.0 - math.pow((Om / Omc), 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) <= -5e+141) tmp = asin(Float64(sqrt(t_1) * Float64(l * Float64(Float64(-sqrt(0.5)) / t_m)))); elseif (Float64(t_m / l) <= 2e+124) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(Float64(t_m / l) * Float64(t_m / l))))))); else tmp = asin(Float64(Float64(l / Float64(t_m / sqrt(0.5))) * sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 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) <= -5e+141) tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5) / t_m)))); elseif ((t_m / l) <= 2e+124) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))); else tmp = asin(((l / (t_m / sqrt(0.5))) * sqrt((1.0 - ((Om / Omc) ^ 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], -5e+141], N[ArcSin[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[(l * N[((-N[Sqrt[0.5], $MachinePrecision]) / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t$95$m / l), $MachinePrecision], 2e+124], N[ArcSin[N[Sqrt[N[(t$95$1 / 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], N[ArcSin[N[(N[(l / N[(t$95$m / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 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 -5 \cdot 10^{+141}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{t_1} \cdot \left(\ell \cdot \frac{-\sqrt{0.5}}{t_m}\right)\right)\\
\mathbf{elif}\;\frac{t_m}{\ell} \leq 2 \cdot 10^{+124}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t_1}{1 + 2 \cdot \left(\frac{t_m}{\ell} \cdot \frac{t_m}{\ell}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{\frac{t_m}{\sqrt{0.5}}} \cdot \sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -5.00000000000000025e141Initial program 44.4%
unpow244.4%
Applied egg-rr44.4%
Taylor expanded in t around -inf 83.4%
associate-*r*83.4%
associate-*r/83.5%
mul-1-neg83.5%
distribute-rgt-neg-in83.5%
unpow283.5%
associate-/l/90.4%
unpow290.4%
associate-*r/99.7%
associate-*l/99.7%
unpow299.7%
Simplified99.7%
unpow299.7%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr99.7%
if -5.00000000000000025e141 < (/.f64 t l) < 1.9999999999999999e124Initial program 98.8%
unpow298.8%
Applied egg-rr98.8%
unpow220.2%
clear-num20.2%
un-div-inv20.2%
Applied egg-rr98.8%
if 1.9999999999999999e124 < (/.f64 t l) Initial program 55.2%
unpow255.2%
Applied egg-rr55.2%
Taylor expanded in t around -inf 37.2%
associate-*r*37.2%
associate-*r/37.2%
mul-1-neg37.2%
distribute-rgt-neg-in37.2%
unpow237.2%
associate-/l/39.8%
unpow239.8%
associate-*r/41.6%
associate-*l/41.6%
unpow241.6%
Simplified41.6%
add-sqr-sqrt23.5%
sqrt-unprod54.4%
sqr-neg54.4%
sqrt-unprod41.8%
add-sqr-sqrt99.6%
clear-num99.6%
un-div-inv99.6%
Applied egg-rr99.6%
Final simplification99.1%
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) -5e+141)
(asin (* (sqrt t_1) (* l (/ (- (sqrt 0.5)) t_m))))
(if (<= (/ t_m l) 2e+149)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (* (/ t_m l) (/ t_m l)))))))
(asin
(* (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (* 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) <= -5e+141) {
tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5) / t_m))));
} else if ((t_m / l) <= 2e+149) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} else {
tmp = asin((sqrt((1.0 - pow((Om / Omc), 2.0))) * (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) <= (-5d+141)) then
tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5d0) / t_m))))
else if ((t_m / l) <= 2d+149) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t_m / l) * (t_m / l)))))))
else
tmp = asin((sqrt((1.0d0 - ((om / omc) ** 2.0d0))) * (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) <= -5e+141) {
tmp = Math.asin((Math.sqrt(t_1) * (l * (-Math.sqrt(0.5) / t_m))));
} else if ((t_m / l) <= 2e+149) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} else {
tmp = Math.asin((Math.sqrt((1.0 - Math.pow((Om / Omc), 2.0))) * (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) <= -5e+141: tmp = math.asin((math.sqrt(t_1) * (l * (-math.sqrt(0.5) / t_m)))) elif (t_m / l) <= 2e+149: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))) else: tmp = math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) * (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) <= -5e+141) tmp = asin(Float64(sqrt(t_1) * Float64(l * Float64(Float64(-sqrt(0.5)) / t_m)))); elseif (Float64(t_m / l) <= 2e+149) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(Float64(t_m / l) * Float64(t_m / l))))))); else tmp = asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) * 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) <= -5e+141) tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5) / t_m)))); elseif ((t_m / l) <= 2e+149) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))); else tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) * (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], -5e+141], N[ArcSin[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[(l * N[((-N[Sqrt[0.5], $MachinePrecision]) / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t$95$m / l), $MachinePrecision], 2e+149], N[ArcSin[N[Sqrt[N[(t$95$1 / 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], N[ArcSin[N[(N[Sqrt[N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $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 -5 \cdot 10^{+141}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{t_1} \cdot \left(\ell \cdot \frac{-\sqrt{0.5}}{t_m}\right)\right)\\
\mathbf{elif}\;\frac{t_m}{\ell} \leq 2 \cdot 10^{+149}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t_1}{1 + 2 \cdot \left(\frac{t_m}{\ell} \cdot \frac{t_m}{\ell}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - {\left(\frac{Om}{Omc}\right)}^{2}} \cdot \left(\ell \cdot \frac{\sqrt{0.5}}{t_m}\right)\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -5.00000000000000025e141Initial program 44.4%
unpow244.4%
Applied egg-rr44.4%
Taylor expanded in t around -inf 83.4%
associate-*r*83.4%
associate-*r/83.5%
mul-1-neg83.5%
distribute-rgt-neg-in83.5%
unpow283.5%
associate-/l/90.4%
unpow290.4%
associate-*r/99.7%
associate-*l/99.7%
unpow299.7%
Simplified99.7%
unpow299.7%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr99.7%
if -5.00000000000000025e141 < (/.f64 t l) < 2.0000000000000001e149Initial program 98.8%
unpow298.8%
Applied egg-rr98.8%
unpow219.8%
clear-num19.8%
un-div-inv19.8%
Applied egg-rr98.8%
if 2.0000000000000001e149 < (/.f64 t l) Initial program 49.9%
unpow249.9%
Applied egg-rr49.9%
Taylor expanded in t around inf 90.8%
associate-*r/90.9%
unpow290.9%
associate-/l/93.8%
unpow293.8%
associate-*r/99.7%
associate-*l/99.7%
unpow299.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.1%
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) -5e+141)
(asin (* (sqrt t_1) (* l (/ (- (sqrt 0.5)) t_m))))
(if (<= (/ t_m l) 2e+149)
(asin (sqrt (/ t_1 (+ 1.0 (* 2.0 (* (/ t_m l) (/ t_m l)))))))
(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) <= -5e+141) {
tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5) / t_m))));
} else if ((t_m / l) <= 2e+149) {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} 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) <= (-5d+141)) then
tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5d0) / t_m))))
else if ((t_m / l) <= 2d+149) then
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t_m / l) * (t_m / l)))))))
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) <= -5e+141) {
tmp = Math.asin((Math.sqrt(t_1) * (l * (-Math.sqrt(0.5) / t_m))));
} else if ((t_m / l) <= 2e+149) {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
} 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) <= -5e+141: tmp = math.asin((math.sqrt(t_1) * (l * (-math.sqrt(0.5) / t_m)))) elif (t_m / l) <= 2e+149: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))) 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) <= -5e+141) tmp = asin(Float64(sqrt(t_1) * Float64(l * Float64(Float64(-sqrt(0.5)) / t_m)))); elseif (Float64(t_m / l) <= 2e+149) tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(Float64(t_m / l) * Float64(t_m / l))))))); 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) <= -5e+141) tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5) / t_m)))); elseif ((t_m / l) <= 2e+149) tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))); 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], -5e+141], N[ArcSin[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[(l * N[((-N[Sqrt[0.5], $MachinePrecision]) / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t$95$m / l), $MachinePrecision], 2e+149], N[ArcSin[N[Sqrt[N[(t$95$1 / 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], 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 -5 \cdot 10^{+141}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{t_1} \cdot \left(\ell \cdot \frac{-\sqrt{0.5}}{t_m}\right)\right)\\
\mathbf{elif}\;\frac{t_m}{\ell} \leq 2 \cdot 10^{+149}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t_1}{1 + 2 \cdot \left(\frac{t_m}{\ell} \cdot \frac{t_m}{\ell}\right)}}\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) < -5.00000000000000025e141Initial program 44.4%
unpow244.4%
Applied egg-rr44.4%
Taylor expanded in t around -inf 83.4%
associate-*r*83.4%
associate-*r/83.5%
mul-1-neg83.5%
distribute-rgt-neg-in83.5%
unpow283.5%
associate-/l/90.4%
unpow290.4%
associate-*r/99.7%
associate-*l/99.7%
unpow299.7%
Simplified99.7%
unpow299.7%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr99.7%
if -5.00000000000000025e141 < (/.f64 t l) < 2.0000000000000001e149Initial program 98.8%
unpow298.8%
Applied egg-rr98.8%
unpow219.8%
clear-num19.8%
un-div-inv19.8%
Applied egg-rr98.8%
if 2.0000000000000001e149 < (/.f64 t l) Initial program 49.9%
sqrt-div49.9%
add-sqr-sqrt49.9%
hypot-1-def49.9%
*-commutative49.9%
sqrt-prod49.9%
unpow249.9%
sqrt-prod95.8%
add-sqr-sqrt95.9%
Applied egg-rr95.9%
Taylor expanded in t around inf 90.9%
*-commutative90.9%
unpow290.9%
associate-/l/93.8%
unpow293.8%
associate-*r/99.7%
associate-*l/99.7%
unpow299.7%
Simplified99.7%
Final simplification99.1%
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 83.2%
sqrt-div83.1%
add-sqr-sqrt83.1%
hypot-1-def83.1%
*-commutative83.1%
sqrt-prod83.0%
unpow283.0%
sqrt-prod49.0%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
unpow236.7%
clear-num36.7%
un-div-inv36.7%
Applied egg-rr98.2%
Final simplification98.2%
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) -5e+141)
(asin (* (sqrt t_1) (* l (/ (- (sqrt 0.5)) t_m))))
(asin (sqrt (/ t_1 (+ 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) {
double t_1 = 1.0 - ((Om / Omc) / (Omc / Om));
double tmp;
if ((t_m / l) <= -5e+141) {
tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5) / t_m))));
} else {
tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
}
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) <= (-5d+141)) then
tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5d0) / t_m))))
else
tmp = asin(sqrt((t_1 / (1.0d0 + (2.0d0 * ((t_m / l) * (t_m / l)))))))
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) <= -5e+141) {
tmp = Math.asin((Math.sqrt(t_1) * (l * (-Math.sqrt(0.5) / t_m))));
} else {
tmp = Math.asin(Math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l)))))));
}
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) <= -5e+141: tmp = math.asin((math.sqrt(t_1) * (l * (-math.sqrt(0.5) / t_m)))) else: tmp = math.asin(math.sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))) 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) <= -5e+141) tmp = asin(Float64(sqrt(t_1) * Float64(l * Float64(Float64(-sqrt(0.5)) / t_m)))); else tmp = asin(sqrt(Float64(t_1 / Float64(1.0 + Float64(2.0 * Float64(Float64(t_m / l) * Float64(t_m / l))))))); 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) <= -5e+141) tmp = asin((sqrt(t_1) * (l * (-sqrt(0.5) / t_m)))); else tmp = asin(sqrt((t_1 / (1.0 + (2.0 * ((t_m / l) * (t_m / l))))))); 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], -5e+141], N[ArcSin[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[(l * N[((-N[Sqrt[0.5], $MachinePrecision]) / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[Sqrt[N[(t$95$1 / 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|
\\
\begin{array}{l}
t_1 := 1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}\\
\mathbf{if}\;\frac{t_m}{\ell} \leq -5 \cdot 10^{+141}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{t_1} \cdot \left(\ell \cdot \frac{-\sqrt{0.5}}{t_m}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{t_1}{1 + 2 \cdot \left(\frac{t_m}{\ell} \cdot \frac{t_m}{\ell}\right)}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -5.00000000000000025e141Initial program 44.4%
unpow244.4%
Applied egg-rr44.4%
Taylor expanded in t around -inf 83.4%
associate-*r*83.4%
associate-*r/83.5%
mul-1-neg83.5%
distribute-rgt-neg-in83.5%
unpow283.5%
associate-/l/90.4%
unpow290.4%
associate-*r/99.7%
associate-*l/99.7%
unpow299.7%
Simplified99.7%
unpow299.7%
clear-num99.7%
un-div-inv99.7%
Applied egg-rr99.7%
if -5.00000000000000025e141 < (/.f64 t l) Initial program 91.0%
unpow291.0%
Applied egg-rr91.0%
unpow224.0%
clear-num24.0%
un-div-inv24.0%
Applied egg-rr91.0%
Final simplification92.5%
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 83.2%
unpow283.2%
Applied egg-rr83.2%
unpow236.7%
clear-num36.7%
un-div-inv36.7%
Applied egg-rr83.2%
Final simplification83.2%
herbie shell --seed 2023336
(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)))))))