
(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 10 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 (/ (/ Om Omc) (/ Omc Om)))) (hypot 1.0 (/ t (/ l (sqrt 2.0)))))))
double code(double t, double l, double Om, double Omc) {
return asin((sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / 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 - ((Om / Omc) / (Omc / Om)))) / Math.hypot(1.0, (t / (l / Math.sqrt(2.0))))));
}
def code(t, l, Om, Omc): return math.asin((math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / math.hypot(1.0, (t / (l / math.sqrt(2.0))))))
function code(t, l, Om, Omc) return asin(Float64(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om)))) / hypot(1.0, Float64(t / Float64(l / sqrt(2.0)))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((sqrt((1.0 - ((Om / Omc) / (Omc / Om)))) / hypot(1.0, (t / (l / sqrt(2.0)))))); end
code[t_, 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[(t / N[(l / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}}{\mathsf{hypot}\left(1, \frac{t}{\frac{\ell}{\sqrt{2}}}\right)}\right)
\end{array}
Initial program 85.9%
sqrt-div85.9%
div-inv85.9%
add-sqr-sqrt85.9%
hypot-1-def85.9%
*-commutative85.9%
sqrt-prod85.9%
unpow285.9%
sqrt-prod56.2%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
associate-*r/98.2%
unpow298.2%
times-frac89.1%
unpow289.1%
unpow289.1%
*-rgt-identity89.1%
unpow289.1%
unpow289.1%
times-frac98.2%
unpow298.2%
associate-*l/98.3%
associate-/l*98.2%
Simplified98.2%
unpow298.2%
clear-num98.2%
un-div-inv98.2%
Applied egg-rr98.2%
Final simplification98.2%
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -4e+60)
(asin (/ (- (* l (sqrt 0.5))) t))
(if (<= (/ t l) 5e+104)
(asin (sqrt (/ 1.0 (+ 1.0 (* 2.0 (* (/ t l) (/ t l)))))))
(asin (/ (sqrt (* l 0.5)) (/ t (sqrt l)))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -4e+60) {
tmp = asin((-(l * sqrt(0.5)) / t));
} else if ((t / l) <= 5e+104) {
tmp = asin(sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l)))))));
} else {
tmp = asin((sqrt((l * 0.5)) / (t / sqrt(l))));
}
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 ((t / l) <= (-4d+60)) then
tmp = asin((-(l * sqrt(0.5d0)) / t))
else if ((t / l) <= 5d+104) then
tmp = asin(sqrt((1.0d0 / (1.0d0 + (2.0d0 * ((t / l) * (t / l)))))))
else
tmp = asin((sqrt((l * 0.5d0)) / (t / sqrt(l))))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -4e+60) {
tmp = Math.asin((-(l * Math.sqrt(0.5)) / t));
} else if ((t / l) <= 5e+104) {
tmp = Math.asin(Math.sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l)))))));
} else {
tmp = Math.asin((Math.sqrt((l * 0.5)) / (t / Math.sqrt(l))));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -4e+60: tmp = math.asin((-(l * math.sqrt(0.5)) / t)) elif (t / l) <= 5e+104: tmp = math.asin(math.sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l))))))) else: tmp = math.asin((math.sqrt((l * 0.5)) / (t / math.sqrt(l)))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -4e+60) tmp = asin(Float64(Float64(-Float64(l * sqrt(0.5))) / t)); elseif (Float64(t / l) <= 5e+104) tmp = asin(sqrt(Float64(1.0 / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) * Float64(t / l))))))); else tmp = asin(Float64(sqrt(Float64(l * 0.5)) / Float64(t / sqrt(l)))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -4e+60) tmp = asin((-(l * sqrt(0.5)) / t)); elseif ((t / l) <= 5e+104) tmp = asin(sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l))))))); else tmp = asin((sqrt((l * 0.5)) / (t / sqrt(l)))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -4e+60], N[ArcSin[N[((-N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]) / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 5e+104], N[ArcSin[N[Sqrt[N[(1.0 / N[(1.0 + N[(2.0 * N[(N[(t / l), $MachinePrecision] * N[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[Sqrt[N[(l * 0.5), $MachinePrecision]], $MachinePrecision] / N[(t / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -4 \cdot 10^{+60}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell \cdot \sqrt{0.5}}{t}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 5 \cdot 10^{+104}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1}{1 + 2 \cdot \left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{\ell \cdot 0.5}}{\frac{t}{\sqrt{\ell}}}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -3.9999999999999998e60Initial program 67.8%
Taylor expanded in Om around 0 49.7%
unpow249.7%
unpow249.7%
Simplified49.7%
Taylor expanded in t around -inf 99.6%
mul-1-neg99.6%
*-commutative99.6%
Simplified99.6%
if -3.9999999999999998e60 < (/.f64 t l) < 4.9999999999999997e104Initial program 98.2%
Taylor expanded in Om around 0 72.5%
unpow272.5%
unpow272.5%
Simplified72.5%
times-frac95.9%
Applied egg-rr95.9%
if 4.9999999999999997e104 < (/.f64 t l) Initial program 64.7%
Taylor expanded in Om around 0 59.1%
unpow259.1%
unpow259.1%
Simplified59.1%
Taylor expanded in t around inf 59.0%
unpow259.0%
unpow259.0%
times-frac66.0%
Simplified66.0%
*-commutative66.0%
sqrt-prod66.0%
sqrt-prod99.3%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
clear-num98.2%
metadata-eval98.2%
add-sqr-sqrt98.0%
sqrt-prod64.6%
sqrt-div64.6%
associate-*r/60.9%
clear-num60.9%
sqrt-prod60.9%
*-commutative60.9%
associate-*r/60.9%
sqrt-div39.1%
associate-*l/39.1%
sqrt-div39.1%
sqrt-unprod49.7%
add-sqr-sqrt49.8%
Applied egg-rr49.8%
Final simplification87.6%
(FPCore (t l Om Omc) :precision binary64 (asin (/ 1.0 (hypot 1.0 (* (sqrt 2.0) (/ t l))))))
double code(double t, double l, double Om, double Omc) {
return asin((1.0 / hypot(1.0, (sqrt(2.0) * (t / l)))));
}
public static double code(double t, double l, double Om, double Omc) {
return Math.asin((1.0 / Math.hypot(1.0, (Math.sqrt(2.0) * (t / l)))));
}
def code(t, l, Om, Omc): return math.asin((1.0 / math.hypot(1.0, (math.sqrt(2.0) * (t / l)))))
function code(t, l, Om, Omc) return asin(Float64(1.0 / hypot(1.0, Float64(sqrt(2.0) * Float64(t / l))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((1.0 / hypot(1.0, (sqrt(2.0) * (t / l))))); end
code[t_, l_, Om_, Omc_] := N[ArcSin[N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[Sqrt[2.0], $MachinePrecision] * N[(t / l), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sin^{-1} \left(\frac{1}{\mathsf{hypot}\left(1, \sqrt{2} \cdot \frac{t}{\ell}\right)}\right)
\end{array}
Initial program 85.9%
Taylor expanded in Om around 0 65.6%
unpow265.6%
unpow265.6%
Simplified65.6%
times-frac84.6%
Applied egg-rr84.6%
sqrt-div84.5%
metadata-eval84.5%
add-sqr-sqrt84.6%
hypot-1-def84.6%
*-commutative84.6%
sqrt-prod84.5%
sqrt-prod55.0%
add-sqr-sqrt96.8%
Applied egg-rr96.8%
Final simplification96.8%
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -4e+60)
(asin (/ (- (* l (sqrt 0.5))) t))
(if (<= (/ t l) 1e+58)
(asin (sqrt (/ 1.0 (+ 1.0 (* 2.0 (* (/ t l) (/ t l)))))))
(asin (* (sqrt 0.5) (/ l t))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -4e+60) {
tmp = asin((-(l * sqrt(0.5)) / t));
} else if ((t / l) <= 1e+58) {
tmp = asin(sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l)))))));
} else {
tmp = asin((sqrt(0.5) * (l / t)));
}
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 ((t / l) <= (-4d+60)) then
tmp = asin((-(l * sqrt(0.5d0)) / t))
else if ((t / l) <= 1d+58) then
tmp = asin(sqrt((1.0d0 / (1.0d0 + (2.0d0 * ((t / l) * (t / l)))))))
else
tmp = asin((sqrt(0.5d0) * (l / t)))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -4e+60) {
tmp = Math.asin((-(l * Math.sqrt(0.5)) / t));
} else if ((t / l) <= 1e+58) {
tmp = Math.asin(Math.sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l)))))));
} else {
tmp = Math.asin((Math.sqrt(0.5) * (l / t)));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -4e+60: tmp = math.asin((-(l * math.sqrt(0.5)) / t)) elif (t / l) <= 1e+58: tmp = math.asin(math.sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l))))))) else: tmp = math.asin((math.sqrt(0.5) * (l / t))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -4e+60) tmp = asin(Float64(Float64(-Float64(l * sqrt(0.5))) / t)); elseif (Float64(t / l) <= 1e+58) tmp = asin(sqrt(Float64(1.0 / Float64(1.0 + Float64(2.0 * Float64(Float64(t / l) * Float64(t / l))))))); else tmp = asin(Float64(sqrt(0.5) * Float64(l / t))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -4e+60) tmp = asin((-(l * sqrt(0.5)) / t)); elseif ((t / l) <= 1e+58) tmp = asin(sqrt((1.0 / (1.0 + (2.0 * ((t / l) * (t / l))))))); else tmp = asin((sqrt(0.5) * (l / t))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -4e+60], N[ArcSin[N[((-N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]) / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 1e+58], N[ArcSin[N[Sqrt[N[(1.0 / N[(1.0 + N[(2.0 * N[(N[(t / l), $MachinePrecision] * N[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(N[Sqrt[0.5], $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -4 \cdot 10^{+60}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell \cdot \sqrt{0.5}}{t}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 10^{+58}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1}{1 + 2 \cdot \left(\frac{t}{\ell} \cdot \frac{t}{\ell}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{0.5} \cdot \frac{\ell}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -3.9999999999999998e60Initial program 67.8%
Taylor expanded in Om around 0 49.7%
unpow249.7%
unpow249.7%
Simplified49.7%
Taylor expanded in t around -inf 99.6%
mul-1-neg99.6%
*-commutative99.6%
Simplified99.6%
if -3.9999999999999998e60 < (/.f64 t l) < 9.99999999999999944e57Initial program 98.1%
Taylor expanded in Om around 0 75.4%
unpow275.4%
unpow275.4%
Simplified75.4%
times-frac96.0%
Applied egg-rr96.0%
if 9.99999999999999944e57 < (/.f64 t l) Initial program 70.0%
Taylor expanded in Om around 0 53.7%
unpow253.7%
unpow253.7%
Simplified53.7%
Taylor expanded in t around inf 98.8%
associate-*r/98.9%
Simplified98.9%
Final simplification97.3%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* l (sqrt 0.5))))
(if (<= (/ t l) -500.0)
(asin (/ (- t_1) t))
(if (<= (/ t l) 0.002)
(asin (- 1.0 (pow (/ t l) 2.0)))
(asin (/ t_1 t))))))
double code(double t, double l, double Om, double Omc) {
double t_1 = l * sqrt(0.5);
double tmp;
if ((t / l) <= -500.0) {
tmp = asin((-t_1 / t));
} else if ((t / l) <= 0.002) {
tmp = asin((1.0 - pow((t / l), 2.0)));
} else {
tmp = asin((t_1 / t));
}
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 = l * sqrt(0.5d0)
if ((t / l) <= (-500.0d0)) then
tmp = asin((-t_1 / t))
else if ((t / l) <= 0.002d0) then
tmp = asin((1.0d0 - ((t / l) ** 2.0d0)))
else
tmp = asin((t_1 / t))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double t_1 = l * Math.sqrt(0.5);
double tmp;
if ((t / l) <= -500.0) {
tmp = Math.asin((-t_1 / t));
} else if ((t / l) <= 0.002) {
tmp = Math.asin((1.0 - Math.pow((t / l), 2.0)));
} else {
tmp = Math.asin((t_1 / t));
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = l * math.sqrt(0.5) tmp = 0 if (t / l) <= -500.0: tmp = math.asin((-t_1 / t)) elif (t / l) <= 0.002: tmp = math.asin((1.0 - math.pow((t / l), 2.0))) else: tmp = math.asin((t_1 / t)) return tmp
function code(t, l, Om, Omc) t_1 = Float64(l * sqrt(0.5)) tmp = 0.0 if (Float64(t / l) <= -500.0) tmp = asin(Float64(Float64(-t_1) / t)); elseif (Float64(t / l) <= 0.002) tmp = asin(Float64(1.0 - (Float64(t / l) ^ 2.0))); else tmp = asin(Float64(t_1 / t)); end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = l * sqrt(0.5); tmp = 0.0; if ((t / l) <= -500.0) tmp = asin((-t_1 / t)); elseif ((t / l) <= 0.002) tmp = asin((1.0 - ((t / l) ^ 2.0))); else tmp = asin((t_1 / t)); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t / l), $MachinePrecision], -500.0], N[ArcSin[N[((-t$95$1) / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.002], N[ArcSin[N[(1.0 - N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[N[(t$95$1 / t), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \ell \cdot \sqrt{0.5}\\
\mathbf{if}\;\frac{t}{\ell} \leq -500:\\
\;\;\;\;\sin^{-1} \left(\frac{-t_1}{t}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.002:\\
\;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{t_1}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -500Initial program 75.3%
Taylor expanded in Om around 0 50.3%
unpow250.3%
unpow250.3%
Simplified50.3%
Taylor expanded in t around -inf 98.4%
mul-1-neg98.4%
*-commutative98.4%
Simplified98.4%
if -500 < (/.f64 t l) < 2e-3Initial program 97.8%
Taylor expanded in Om around 0 82.6%
unpow282.6%
unpow282.6%
Simplified82.6%
Taylor expanded in t around 0 82.6%
mul-1-neg82.6%
unpow282.6%
unpow282.6%
times-frac94.5%
unpow294.5%
unsub-neg94.5%
Simplified94.5%
if 2e-3 < (/.f64 t l) Initial program 74.6%
Taylor expanded in Om around 0 49.5%
unpow249.5%
unpow249.5%
Simplified49.5%
Taylor expanded in t around inf 98.1%
Final simplification96.5%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) -5e+221) (asin (/ (sqrt 0.5) (/ t l))) (if (<= (/ t l) 0.002) (asin 1.0) (asin (* (sqrt 0.5) (/ l t))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -5e+221) {
tmp = asin((sqrt(0.5) / (t / l)));
} else if ((t / l) <= 0.002) {
tmp = asin(1.0);
} else {
tmp = asin((sqrt(0.5) * (l / t)));
}
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 ((t / l) <= (-5d+221)) then
tmp = asin((sqrt(0.5d0) / (t / l)))
else if ((t / l) <= 0.002d0) then
tmp = asin(1.0d0)
else
tmp = asin((sqrt(0.5d0) * (l / t)))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -5e+221) {
tmp = Math.asin((Math.sqrt(0.5) / (t / l)));
} else if ((t / l) <= 0.002) {
tmp = Math.asin(1.0);
} else {
tmp = Math.asin((Math.sqrt(0.5) * (l / t)));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -5e+221: tmp = math.asin((math.sqrt(0.5) / (t / l))) elif (t / l) <= 0.002: tmp = math.asin(1.0) else: tmp = math.asin((math.sqrt(0.5) * (l / t))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -5e+221) tmp = asin(Float64(sqrt(0.5) / Float64(t / l))); elseif (Float64(t / l) <= 0.002) tmp = asin(1.0); else tmp = asin(Float64(sqrt(0.5) * Float64(l / t))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -5e+221) tmp = asin((sqrt(0.5) / (t / l))); elseif ((t / l) <= 0.002) tmp = asin(1.0); else tmp = asin((sqrt(0.5) * (l / t))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -5e+221], N[ArcSin[N[(N[Sqrt[0.5], $MachinePrecision] / N[(t / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.002], N[ArcSin[1.0], $MachinePrecision], N[ArcSin[N[(N[Sqrt[0.5], $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -5 \cdot 10^{+221}:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{\frac{t}{\ell}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.002:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{0.5} \cdot \frac{\ell}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -5.0000000000000002e221Initial program 68.8%
Taylor expanded in Om around 0 68.8%
unpow268.8%
unpow268.8%
Simplified68.8%
Taylor expanded in t around inf 68.8%
unpow268.8%
unpow268.8%
times-frac68.8%
Simplified68.8%
*-commutative68.8%
sqrt-prod68.8%
sqrt-prod64.3%
add-sqr-sqrt68.3%
Applied egg-rr68.3%
*-commutative68.3%
clear-num68.3%
un-div-inv68.3%
Applied egg-rr68.3%
if -5.0000000000000002e221 < (/.f64 t l) < 2e-3Initial program 94.0%
Taylor expanded in Om around 0 72.1%
unpow272.1%
unpow272.1%
Simplified72.1%
Taylor expanded in t around 0 74.5%
if 2e-3 < (/.f64 t l) Initial program 74.6%
Taylor expanded in Om around 0 49.5%
unpow249.5%
unpow249.5%
Simplified49.5%
Taylor expanded in t around inf 98.1%
associate-*r/98.0%
Simplified98.0%
Final simplification80.2%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) -5e+221) (asin (/ (sqrt 0.5) (/ t l))) (if (<= (/ t l) 0.002) (asin 1.0) (asin (/ (* l (sqrt 0.5)) t)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -5e+221) {
tmp = asin((sqrt(0.5) / (t / l)));
} else if ((t / l) <= 0.002) {
tmp = asin(1.0);
} else {
tmp = asin(((l * sqrt(0.5)) / t));
}
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 ((t / l) <= (-5d+221)) then
tmp = asin((sqrt(0.5d0) / (t / l)))
else if ((t / l) <= 0.002d0) then
tmp = asin(1.0d0)
else
tmp = asin(((l * sqrt(0.5d0)) / t))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -5e+221) {
tmp = Math.asin((Math.sqrt(0.5) / (t / l)));
} else if ((t / l) <= 0.002) {
tmp = Math.asin(1.0);
} else {
tmp = Math.asin(((l * Math.sqrt(0.5)) / t));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -5e+221: tmp = math.asin((math.sqrt(0.5) / (t / l))) elif (t / l) <= 0.002: tmp = math.asin(1.0) else: tmp = math.asin(((l * math.sqrt(0.5)) / t)) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (Float64(t / l) <= -5e+221) tmp = asin(Float64(sqrt(0.5) / Float64(t / l))); elseif (Float64(t / l) <= 0.002) tmp = asin(1.0); else tmp = asin(Float64(Float64(l * sqrt(0.5)) / t)); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if ((t / l) <= -5e+221) tmp = asin((sqrt(0.5) / (t / l))); elseif ((t / l) <= 0.002) tmp = asin(1.0); else tmp = asin(((l * sqrt(0.5)) / t)); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[N[(t / l), $MachinePrecision], -5e+221], N[ArcSin[N[(N[Sqrt[0.5], $MachinePrecision] / N[(t / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.002], N[ArcSin[1.0], $MachinePrecision], N[ArcSin[N[(N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{t}{\ell} \leq -5 \cdot 10^{+221}:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{\frac{t}{\ell}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.002:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -5.0000000000000002e221Initial program 68.8%
Taylor expanded in Om around 0 68.8%
unpow268.8%
unpow268.8%
Simplified68.8%
Taylor expanded in t around inf 68.8%
unpow268.8%
unpow268.8%
times-frac68.8%
Simplified68.8%
*-commutative68.8%
sqrt-prod68.8%
sqrt-prod64.3%
add-sqr-sqrt68.3%
Applied egg-rr68.3%
*-commutative68.3%
clear-num68.3%
un-div-inv68.3%
Applied egg-rr68.3%
if -5.0000000000000002e221 < (/.f64 t l) < 2e-3Initial program 94.0%
Taylor expanded in Om around 0 72.1%
unpow272.1%
unpow272.1%
Simplified72.1%
Taylor expanded in t around 0 74.5%
if 2e-3 < (/.f64 t l) Initial program 74.6%
Taylor expanded in Om around 0 49.5%
unpow249.5%
unpow249.5%
Simplified49.5%
Taylor expanded in t around inf 98.1%
Final simplification80.3%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* l (sqrt 0.5))))
(if (<= (/ t l) -500.0)
(asin (/ (- t_1) t))
(if (<= (/ t l) 0.002) (asin 1.0) (asin (/ t_1 t))))))
double code(double t, double l, double Om, double Omc) {
double t_1 = l * sqrt(0.5);
double tmp;
if ((t / l) <= -500.0) {
tmp = asin((-t_1 / t));
} else if ((t / l) <= 0.002) {
tmp = asin(1.0);
} else {
tmp = asin((t_1 / t));
}
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 = l * sqrt(0.5d0)
if ((t / l) <= (-500.0d0)) then
tmp = asin((-t_1 / t))
else if ((t / l) <= 0.002d0) then
tmp = asin(1.0d0)
else
tmp = asin((t_1 / t))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double t_1 = l * Math.sqrt(0.5);
double tmp;
if ((t / l) <= -500.0) {
tmp = Math.asin((-t_1 / t));
} else if ((t / l) <= 0.002) {
tmp = Math.asin(1.0);
} else {
tmp = Math.asin((t_1 / t));
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = l * math.sqrt(0.5) tmp = 0 if (t / l) <= -500.0: tmp = math.asin((-t_1 / t)) elif (t / l) <= 0.002: tmp = math.asin(1.0) else: tmp = math.asin((t_1 / t)) return tmp
function code(t, l, Om, Omc) t_1 = Float64(l * sqrt(0.5)) tmp = 0.0 if (Float64(t / l) <= -500.0) tmp = asin(Float64(Float64(-t_1) / t)); elseif (Float64(t / l) <= 0.002) tmp = asin(1.0); else tmp = asin(Float64(t_1 / t)); end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = l * sqrt(0.5); tmp = 0.0; if ((t / l) <= -500.0) tmp = asin((-t_1 / t)); elseif ((t / l) <= 0.002) tmp = asin(1.0); else tmp = asin((t_1 / t)); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(l * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t / l), $MachinePrecision], -500.0], N[ArcSin[N[((-t$95$1) / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.002], N[ArcSin[1.0], $MachinePrecision], N[ArcSin[N[(t$95$1 / t), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \ell \cdot \sqrt{0.5}\\
\mathbf{if}\;\frac{t}{\ell} \leq -500:\\
\;\;\;\;\sin^{-1} \left(\frac{-t_1}{t}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.002:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{t_1}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -500Initial program 75.3%
Taylor expanded in Om around 0 50.3%
unpow250.3%
unpow250.3%
Simplified50.3%
Taylor expanded in t around -inf 98.4%
mul-1-neg98.4%
*-commutative98.4%
Simplified98.4%
if -500 < (/.f64 t l) < 2e-3Initial program 97.8%
Taylor expanded in Om around 0 82.6%
unpow282.6%
unpow282.6%
Simplified82.6%
Taylor expanded in t around 0 93.8%
if 2e-3 < (/.f64 t l) Initial program 74.6%
Taylor expanded in Om around 0 49.5%
unpow249.5%
unpow249.5%
Simplified49.5%
Taylor expanded in t around inf 98.1%
Final simplification96.1%
(FPCore (t l Om Omc) :precision binary64 (if (<= t 1.9e+135) (asin 1.0) (asin (* (sqrt 0.5) (/ l t)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (t <= 1.9e+135) {
tmp = asin(1.0);
} else {
tmp = asin((sqrt(0.5) * (l / t)));
}
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 (t <= 1.9d+135) then
tmp = asin(1.0d0)
else
tmp = asin((sqrt(0.5d0) * (l / t)))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double tmp;
if (t <= 1.9e+135) {
tmp = Math.asin(1.0);
} else {
tmp = Math.asin((Math.sqrt(0.5) * (l / t)));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if t <= 1.9e+135: tmp = math.asin(1.0) else: tmp = math.asin((math.sqrt(0.5) * (l / t))) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (t <= 1.9e+135) tmp = asin(1.0); else tmp = asin(Float64(sqrt(0.5) * Float64(l / t))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (t <= 1.9e+135) tmp = asin(1.0); else tmp = asin((sqrt(0.5) * (l / t))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[t, 1.9e+135], N[ArcSin[1.0], $MachinePrecision], N[ArcSin[N[(N[Sqrt[0.5], $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.9 \cdot 10^{+135}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{0.5} \cdot \frac{\ell}{t}\right)\\
\end{array}
\end{array}
if t < 1.9000000000000001e135Initial program 86.8%
Taylor expanded in Om around 0 68.2%
unpow268.2%
unpow268.2%
Simplified68.2%
Taylor expanded in t around 0 54.2%
if 1.9000000000000001e135 < t Initial program 81.8%
Taylor expanded in Om around 0 53.6%
unpow253.6%
unpow253.6%
Simplified53.6%
Taylor expanded in t around inf 65.4%
associate-*r/65.3%
Simplified65.3%
Final simplification56.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 85.9%
Taylor expanded in Om around 0 65.6%
unpow265.6%
unpow265.6%
Simplified65.6%
Taylor expanded in t around 0 47.7%
Final simplification47.7%
herbie shell --seed 2023192
(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)))))))