
(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 11 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(t / Float64(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[(t / N[(l / N[Sqrt[2.0], $MachinePrecision]), $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}{\frac{\ell}{\sqrt{2}}}\right)}\right)
\end{array}
Initial program 83.7%
sqrt-div83.7%
div-inv83.7%
add-sqr-sqrt83.7%
hypot-1-def83.7%
*-commutative83.7%
sqrt-prod83.7%
unpow283.7%
sqrt-prod52.8%
add-sqr-sqrt98.8%
Applied egg-rr98.8%
associate-*r/98.8%
unpow298.8%
times-frac87.6%
unpow287.6%
unpow287.6%
*-rgt-identity87.6%
unpow287.6%
unpow287.6%
times-frac98.8%
unpow298.8%
associate-*l/98.7%
associate-/l*98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (t l Om Omc) :precision binary64 (asin (/ (sqrt (- 1.0 (pow (/ Om Omc) 2.0))) (hypot 1.0 (* (sqrt 2.0) (/ t l))))))
double code(double t, double l, double Om, double Omc) {
return asin((sqrt((1.0 - pow((Om / Omc), 2.0))) / hypot(1.0, (sqrt(2.0) * (t / l)))));
}
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, (Math.sqrt(2.0) * (t / l)))));
}
def code(t, l, Om, Omc): return math.asin((math.sqrt((1.0 - math.pow((Om / Omc), 2.0))) / math.hypot(1.0, (math.sqrt(2.0) * (t / l)))))
function code(t, l, Om, Omc) return asin(Float64(sqrt(Float64(1.0 - (Float64(Om / Omc) ^ 2.0))) / hypot(1.0, Float64(sqrt(2.0) * Float64(t / l))))) end
function tmp = code(t, l, Om, Omc) tmp = asin((sqrt((1.0 - ((Om / Omc) ^ 2.0))) / hypot(1.0, (sqrt(2.0) * (t / l))))); 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[Sqrt[2.0], $MachinePrecision] * N[(t / l), $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, \sqrt{2} \cdot \frac{t}{\ell}\right)}\right)
\end{array}
Initial program 83.7%
sqrt-div83.7%
add-sqr-sqrt83.7%
hypot-1-def83.7%
*-commutative83.7%
sqrt-prod83.7%
unpow283.7%
sqrt-prod52.8%
add-sqr-sqrt98.8%
Applied egg-rr98.8%
Final simplification98.8%
(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 83.7%
Taylor expanded in Om around 0 68.2%
unpow268.2%
unpow268.2%
Simplified68.2%
sqrt-div68.2%
metadata-eval68.2%
+-commutative68.2%
times-frac83.2%
unpow283.2%
fma-udef83.2%
Applied egg-rr83.2%
unpow283.2%
times-frac68.2%
unpow268.2%
unpow268.2%
fma-def68.2%
+-commutative68.2%
rem-square-sqrt68.2%
unpow268.2%
unpow268.2%
times-frac83.1%
swap-sqr83.2%
unpow283.2%
unpow283.2%
hypot-1-def98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -5e+118)
(asin (/ (- l) (* t (sqrt 2.0))))
(if (<= (/ t l) 2e+153)
(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) <= -5e+118) {
tmp = asin((-l / (t * sqrt(2.0))));
} else if ((t / l) <= 2e+153) {
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) <= (-5d+118)) then
tmp = asin((-l / (t * sqrt(2.0d0))))
else if ((t / l) <= 2d+153) 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) <= -5e+118) {
tmp = Math.asin((-l / (t * Math.sqrt(2.0))));
} else if ((t / l) <= 2e+153) {
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) <= -5e+118: tmp = math.asin((-l / (t * math.sqrt(2.0)))) elif (t / l) <= 2e+153: 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) <= -5e+118) tmp = asin(Float64(Float64(-l) / Float64(t * sqrt(2.0)))); elseif (Float64(t / l) <= 2e+153) 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) <= -5e+118) tmp = asin((-l / (t * sqrt(2.0)))); elseif ((t / l) <= 2e+153) 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], -5e+118], N[ArcSin[N[((-l) / N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 2e+153], 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 -5 \cdot 10^{+118}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 2 \cdot 10^{+153}:\\
\;\;\;\;\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) < -4.99999999999999972e118Initial program 64.7%
Taylor expanded in Om around 0 58.5%
unpow258.5%
unpow258.5%
Simplified58.5%
sqrt-div58.5%
metadata-eval58.5%
+-commutative58.5%
times-frac64.7%
unpow264.7%
fma-udef64.7%
Applied egg-rr64.7%
unpow264.7%
times-frac58.5%
unpow258.5%
unpow258.5%
fma-def58.5%
+-commutative58.5%
rem-square-sqrt58.4%
unpow258.4%
unpow258.4%
times-frac64.6%
swap-sqr64.7%
unpow264.7%
unpow264.7%
hypot-1-def98.8%
Simplified98.8%
Taylor expanded in t around -inf 99.8%
associate-*r/99.8%
mul-1-neg99.8%
Simplified99.8%
if -4.99999999999999972e118 < (/.f64 t l) < 2e153Initial program 98.8%
Taylor expanded in Om around 0 76.4%
unpow276.4%
unpow276.4%
Simplified76.4%
times-frac98.0%
Applied egg-rr98.0%
if 2e153 < (/.f64 t l) Initial program 48.0%
Taylor expanded in Om around 0 48.0%
unpow248.0%
unpow248.0%
Simplified48.0%
Taylor expanded in t around inf 98.2%
*-commutative98.2%
associate-*l/98.3%
*-commutative98.3%
Simplified98.3%
Final simplification98.4%
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -5000.0)
(asin (/ (/ (- l) (sqrt 2.0)) t))
(if (<= (/ t l) 0.05)
(asin (/ 1.0 (+ 1.0 (/ 1.0 (pow (/ l t) 2.0)))))
(asin (/ (* l (sqrt 0.5)) t)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -5000.0) {
tmp = asin(((-l / sqrt(2.0)) / t));
} else if ((t / l) <= 0.05) {
tmp = asin((1.0 / (1.0 + (1.0 / pow((l / t), 2.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) <= (-5000.0d0)) then
tmp = asin(((-l / sqrt(2.0d0)) / t))
else if ((t / l) <= 0.05d0) then
tmp = asin((1.0d0 / (1.0d0 + (1.0d0 / ((l / t) ** 2.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) <= -5000.0) {
tmp = Math.asin(((-l / Math.sqrt(2.0)) / t));
} else if ((t / l) <= 0.05) {
tmp = Math.asin((1.0 / (1.0 + (1.0 / Math.pow((l / t), 2.0)))));
} else {
tmp = Math.asin(((l * Math.sqrt(0.5)) / t));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -5000.0: tmp = math.asin(((-l / math.sqrt(2.0)) / t)) elif (t / l) <= 0.05: tmp = math.asin((1.0 / (1.0 + (1.0 / math.pow((l / t), 2.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) <= -5000.0) tmp = asin(Float64(Float64(Float64(-l) / sqrt(2.0)) / t)); elseif (Float64(t / l) <= 0.05) tmp = asin(Float64(1.0 / Float64(1.0 + Float64(1.0 / (Float64(l / t) ^ 2.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) <= -5000.0) tmp = asin(((-l / sqrt(2.0)) / t)); elseif ((t / l) <= 0.05) tmp = asin((1.0 / (1.0 + (1.0 / ((l / t) ^ 2.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], -5000.0], N[ArcSin[N[(N[((-l) / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.05], N[ArcSin[N[(1.0 / N[(1.0 + N[(1.0 / N[Power[N[(l / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $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 -5000:\\
\;\;\;\;\sin^{-1} \left(\frac{\frac{-\ell}{\sqrt{2}}}{t}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.05:\\
\;\;\;\;\sin^{-1} \left(\frac{1}{1 + \frac{1}{{\left(\frac{\ell}{t}\right)}^{2}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -5e3Initial program 75.7%
Taylor expanded in Om around 0 58.0%
unpow258.0%
unpow258.0%
Simplified58.0%
sqrt-div58.0%
metadata-eval58.0%
+-commutative58.0%
times-frac75.6%
unpow275.6%
fma-udef75.6%
Applied egg-rr75.6%
unpow275.6%
times-frac58.0%
unpow258.0%
unpow258.0%
fma-def58.0%
+-commutative58.0%
rem-square-sqrt57.9%
unpow257.9%
unpow257.9%
times-frac75.4%
swap-sqr75.6%
unpow275.6%
unpow275.6%
hypot-1-def99.0%
Simplified99.0%
Taylor expanded in t around -inf 99.0%
mul-1-neg99.0%
associate-/r*99.0%
Simplified99.0%
if -5e3 < (/.f64 t l) < 0.050000000000000003Initial program 98.6%
Taylor expanded in Om around 0 85.4%
unpow285.4%
unpow285.4%
Simplified85.4%
sqrt-div85.4%
metadata-eval85.4%
+-commutative85.4%
times-frac98.0%
unpow298.0%
fma-udef98.0%
Applied egg-rr98.0%
unpow298.0%
times-frac85.4%
unpow285.4%
unpow285.4%
fma-def85.4%
+-commutative85.4%
rem-square-sqrt85.4%
unpow285.4%
unpow285.4%
times-frac98.0%
swap-sqr98.0%
unpow298.0%
unpow298.0%
hypot-1-def98.0%
Simplified98.0%
Taylor expanded in t around 0 85.4%
associate-/l*85.4%
unpow285.4%
rem-square-sqrt85.4%
unpow285.4%
unpow285.4%
times-frac97.0%
unpow297.0%
associate-*r/97.0%
metadata-eval97.0%
Simplified97.0%
if 0.050000000000000003 < (/.f64 t l) Initial program 63.8%
Taylor expanded in Om around 0 45.9%
unpow245.9%
unpow245.9%
Simplified45.9%
Taylor expanded in t around inf 97.0%
Final simplification97.5%
(FPCore (t l Om Omc)
:precision binary64
(if (<= (/ t l) -0.5)
(asin (/ (/ (- l) (sqrt 2.0)) t))
(if (<= (/ t l) 0.05)
(asin (- 1.0 (pow (/ t l) 2.0)))
(asin (/ (* l (sqrt 0.5)) t)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -0.5) {
tmp = asin(((-l / sqrt(2.0)) / t));
} else if ((t / l) <= 0.05) {
tmp = asin((1.0 - pow((t / l), 2.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) <= (-0.5d0)) then
tmp = asin(((-l / sqrt(2.0d0)) / t))
else if ((t / l) <= 0.05d0) then
tmp = asin((1.0d0 - ((t / l) ** 2.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) <= -0.5) {
tmp = Math.asin(((-l / Math.sqrt(2.0)) / t));
} else if ((t / l) <= 0.05) {
tmp = Math.asin((1.0 - Math.pow((t / l), 2.0)));
} else {
tmp = Math.asin(((l * Math.sqrt(0.5)) / t));
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if (t / l) <= -0.5: tmp = math.asin(((-l / math.sqrt(2.0)) / t)) elif (t / l) <= 0.05: tmp = math.asin((1.0 - math.pow((t / l), 2.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) <= -0.5) tmp = asin(Float64(Float64(Float64(-l) / sqrt(2.0)) / t)); elseif (Float64(t / l) <= 0.05) tmp = asin(Float64(1.0 - (Float64(t / l) ^ 2.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) <= -0.5) tmp = asin(((-l / sqrt(2.0)) / t)); elseif ((t / l) <= 0.05) tmp = asin((1.0 - ((t / l) ^ 2.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], -0.5], N[ArcSin[N[(N[((-l) / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.05], N[ArcSin[N[(1.0 - N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $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 -0.5:\\
\;\;\;\;\sin^{-1} \left(\frac{\frac{-\ell}{\sqrt{2}}}{t}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.05:\\
\;\;\;\;\sin^{-1} \left(1 - {\left(\frac{t}{\ell}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -0.5Initial program 76.0%
Taylor expanded in Om around 0 57.2%
unpow257.2%
unpow257.2%
Simplified57.2%
sqrt-div57.1%
metadata-eval57.1%
+-commutative57.1%
times-frac76.0%
unpow276.0%
fma-udef76.0%
Applied egg-rr76.0%
unpow276.0%
times-frac57.1%
unpow257.1%
unpow257.1%
fma-def57.1%
+-commutative57.1%
rem-square-sqrt57.1%
unpow257.1%
unpow257.1%
times-frac75.7%
swap-sqr75.9%
unpow275.9%
unpow275.9%
hypot-1-def99.0%
Simplified99.0%
Taylor expanded in t around -inf 97.9%
mul-1-neg97.9%
associate-/r*97.8%
Simplified97.8%
if -0.5 < (/.f64 t l) < 0.050000000000000003Initial program 98.6%
Taylor expanded in Om around 0 86.1%
unpow286.1%
unpow286.1%
Simplified86.1%
Taylor expanded in t around 0 86.1%
mul-1-neg86.1%
unsub-neg86.1%
unpow286.1%
unpow286.1%
times-frac97.5%
unpow297.5%
Simplified97.5%
if 0.050000000000000003 < (/.f64 t l) Initial program 63.8%
Taylor expanded in Om around 0 45.9%
unpow245.9%
unpow245.9%
Simplified45.9%
Taylor expanded in t around inf 97.0%
Final simplification97.5%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) -1e+216) (asin (/ (sqrt 0.5) (/ t l))) (if (<= (/ t l) 0.05) (asin 1.0) (asin (* (sqrt 0.5) (/ l t))))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -1e+216) {
tmp = asin((sqrt(0.5) / (t / l)));
} else if ((t / l) <= 0.05) {
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) <= (-1d+216)) then
tmp = asin((sqrt(0.5d0) / (t / l)))
else if ((t / l) <= 0.05d0) 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) <= -1e+216) {
tmp = Math.asin((Math.sqrt(0.5) / (t / l)));
} else if ((t / l) <= 0.05) {
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) <= -1e+216: tmp = math.asin((math.sqrt(0.5) / (t / l))) elif (t / l) <= 0.05: 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) <= -1e+216) tmp = asin(Float64(sqrt(0.5) / Float64(t / l))); elseif (Float64(t / l) <= 0.05) 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) <= -1e+216) tmp = asin((sqrt(0.5) / (t / l))); elseif ((t / l) <= 0.05) 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], -1e+216], N[ArcSin[N[(N[Sqrt[0.5], $MachinePrecision] / N[(t / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.05], 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 -1 \cdot 10^{+216}:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{\frac{t}{\ell}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.05:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{0.5} \cdot \frac{\ell}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1e216Initial program 66.3%
Taylor expanded in Om around 0 66.3%
unpow266.3%
unpow266.3%
Simplified66.3%
Taylor expanded in t around inf 66.3%
unpow266.3%
unpow266.3%
times-frac66.3%
Simplified66.3%
Taylor expanded in l around 0 65.7%
associate-/l*65.7%
Simplified65.7%
if -1e216 < (/.f64 t l) < 0.050000000000000003Initial program 95.8%
Taylor expanded in Om around 0 77.9%
unpow277.9%
unpow277.9%
Simplified77.9%
Taylor expanded in t around 0 77.9%
if 0.050000000000000003 < (/.f64 t l) Initial program 63.8%
Taylor expanded in Om around 0 45.9%
unpow245.9%
unpow245.9%
Simplified45.9%
Taylor expanded in t around inf 97.0%
*-commutative97.0%
associate-*l/97.0%
*-commutative97.0%
Simplified97.0%
Final simplification81.2%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) -1e+216) (asin (/ (sqrt 0.5) (/ t l))) (if (<= (/ t l) 0.05) (asin 1.0) (asin (/ (* l (sqrt 0.5)) t)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -1e+216) {
tmp = asin((sqrt(0.5) / (t / l)));
} else if ((t / l) <= 0.05) {
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) <= (-1d+216)) then
tmp = asin((sqrt(0.5d0) / (t / l)))
else if ((t / l) <= 0.05d0) 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) <= -1e+216) {
tmp = Math.asin((Math.sqrt(0.5) / (t / l)));
} else if ((t / l) <= 0.05) {
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) <= -1e+216: tmp = math.asin((math.sqrt(0.5) / (t / l))) elif (t / l) <= 0.05: 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) <= -1e+216) tmp = asin(Float64(sqrt(0.5) / Float64(t / l))); elseif (Float64(t / l) <= 0.05) 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) <= -1e+216) tmp = asin((sqrt(0.5) / (t / l))); elseif ((t / l) <= 0.05) 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], -1e+216], N[ArcSin[N[(N[Sqrt[0.5], $MachinePrecision] / N[(t / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.05], 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 -1 \cdot 10^{+216}:\\
\;\;\;\;\sin^{-1} \left(\frac{\sqrt{0.5}}{\frac{t}{\ell}}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.05:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -1e216Initial program 66.3%
Taylor expanded in Om around 0 66.3%
unpow266.3%
unpow266.3%
Simplified66.3%
Taylor expanded in t around inf 66.3%
unpow266.3%
unpow266.3%
times-frac66.3%
Simplified66.3%
Taylor expanded in l around 0 65.7%
associate-/l*65.7%
Simplified65.7%
if -1e216 < (/.f64 t l) < 0.050000000000000003Initial program 95.8%
Taylor expanded in Om around 0 77.9%
unpow277.9%
unpow277.9%
Simplified77.9%
Taylor expanded in t around 0 77.9%
if 0.050000000000000003 < (/.f64 t l) Initial program 63.8%
Taylor expanded in Om around 0 45.9%
unpow245.9%
unpow245.9%
Simplified45.9%
Taylor expanded in t around inf 97.0%
Final simplification81.1%
(FPCore (t l Om Omc) :precision binary64 (if (<= (/ t l) -0.5) (asin (/ (/ (- l) (sqrt 2.0)) t)) (if (<= (/ t l) 0.05) (asin 1.0) (asin (/ (* l (sqrt 0.5)) t)))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if ((t / l) <= -0.5) {
tmp = asin(((-l / sqrt(2.0)) / t));
} else if ((t / l) <= 0.05) {
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) <= (-0.5d0)) then
tmp = asin(((-l / sqrt(2.0d0)) / t))
else if ((t / l) <= 0.05d0) 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) <= -0.5) {
tmp = Math.asin(((-l / Math.sqrt(2.0)) / t));
} else if ((t / l) <= 0.05) {
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) <= -0.5: tmp = math.asin(((-l / math.sqrt(2.0)) / t)) elif (t / l) <= 0.05: 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) <= -0.5) tmp = asin(Float64(Float64(Float64(-l) / sqrt(2.0)) / t)); elseif (Float64(t / l) <= 0.05) 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) <= -0.5) tmp = asin(((-l / sqrt(2.0)) / t)); elseif ((t / l) <= 0.05) 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], -0.5], N[ArcSin[N[(N[((-l) / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[(t / l), $MachinePrecision], 0.05], 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 -0.5:\\
\;\;\;\;\sin^{-1} \left(\frac{\frac{-\ell}{\sqrt{2}}}{t}\right)\\
\mathbf{elif}\;\frac{t}{\ell} \leq 0.05:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell \cdot \sqrt{0.5}}{t}\right)\\
\end{array}
\end{array}
if (/.f64 t l) < -0.5Initial program 76.0%
Taylor expanded in Om around 0 57.2%
unpow257.2%
unpow257.2%
Simplified57.2%
sqrt-div57.1%
metadata-eval57.1%
+-commutative57.1%
times-frac76.0%
unpow276.0%
fma-udef76.0%
Applied egg-rr76.0%
unpow276.0%
times-frac57.1%
unpow257.1%
unpow257.1%
fma-def57.1%
+-commutative57.1%
rem-square-sqrt57.1%
unpow257.1%
unpow257.1%
times-frac75.7%
swap-sqr75.9%
unpow275.9%
unpow275.9%
hypot-1-def99.0%
Simplified99.0%
Taylor expanded in t around -inf 97.9%
mul-1-neg97.9%
associate-/r*97.8%
Simplified97.8%
if -0.5 < (/.f64 t l) < 0.050000000000000003Initial program 98.6%
Taylor expanded in Om around 0 86.1%
unpow286.1%
unpow286.1%
Simplified86.1%
Taylor expanded in t around 0 97.4%
if 0.050000000000000003 < (/.f64 t l) Initial program 63.8%
Taylor expanded in Om around 0 45.9%
unpow245.9%
unpow245.9%
Simplified45.9%
Taylor expanded in t around inf 97.0%
Final simplification97.4%
(FPCore (t l Om Omc) :precision binary64 (if (<= l -8.5e-122) (asin 1.0) (if (<= l 2.1e+40) (asin (* (sqrt 0.5) (/ l t))) (asin 1.0))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -8.5e-122) {
tmp = asin(1.0);
} else if (l <= 2.1e+40) {
tmp = asin((sqrt(0.5) * (l / t)));
} 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 <= (-8.5d-122)) then
tmp = asin(1.0d0)
else if (l <= 2.1d+40) then
tmp = asin((sqrt(0.5d0) * (l / t)))
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 <= -8.5e-122) {
tmp = Math.asin(1.0);
} else if (l <= 2.1e+40) {
tmp = Math.asin((Math.sqrt(0.5) * (l / t)));
} else {
tmp = Math.asin(1.0);
}
return tmp;
}
def code(t, l, Om, Omc): tmp = 0 if l <= -8.5e-122: tmp = math.asin(1.0) elif l <= 2.1e+40: tmp = math.asin((math.sqrt(0.5) * (l / t))) else: tmp = math.asin(1.0) return tmp
function code(t, l, Om, Omc) tmp = 0.0 if (l <= -8.5e-122) tmp = asin(1.0); elseif (l <= 2.1e+40) tmp = asin(Float64(sqrt(0.5) * Float64(l / t))); else tmp = asin(1.0); end return tmp end
function tmp_2 = code(t, l, Om, Omc) tmp = 0.0; if (l <= -8.5e-122) tmp = asin(1.0); elseif (l <= 2.1e+40) tmp = asin((sqrt(0.5) * (l / t))); else tmp = asin(1.0); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := If[LessEqual[l, -8.5e-122], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, 2.1e+40], N[ArcSin[N[(N[Sqrt[0.5], $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcSin[1.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.5 \cdot 10^{-122}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;\ell \leq 2.1 \cdot 10^{+40}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{0.5} \cdot \frac{\ell}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -8.50000000000000003e-122 or 2.1000000000000001e40 < l Initial program 93.1%
Taylor expanded in Om around 0 79.3%
unpow279.3%
unpow279.3%
Simplified79.3%
Taylor expanded in t around 0 75.3%
if -8.50000000000000003e-122 < l < 2.1000000000000001e40Initial program 73.7%
Taylor expanded in Om around 0 56.3%
unpow256.3%
unpow256.3%
Simplified56.3%
Taylor expanded in t around inf 55.5%
*-commutative55.5%
associate-*l/55.5%
*-commutative55.5%
Simplified55.5%
Final simplification65.8%
(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.7%
Taylor expanded in Om around 0 68.2%
unpow268.2%
unpow268.2%
Simplified68.2%
Taylor expanded in t around 0 49.4%
Final simplification49.4%
herbie shell --seed 2023207
(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)))))))