
(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}
(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 83.9%
sqrt-div83.9%
add-sqr-sqrt83.9%
hypot-1-def83.9%
*-commutative83.9%
sqrt-prod83.9%
unpow283.9%
sqrt-prod55.5%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
Final simplification98.0%
(FPCore (t l Om Omc) :precision binary64 (asin (/ 1.0 (hypot 1.0 (* t (/ (sqrt 2.0) l))))))
double code(double t, double l, double Om, double Omc) {
return asin((1.0 / hypot(1.0, (t * (sqrt(2.0) / l)))));
}
public static double code(double t, double l, double Om, double Omc) {
return Math.asin((1.0 / Math.hypot(1.0, (t * (Math.sqrt(2.0) / l)))));
}
def code(t, l, Om, Omc): return math.asin((1.0 / math.hypot(1.0, (t * (math.sqrt(2.0) / l)))))
function code(t, l, Om, Omc) return asin(Float64(1.0 / hypot(1.0, Float64(t * Float64(sqrt(2.0) / l))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((1.0 / hypot(1.0, (t * (sqrt(2.0) / l))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(t * N[(N[Sqrt[2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, t \cdot \frac{\sqrt{2}}{\ell}\right)}\right)
\end{array}
Initial program 83.9%
sqrt-div83.9%
div-inv83.9%
add-sqr-sqrt83.9%
hypot-1-def83.9%
*-commutative83.9%
sqrt-prod83.9%
unpow283.9%
sqrt-prod55.5%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate-*r/98.0%
*-rgt-identity98.0%
associate-*l/98.0%
Simplified98.0%
Taylor expanded in Om around 0 96.2%
expm1-log1p-u96.2%
expm1-udef60.9%
associate-/l*60.9%
div-inv60.9%
clear-num60.9%
Applied egg-rr60.9%
expm1-def96.2%
expm1-log1p96.2%
Simplified96.2%
Final simplification96.2%
(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 83.9%
sqrt-div83.9%
add-sqr-sqrt83.9%
hypot-1-def83.9%
*-commutative83.9%
sqrt-prod83.9%
unpow283.9%
sqrt-prod55.5%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
Taylor expanded in Om around 0 96.2%
Final simplification96.2%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1
(asin
(sqrt
(/
(- 1.0 (/ (/ Om Omc) (/ Omc Om)))
(+ 1.0 (* 2.0 (/ 1.0 (* (/ l t) (/ l t)))))))))
(t_2 (* t (sqrt 2.0))))
(if (<= l -1.7e-155)
t_1
(if (<= l -2e-310)
(asin (/ (- l) t_2))
(if (<= l 4e-68) (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 * (1.0 / ((l / t) * (l / t))))))));
double t_2 = t * sqrt(2.0);
double tmp;
if (l <= -1.7e-155) {
tmp = t_1;
} else if (l <= -2e-310) {
tmp = asin((-l / t_2));
} else if (l <= 4e-68) {
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 * (1.0d0 / ((l / t) * (l / t))))))))
t_2 = t * sqrt(2.0d0)
if (l <= (-1.7d-155)) then
tmp = t_1
else if (l <= (-2d-310)) then
tmp = asin((-l / t_2))
else if (l <= 4d-68) 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 * (1.0 / ((l / t) * (l / t))))))));
double t_2 = t * Math.sqrt(2.0);
double tmp;
if (l <= -1.7e-155) {
tmp = t_1;
} else if (l <= -2e-310) {
tmp = Math.asin((-l / t_2));
} else if (l <= 4e-68) {
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 * (1.0 / ((l / t) * (l / t)))))))) t_2 = t * math.sqrt(2.0) tmp = 0 if l <= -1.7e-155: tmp = t_1 elif l <= -2e-310: tmp = math.asin((-l / t_2)) elif l <= 4e-68: 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(Float64(Om / Omc) / Float64(Omc / Om))) / Float64(1.0 + Float64(2.0 * Float64(1.0 / Float64(Float64(l / t) * Float64(l / t)))))))) t_2 = Float64(t * sqrt(2.0)) tmp = 0.0 if (l <= -1.7e-155) tmp = t_1; elseif (l <= -2e-310) tmp = asin(Float64(Float64(-l) / t_2)); elseif (l <= 4e-68) 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 * (1.0 / ((l / t) * (l / t)))))))); t_2 = t * sqrt(2.0); tmp = 0.0; if (l <= -1.7e-155) tmp = t_1; elseif (l <= -2e-310) tmp = asin((-l / t_2)); elseif (l <= 4e-68) 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[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(2.0 * N[(1.0 / N[(N[(l / t), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.7e-155], t$95$1, If[LessEqual[l, -2e-310], N[ArcSin[N[((-l) / t$95$2), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 4e-68], 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{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{1 + 2 \cdot \frac{1}{\frac{\ell}{t} \cdot \frac{\ell}{t}}}}\right)\\
t_2 := t \cdot \sqrt{2}\\
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{-155}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_2}\right)\\
\mathbf{elif}\;\ell \leq 4 \cdot 10^{-68}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_2}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -1.7e-155 or 4.00000000000000027e-68 < l Initial program 91.6%
unpow291.6%
clear-num91.7%
clear-num91.7%
frac-times91.7%
metadata-eval91.7%
Applied egg-rr91.7%
unpow291.7%
clear-num91.7%
un-div-inv91.7%
Applied egg-rr91.7%
if -1.7e-155 < l < -1.999999999999994e-310Initial program 68.2%
sqrt-div68.2%
div-inv68.2%
add-sqr-sqrt68.2%
hypot-1-def68.2%
*-commutative68.2%
sqrt-prod68.2%
unpow268.2%
sqrt-prod53.6%
add-sqr-sqrt93.1%
Applied egg-rr93.1%
associate-*r/93.1%
*-rgt-identity93.1%
associate-*l/93.0%
Simplified93.0%
Taylor expanded in Om around 0 90.7%
Taylor expanded in t around -inf 58.6%
associate-*r/58.6%
neg-mul-158.6%
Simplified58.6%
if -1.999999999999994e-310 < l < 4.00000000000000027e-68Initial program 69.6%
sqrt-div69.5%
div-inv69.5%
add-sqr-sqrt69.5%
hypot-1-def69.5%
*-commutative69.5%
sqrt-prod69.4%
unpow269.4%
sqrt-prod53.4%
add-sqr-sqrt99.0%
Applied egg-rr99.0%
associate-*r/99.0%
*-rgt-identity99.0%
associate-*l/98.9%
Simplified98.9%
Taylor expanded in Om around 0 96.5%
Taylor expanded in t around inf 63.7%
Final simplification81.4%
(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 -5.5e+64)
t_2
(if (<= l -2e-310)
(asin (/ (- l) t_1))
(if (<= l 2.45e-47) (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 <= -5.5e+64) {
tmp = t_2;
} else if (l <= -2e-310) {
tmp = asin((-l / t_1));
} else if (l <= 2.45e-47) {
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 <= (-5.5d+64)) then
tmp = t_2
else if (l <= (-2d-310)) then
tmp = asin((-l / t_1))
else if (l <= 2.45d-47) 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 <= -5.5e+64) {
tmp = t_2;
} else if (l <= -2e-310) {
tmp = Math.asin((-l / t_1));
} else if (l <= 2.45e-47) {
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 <= -5.5e+64: tmp = t_2 elif l <= -2e-310: tmp = math.asin((-l / t_1)) elif l <= 2.45e-47: 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 <= -5.5e+64) tmp = t_2; elseif (l <= -2e-310) tmp = asin(Float64(Float64(-l) / t_1)); elseif (l <= 2.45e-47) 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 <= -5.5e+64) tmp = t_2; elseif (l <= -2e-310) tmp = asin((-l / t_1)); elseif (l <= 2.45e-47) 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, -5.5e+64], t$95$2, If[LessEqual[l, -2e-310], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 2.45e-47], 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 -5.5 \cdot 10^{+64}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\ell \leq 2.45 \cdot 10^{-47}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if l < -5.4999999999999996e64 or 2.4500000000000002e-47 < l Initial program 97.6%
Taylor expanded in t around 0 73.2%
unpow273.2%
unpow273.2%
times-frac78.4%
unpow278.4%
Simplified78.4%
unpow278.4%
clear-num78.4%
frac-times78.4%
*-un-lft-identity78.4%
Applied egg-rr78.4%
if -5.4999999999999996e64 < l < -1.999999999999994e-310Initial program 71.2%
sqrt-div71.2%
div-inv71.2%
add-sqr-sqrt71.2%
hypot-1-def71.2%
*-commutative71.2%
sqrt-prod71.1%
unpow271.1%
sqrt-prod52.7%
add-sqr-sqrt95.8%
Applied egg-rr95.8%
associate-*r/95.8%
*-rgt-identity95.8%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in Om around 0 94.2%
Taylor expanded in t around -inf 49.3%
associate-*r/49.3%
neg-mul-149.3%
Simplified49.3%
if -1.999999999999994e-310 < l < 2.4500000000000002e-47Initial program 70.1%
sqrt-div70.1%
div-inv70.1%
add-sqr-sqrt70.1%
hypot-1-def70.1%
*-commutative70.1%
sqrt-prod70.0%
unpow270.0%
sqrt-prod54.0%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
associate-*r/98.6%
*-rgt-identity98.6%
associate-*l/98.5%
Simplified98.5%
Taylor expanded in Om around 0 96.3%
Taylor expanded in t around inf 63.4%
Final simplification66.6%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0))))
(if (<= l -3.6e+64)
(asin 1.0)
(if (<= l -2e-310)
(asin (/ (- l) t_1))
(if (<= l 3.4e-44) (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 <= -3.6e+64) {
tmp = asin(1.0);
} else if (l <= -2e-310) {
tmp = asin((-l / t_1));
} else if (l <= 3.4e-44) {
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 <= (-3.6d+64)) then
tmp = asin(1.0d0)
else if (l <= (-2d-310)) then
tmp = asin((-l / t_1))
else if (l <= 3.4d-44) 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 <= -3.6e+64) {
tmp = Math.asin(1.0);
} else if (l <= -2e-310) {
tmp = Math.asin((-l / t_1));
} else if (l <= 3.4e-44) {
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 <= -3.6e+64: tmp = math.asin(1.0) elif l <= -2e-310: tmp = math.asin((-l / t_1)) elif l <= 3.4e-44: 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 <= -3.6e+64) tmp = asin(1.0); elseif (l <= -2e-310) tmp = asin(Float64(Float64(-l) / t_1)); elseif (l <= 3.4e-44) 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 <= -3.6e+64) tmp = asin(1.0); elseif (l <= -2e-310) tmp = asin((-l / t_1)); elseif (l <= 3.4e-44) 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, -3.6e+64], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, -2e-310], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 3.4e-44], 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 -3.6 \cdot 10^{+64}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\ell \leq 3.4 \cdot 10^{-44}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -3.60000000000000014e64 or 3.40000000000000016e-44 < l Initial program 97.6%
Taylor expanded in t around 0 73.2%
unpow273.2%
unpow273.2%
times-frac78.4%
unpow278.4%
Simplified78.4%
Taylor expanded in Om around 0 77.8%
if -3.60000000000000014e64 < l < -1.999999999999994e-310Initial program 71.2%
sqrt-div71.2%
div-inv71.2%
add-sqr-sqrt71.2%
hypot-1-def71.2%
*-commutative71.2%
sqrt-prod71.1%
unpow271.1%
sqrt-prod52.7%
add-sqr-sqrt95.8%
Applied egg-rr95.8%
associate-*r/95.8%
*-rgt-identity95.8%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in Om around 0 94.2%
Taylor expanded in t around -inf 49.3%
associate-*r/49.3%
neg-mul-149.3%
Simplified49.3%
if -1.999999999999994e-310 < l < 3.40000000000000016e-44Initial program 70.1%
sqrt-div70.1%
div-inv70.1%
add-sqr-sqrt70.1%
hypot-1-def70.1%
*-commutative70.1%
sqrt-prod70.0%
unpow270.0%
sqrt-prod54.0%
add-sqr-sqrt98.5%
Applied egg-rr98.5%
associate-*r/98.6%
*-rgt-identity98.6%
associate-*l/98.5%
Simplified98.5%
Taylor expanded in Om around 0 96.3%
Taylor expanded in t around inf 63.4%
Final simplification66.4%
(FPCore (t l Om Omc) :precision binary64 (if (<= l -1.1e-157) (asin 1.0) (if (<= l 1.8e-45) (asin (/ l (* t (sqrt 2.0)))) (asin 1.0))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -1.1e-157) {
tmp = asin(1.0);
} else if (l <= 1.8e-45) {
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 <= (-1.1d-157)) then
tmp = asin(1.0d0)
else if (l <= 1.8d-45) 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 <= -1.1e-157) {
tmp = Math.asin(1.0);
} else if (l <= 1.8e-45) {
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 <= -1.1e-157: tmp = math.asin(1.0) elif l <= 1.8e-45: 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 <= -1.1e-157) tmp = asin(1.0); elseif (l <= 1.8e-45) 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 <= -1.1e-157) tmp = asin(1.0); elseif (l <= 1.8e-45) 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, -1.1e-157], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, 1.8e-45], 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 -1.1 \cdot 10^{-157}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{-45}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -1.10000000000000005e-157 or 1.8e-45 < l Initial program 92.1%
Taylor expanded in t around 0 62.0%
unpow262.0%
unpow262.0%
times-frac67.9%
unpow267.9%
Simplified67.9%
Taylor expanded in Om around 0 67.2%
if -1.10000000000000005e-157 < l < 1.8e-45Initial program 69.4%
sqrt-div69.3%
div-inv69.3%
add-sqr-sqrt69.3%
hypot-1-def69.3%
*-commutative69.3%
sqrt-prod69.3%
unpow269.3%
sqrt-prod53.8%
add-sqr-sqrt96.3%
Applied egg-rr96.3%
associate-*r/96.4%
*-rgt-identity96.4%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in Om around 0 94.1%
Taylor expanded in t around inf 64.1%
Final simplification66.1%
(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 83.9%
Taylor expanded in t around 0 43.6%
unpow243.6%
unpow243.6%
times-frac47.9%
unpow247.9%
Simplified47.9%
Taylor expanded in Om around 0 47.5%
Final simplification47.5%
herbie shell --seed 2023334
(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)))))))