
(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 7 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 l) (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
return asin((sqrt((1.0 - pow((Om / Omc), 2.0))) / hypot(1.0, ((t / l) * sqrt(2.0)))));
}
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 / l) * Math.sqrt(2.0)))));
}
def code(t, l, Om, Omc): return math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) / math.hypot(1.0, ((t / l) * math.sqrt(2.0)))))
function code(t, l, Om, Omc) return asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) / hypot(1.0, Float64(Float64(t / l) * sqrt(2.0))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) / hypot(1.0, ((t / l) * sqrt(2.0))))); 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 / l), $MachinePrecision] * N[Sqrt[2.0], $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, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Initial program 84.9%
sqrt-div84.8%
add-sqr-sqrt84.8%
hypot-1-def84.8%
*-commutative84.8%
sqrt-prod84.8%
unpow284.8%
sqrt-prod54.0%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
Final simplification97.8%
(FPCore (t l Om Omc) :precision binary64 (asin (/ 1.0 (hypot 1.0 (* (/ t l) (sqrt 2.0))))))
double code(double t, double l, double Om, double Omc) {
return asin((1.0 / hypot(1.0, ((t / l) * sqrt(2.0)))));
}
public static double code(double t, double l, double Om, double Omc) {
return Math.asin((1.0 / Math.hypot(1.0, ((t / l) * Math.sqrt(2.0)))));
}
def code(t, l, Om, Omc): return math.asin((1.0 / math.hypot(1.0, ((t / l) * math.sqrt(2.0)))))
function code(t, l, Om, Omc) return asin(Float64(1.0 / hypot(1.0, Float64(Float64(t / l) * sqrt(2.0))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((1.0 / hypot(1.0, ((t / l) * sqrt(2.0))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(t / l), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \frac{t}{\ell} \cdot \sqrt{2}\right)}\right)
\end{array}
Initial program 84.9%
sqrt-div84.8%
add-sqr-sqrt84.8%
hypot-1-def84.8%
*-commutative84.8%
sqrt-prod84.8%
unpow284.8%
sqrt-prod54.0%
add-sqr-sqrt97.8%
Applied egg-rr97.8%
Taylor expanded in Om around 0 97.1%
Final simplification97.1%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1
(asin
(sqrt
(/
(- 1.0 (/ Om (* Omc (/ Omc Om))))
(+ 1.0 (* 2.0 (/ (/ t l) (/ l t))))))))
(t_2 (* t (sqrt 2.0))))
(if (<= l -5.6e-182)
t_1
(if (<= l -2e-310)
(asin (/ (- l) t_2))
(if (<= l 2.2e-119) (asin (/ l t_2)) t_1)))))
double code(double t, double l, double Om, double Omc) {
double t_1 = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
double t_2 = t * sqrt(2.0);
double tmp;
if (l <= -5.6e-182) {
tmp = t_1;
} else if (l <= -2e-310) {
tmp = asin((-l / t_2));
} else if (l <= 2.2e-119) {
tmp = asin((l / t_2));
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = asin(sqrt(((1.0d0 - (om / (omc * (omc / om)))) / (1.0d0 + (2.0d0 * ((t / l) / (l / t)))))))
t_2 = t * sqrt(2.0d0)
if (l <= (-5.6d-182)) then
tmp = t_1
else if (l <= (-2d-310)) then
tmp = asin((-l / t_2))
else if (l <= 2.2d-119) then
tmp = asin((l / t_2))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double t_1 = Math.asin(Math.sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t / l) / (l / t)))))));
double t_2 = t * Math.sqrt(2.0);
double tmp;
if (l <= -5.6e-182) {
tmp = t_1;
} else if (l <= -2e-310) {
tmp = Math.asin((-l / t_2));
} else if (l <= 2.2e-119) {
tmp = Math.asin((l / t_2));
} else {
tmp = t_1;
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = math.asin(math.sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t / l) / (l / t))))))) t_2 = t * math.sqrt(2.0) tmp = 0 if l <= -5.6e-182: tmp = t_1 elif l <= -2e-310: tmp = math.asin((-l / t_2)) elif l <= 2.2e-119: tmp = math.asin((l / t_2)) else: tmp = t_1 return tmp
function code(t, l, Om, Omc) t_1 = asin(sqrt(Float64(Float64(1.0 - Float64(Om / Float64(Omc * Float64(Omc / Om)))) / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) / Float64(l / t))))))) t_2 = Float64(t * sqrt(2.0)) tmp = 0.0 if (l <= -5.6e-182) tmp = t_1; elseif (l <= -2e-310) tmp = asin(Float64(Float64(-l) / t_2)); elseif (l <= 2.2e-119) tmp = asin(Float64(l / t_2)); else tmp = t_1; end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = asin(sqrt(((1.0 - (Om / (Omc * (Omc / Om)))) / (1.0 + (2.0 * ((t / l) / (l / t))))))); t_2 = t * sqrt(2.0); tmp = 0.0; if (l <= -5.6e-182) tmp = t_1; elseif (l <= -2e-310) tmp = asin((-l / t_2)); elseif (l <= 2.2e-119) tmp = asin((l / t_2)); else tmp = t_1; end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[ArcSin[N[Sqrt[N[(N[(1.0 - N[(Om / N[(Omc * N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[(N[(t / l), $MachinePrecision] / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.6e-182], t$95$1, If[LessEqual[l, -2e-310], N[ArcSin[N[((-l) / t$95$2), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 2.2e-119], N[ArcSin[N[(l / t$95$2), $MachinePrecision]], $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sin^{-1} \left(\sqrt{\frac{1 - \frac{Om}{Omc \cdot \frac{Omc}{Om}}}{1 + 2 \cdot \frac{\frac{t}{\ell}}{\frac{\ell}{t}}}}\right)\\
t_2 := t \cdot \sqrt{2}\\
\mathbf{if}\;\ell \leq -5.6 \cdot 10^{-182}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_2}\right)\\
\mathbf{elif}\;\ell \leq 2.2 \cdot 10^{-119}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_2}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -5.59999999999999986e-182 or 2.2000000000000001e-119 < l Initial program 90.2%
unpow290.2%
clear-num90.3%
un-div-inv90.3%
Applied egg-rr90.3%
unpow269.8%
clear-num69.8%
frac-times69.8%
*-un-lft-identity69.8%
Applied egg-rr90.3%
if -5.59999999999999986e-182 < l < -1.999999999999994e-310Initial program 66.8%
sqrt-div66.9%
add-sqr-sqrt66.9%
hypot-1-def66.9%
*-commutative66.9%
sqrt-prod66.8%
unpow266.8%
sqrt-prod46.3%
add-sqr-sqrt98.6%
Applied egg-rr98.6%
Taylor expanded in Om around 0 98.6%
Taylor expanded in t around -inf 70.9%
associate-*r/70.9%
mul-1-neg70.9%
Simplified70.9%
if -1.999999999999994e-310 < l < 2.2000000000000001e-119Initial program 67.7%
sqrt-div67.6%
add-sqr-sqrt67.6%
hypot-1-def67.6%
*-commutative67.6%
sqrt-prod67.4%
unpow267.4%
sqrt-prod40.9%
add-sqr-sqrt93.8%
Applied egg-rr93.8%
Taylor expanded in Om around 0 93.8%
Taylor expanded in t around inf 60.8%
Final simplification84.6%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0)))
(t_2 (asin (sqrt (- 1.0 (/ Om (* Omc (/ Omc Om))))))))
(if (<= l -9.5e-72)
t_2
(if (<= l -2e-310)
(asin (/ (- l) t_1))
(if (<= l 9e-67) (asin (/ l t_1)) t_2)))))
double code(double t, double l, double Om, double Omc) {
double t_1 = t * sqrt(2.0);
double t_2 = asin(sqrt((1.0 - (Om / (Omc * (Omc / Om))))));
double tmp;
if (l <= -9.5e-72) {
tmp = t_2;
} else if (l <= -2e-310) {
tmp = asin((-l / t_1));
} else if (l <= 9e-67) {
tmp = asin((l / t_1));
} else {
tmp = t_2;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t * sqrt(2.0d0)
t_2 = asin(sqrt((1.0d0 - (om / (omc * (omc / om))))))
if (l <= (-9.5d-72)) then
tmp = t_2
else if (l <= (-2d-310)) then
tmp = asin((-l / t_1))
else if (l <= 9d-67) then
tmp = asin((l / t_1))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double t_1 = t * Math.sqrt(2.0);
double t_2 = Math.asin(Math.sqrt((1.0 - (Om / (Omc * (Omc / Om))))));
double tmp;
if (l <= -9.5e-72) {
tmp = t_2;
} else if (l <= -2e-310) {
tmp = Math.asin((-l / t_1));
} else if (l <= 9e-67) {
tmp = Math.asin((l / t_1));
} else {
tmp = t_2;
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = t * math.sqrt(2.0) t_2 = math.asin(math.sqrt((1.0 - (Om / (Omc * (Omc / Om)))))) tmp = 0 if l <= -9.5e-72: tmp = t_2 elif l <= -2e-310: tmp = math.asin((-l / t_1)) elif l <= 9e-67: tmp = math.asin((l / t_1)) else: tmp = t_2 return tmp
function code(t, l, Om, Omc) t_1 = Float64(t * sqrt(2.0)) t_2 = asin(sqrt(Float64(1.0 - Float64(Om / Float64(Omc * Float64(Omc / Om)))))) tmp = 0.0 if (l <= -9.5e-72) tmp = t_2; elseif (l <= -2e-310) tmp = asin(Float64(Float64(-l) / t_1)); elseif (l <= 9e-67) tmp = asin(Float64(l / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = t * sqrt(2.0); t_2 = asin(sqrt((1.0 - (Om / (Omc * (Omc / Om)))))); tmp = 0.0; if (l <= -9.5e-72) tmp = t_2; elseif (l <= -2e-310) tmp = asin((-l / t_1)); elseif (l <= 9e-67) tmp = asin((l / t_1)); else tmp = t_2; end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcSin[N[Sqrt[N[(1.0 - N[(Om / N[(Omc * N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -9.5e-72], t$95$2, If[LessEqual[l, -2e-310], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 9e-67], N[ArcSin[N[(l / t$95$1), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \sqrt{2}\\
t_2 := \sin^{-1} \left(\sqrt{1 - \frac{Om}{Omc \cdot \frac{Omc}{Om}}}\right)\\
\mathbf{if}\;\ell \leq -9.5 \cdot 10^{-72}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\ell \leq 9 \cdot 10^{-67}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if l < -9.4999999999999998e-72 or 9.00000000000000031e-67 < l Initial program 92.1%
Taylor expanded in t around 0 69.7%
unpow269.7%
unpow269.7%
times-frac76.3%
unpow276.3%
Simplified76.3%
unpow276.3%
clear-num76.3%
frac-times76.3%
*-un-lft-identity76.3%
Applied egg-rr76.3%
if -9.4999999999999998e-72 < l < -1.999999999999994e-310Initial program 70.1%
sqrt-div70.0%
add-sqr-sqrt70.0%
hypot-1-def70.0%
*-commutative70.0%
sqrt-prod69.9%
unpow269.9%
sqrt-prod47.9%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
Taylor expanded in Om around 0 98.2%
Taylor expanded in t around -inf 56.8%
associate-*r/56.8%
mul-1-neg56.8%
Simplified56.8%
if -1.999999999999994e-310 < l < 9.00000000000000031e-67Initial program 74.6%
sqrt-div74.5%
add-sqr-sqrt74.5%
hypot-1-def74.5%
*-commutative74.5%
sqrt-prod74.4%
unpow274.4%
sqrt-prod44.2%
add-sqr-sqrt95.3%
Applied egg-rr95.3%
Taylor expanded in Om around 0 94.3%
Taylor expanded in t around inf 50.3%
Final simplification68.1%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0))))
(if (<= l -1.6e-71)
(asin 1.0)
(if (<= l -2e-310)
(asin (/ (- l) t_1))
(if (<= l 1.08e-66) (asin (/ l t_1)) (asin 1.0))))))
double code(double t, double l, double Om, double Omc) {
double t_1 = t * sqrt(2.0);
double tmp;
if (l <= -1.6e-71) {
tmp = asin(1.0);
} else if (l <= -2e-310) {
tmp = asin((-l / t_1));
} else if (l <= 1.08e-66) {
tmp = asin((l / t_1));
} else {
tmp = asin(1.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) :: t_1
real(8) :: tmp
t_1 = t * sqrt(2.0d0)
if (l <= (-1.6d-71)) then
tmp = asin(1.0d0)
else if (l <= (-2d-310)) then
tmp = asin((-l / t_1))
else if (l <= 1.08d-66) then
tmp = asin((l / t_1))
else
tmp = asin(1.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double t_1 = t * Math.sqrt(2.0);
double tmp;
if (l <= -1.6e-71) {
tmp = Math.asin(1.0);
} else if (l <= -2e-310) {
tmp = Math.asin((-l / t_1));
} else if (l <= 1.08e-66) {
tmp = Math.asin((l / t_1));
} else {
tmp = Math.asin(1.0);
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = t * math.sqrt(2.0) tmp = 0 if l <= -1.6e-71: tmp = math.asin(1.0) elif l <= -2e-310: tmp = math.asin((-l / t_1)) elif l <= 1.08e-66: tmp = math.asin((l / t_1)) else: tmp = math.asin(1.0) return tmp
function code(t, l, Om, Omc) t_1 = Float64(t * sqrt(2.0)) tmp = 0.0 if (l <= -1.6e-71) tmp = asin(1.0); elseif (l <= -2e-310) tmp = asin(Float64(Float64(-l) / t_1)); elseif (l <= 1.08e-66) tmp = asin(Float64(l / t_1)); else tmp = asin(1.0); end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = t * sqrt(2.0); tmp = 0.0; if (l <= -1.6e-71) tmp = asin(1.0); elseif (l <= -2e-310) tmp = asin((-l / t_1)); elseif (l <= 1.08e-66) tmp = asin((l / t_1)); else tmp = asin(1.0); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.6e-71], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, -2e-310], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 1.08e-66], N[ArcSin[N[(l / t$95$1), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \sqrt{2}\\
\mathbf{if}\;\ell \leq -1.6 \cdot 10^{-71}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\ell \leq 1.08 \cdot 10^{-66}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -1.5999999999999999e-71 or 1.08000000000000006e-66 < l Initial program 92.1%
Taylor expanded in t around 0 69.7%
unpow269.7%
unpow269.7%
times-frac76.3%
unpow276.3%
Simplified76.3%
Taylor expanded in Om around 0 75.4%
if -1.5999999999999999e-71 < l < -1.999999999999994e-310Initial program 70.1%
sqrt-div70.0%
add-sqr-sqrt70.0%
hypot-1-def70.0%
*-commutative70.0%
sqrt-prod69.9%
unpow269.9%
sqrt-prod47.9%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
Taylor expanded in Om around 0 98.2%
Taylor expanded in t around -inf 56.8%
associate-*r/56.8%
mul-1-neg56.8%
Simplified56.8%
if -1.999999999999994e-310 < l < 1.08000000000000006e-66Initial program 74.6%
sqrt-div74.5%
add-sqr-sqrt74.5%
hypot-1-def74.5%
*-commutative74.5%
sqrt-prod74.4%
unpow274.4%
sqrt-prod44.2%
add-sqr-sqrt95.3%
Applied egg-rr95.3%
Taylor expanded in Om around 0 94.3%
Taylor expanded in t around inf 50.3%
Final simplification67.6%
(FPCore (t l Om Omc) :precision binary64 (if (<= l -3.5e-183) (asin 1.0) (if (<= l 1e-66) (asin (/ l (* t (sqrt 2.0)))) (asin 1.0))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -3.5e-183) {
tmp = asin(1.0);
} else if (l <= 1e-66) {
tmp = asin((l / (t * sqrt(2.0))));
} else {
tmp = asin(1.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 (l <= (-3.5d-183)) then
tmp = asin(1.0d0)
else if (l <= 1d-66) then
tmp = asin((l / (t * sqrt(2.0d0))))
else
tmp = asin(1.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -3.5e-183) {
tmp = Math.asin(1.0);
} else if (l <= 1e-66) {
tmp = Math.asin((l / (t * Math.sqrt(2.0))));
} else {
tmp = Math.asin(1.0);
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if l <= -3.5e-183: tmp = math.asin(1.0) elif l <= 1e-66: tmp = math.asin((l / (t * math.sqrt(2.0)))) else: tmp = math.asin(1.0) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (l <= -3.5e-183) tmp = asin(1.0); elseif (l <= 1e-66) tmp = asin(Float64(l / Float64(t * sqrt(2.0)))); else tmp = asin(1.0); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (l <= -3.5e-183) tmp = asin(1.0); elseif (l <= 1e-66) tmp = asin((l / (t * sqrt(2.0)))); else tmp = asin(1.0); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, -3.5e-183], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, 1e-66], N[ArcSin[N[(l / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.5 \cdot 10^{-183}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;\ell \leq 10^{-66}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -3.49999999999999991e-183 or 9.9999999999999998e-67 < l Initial program 90.6%
Taylor expanded in t around 0 64.9%
unpow264.9%
unpow264.9%
times-frac72.0%
unpow272.0%
Simplified72.0%
Taylor expanded in Om around 0 71.3%
if -3.49999999999999991e-183 < l < 9.9999999999999998e-67Initial program 71.3%
sqrt-div71.3%
add-sqr-sqrt71.3%
hypot-1-def71.3%
*-commutative71.3%
sqrt-prod71.2%
unpow271.2%
sqrt-prod45.1%
add-sqr-sqrt96.7%
Applied egg-rr96.7%
Taylor expanded in Om around 0 96.1%
Taylor expanded in t around inf 54.3%
Final simplification66.2%
(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 84.9%
Taylor expanded in t around 0 51.0%
unpow251.0%
unpow251.0%
times-frac56.2%
unpow256.2%
Simplified56.2%
Taylor expanded in Om around 0 55.6%
Final simplification55.6%
herbie shell --seed 2024021
(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)))))))