
(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
(let* ((t_1 (- 1.0 (pow (/ Om Omc) 2.0)))
(t_2 (+ 1.0 (* 2.0 (pow (/ t l) 2.0)))))
(if (<= (/ t_1 t_2) 0.0)
(fabs (asin (* (sqrt t_1) (/ l (/ t (sqrt 0.5))))))
(asin (sqrt (/ (- 1.0 (/ (/ Om Omc) (/ Omc Om))) t_2))))))
double code(double t, double l, double Om, double Omc) {
double t_1 = 1.0 - pow((Om / Omc), 2.0);
double t_2 = 1.0 + (2.0 * pow((t / l), 2.0));
double tmp;
if ((t_1 / t_2) <= 0.0) {
tmp = fabs(asin((sqrt(t_1) * (l / (t / sqrt(0.5))))));
} else {
tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / 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 = 1.0d0 - ((om / omc) ** 2.0d0)
t_2 = 1.0d0 + (2.0d0 * ((t / l) ** 2.0d0))
if ((t_1 / t_2) <= 0.0d0) then
tmp = abs(asin((sqrt(t_1) * (l / (t / sqrt(0.5d0))))))
else
tmp = asin(sqrt(((1.0d0 - ((om / omc) / (omc / om))) / t_2)))
end if
code = tmp
end function
public static double code(double t, double l, double Om, double Omc) {
double t_1 = 1.0 - Math.pow((Om / Omc), 2.0);
double t_2 = 1.0 + (2.0 * Math.pow((t / l), 2.0));
double tmp;
if ((t_1 / t_2) <= 0.0) {
tmp = Math.abs(Math.asin((Math.sqrt(t_1) * (l / (t / Math.sqrt(0.5))))));
} else {
tmp = Math.asin(Math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / t_2)));
}
return tmp;
}
def code(t, l, Om, Omc): t_1 = 1.0 - math.pow((Om / Omc), 2.0) t_2 = 1.0 + (2.0 * math.pow((t / l), 2.0)) tmp = 0 if (t_1 / t_2) <= 0.0: tmp = math.fabs(math.asin((math.sqrt(t_1) * (l / (t / math.sqrt(0.5)))))) else: tmp = math.asin(math.sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / t_2))) return tmp
function code(t, l, Om, Omc) t_1 = Float64(1.0 - (Float64(Om / Omc) ^ 2.0)) t_2 = Float64(1.0 + Float64(2.0 * (Float64(t / l) ^ 2.0))) tmp = 0.0 if (Float64(t_1 / t_2) <= 0.0) tmp = abs(asin(Float64(sqrt(t_1) * Float64(l / Float64(t / sqrt(0.5)))))); else tmp = asin(sqrt(Float64(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))) / t_2))); end return tmp end
function tmp_2 = code(t, l, Om, Omc) t_1 = 1.0 - ((Om / Omc) ^ 2.0); t_2 = 1.0 + (2.0 * ((t / l) ^ 2.0)); tmp = 0.0; if ((t_1 / t_2) <= 0.0) tmp = abs(asin((sqrt(t_1) * (l / (t / sqrt(0.5)))))); else tmp = asin(sqrt(((1.0 - ((Om / Omc) / (Omc / Om))) / t_2))); end tmp_2 = tmp; end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(1.0 - N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(2.0 * N[Power[N[(t / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 / t$95$2), $MachinePrecision], 0.0], N[Abs[N[ArcSin[N[(N[Sqrt[t$95$1], $MachinePrecision] * N[(l / N[(t / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[ArcSin[N[Sqrt[N[(N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 - {\left(\frac{Om}{Omc}\right)}^{2}\\
t_2 := 1 + 2 \cdot {\left(\frac{t}{\ell}\right)}^{2}\\
\mathbf{if}\;\frac{t_1}{t_2} \leq 0:\\
\;\;\;\;\left|\sin^{-1} \left(\sqrt{t_1} \cdot \frac{\ell}{\frac{t}{\sqrt{0.5}}}\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{\frac{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}{t_2}}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 1 (pow.f64 (/.f64 Om Omc) 2)) (+.f64 1 (*.f64 2 (pow.f64 (/.f64 t l) 2)))) < 0.0Initial program 48.0%
Taylor expanded in t around inf 68.6%
*-commutative68.6%
unpow268.6%
unpow268.6%
times-frac73.2%
unpow273.2%
associate-/l*73.2%
associate-/r/73.1%
Simplified73.1%
add-sqr-sqrt69.9%
sqrt-unprod50.3%
pow250.3%
Applied egg-rr50.3%
unpow250.3%
rem-sqrt-square99.6%
associate-/r/99.7%
Simplified99.7%
if 0.0 < (/.f64 (-.f64 1 (pow.f64 (/.f64 Om Omc) 2)) (+.f64 1 (*.f64 2 (pow.f64 (/.f64 t l) 2)))) Initial program 99.2%
unpow299.2%
clear-num99.2%
un-div-inv99.2%
Applied egg-rr99.2%
Final simplification99.3%
(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 85.8%
sqrt-div85.8%
add-sqr-sqrt85.8%
hypot-1-def85.8%
*-commutative85.8%
sqrt-prod85.7%
unpow285.7%
sqrt-prod55.8%
add-sqr-sqrt98.8%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0))))
(if (<= l -8.2e-97)
(asin (fma -0.5 (pow (/ Om Omc) 2.0) 1.0))
(if (<= l -1e-310)
(asin (/ (- l) t_1))
(if (<= l 1.16e+41) (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 <= -8.2e-97) {
tmp = asin(fma(-0.5, pow((Om / Omc), 2.0), 1.0));
} else if (l <= -1e-310) {
tmp = asin((-l / t_1));
} else if (l <= 1.16e+41) {
tmp = asin((l / t_1));
} else {
tmp = asin(1.0);
}
return tmp;
}
function code(t, l, Om, Omc) t_1 = Float64(t * sqrt(2.0)) tmp = 0.0 if (l <= -8.2e-97) tmp = asin(fma(-0.5, (Float64(Om / Omc) ^ 2.0), 1.0)); elseif (l <= -1e-310) tmp = asin(Float64(Float64(-l) / t_1)); elseif (l <= 1.16e+41) tmp = asin(Float64(l / t_1)); else tmp = asin(1.0); end return tmp end
code[t_, l_, Om_, Omc_] := Block[{t$95$1 = N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -8.2e-97], N[ArcSin[N[(-0.5 * N[Power[N[(Om / Omc), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -1e-310], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 1.16e+41], 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 -8.2 \cdot 10^{-97}:\\
\;\;\;\;\sin^{-1} \left(\mathsf{fma}\left(-0.5, {\left(\frac{Om}{Omc}\right)}^{2}, 1\right)\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\ell \leq 1.16 \cdot 10^{+41}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -8.19999999999999986e-97Initial program 92.3%
Taylor expanded in t around 0 66.3%
unpow266.3%
unpow266.3%
times-frac73.9%
unpow273.9%
Simplified73.9%
Taylor expanded in Om around 0 66.4%
+-commutative66.4%
fma-def66.4%
unpow266.4%
unpow266.4%
times-frac73.9%
unpow273.9%
Simplified73.9%
if -8.19999999999999986e-97 < l < -9.999999999999969e-311Initial program 82.9%
sqrt-div82.9%
add-sqr-sqrt82.9%
hypot-1-def82.9%
*-commutative82.9%
sqrt-prod82.8%
unpow282.8%
sqrt-prod45.7%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
Taylor expanded in Om around 0 95.9%
Taylor expanded in t around -inf 68.5%
associate-*r/68.5%
neg-mul-168.5%
Simplified68.5%
if -9.999999999999969e-311 < l < 1.16000000000000007e41Initial program 70.0%
sqrt-div70.0%
add-sqr-sqrt70.0%
hypot-1-def70.0%
*-commutative70.0%
sqrt-prod70.0%
unpow270.0%
sqrt-prod48.6%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
Taylor expanded in Om around 0 96.1%
Taylor expanded in t around inf 46.1%
if 1.16000000000000007e41 < l Initial program 99.6%
Taylor expanded in t around 0 74.0%
unpow274.0%
unpow274.0%
times-frac85.4%
unpow285.4%
Simplified85.4%
Taylor expanded in Om around 0 85.4%
Final simplification67.2%
(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 85.8%
sqrt-div85.8%
add-sqr-sqrt85.8%
hypot-1-def85.8%
*-commutative85.8%
sqrt-prod85.7%
unpow285.7%
sqrt-prod55.8%
add-sqr-sqrt98.8%
Applied egg-rr98.8%
Taylor expanded in Om around 0 97.6%
Taylor expanded in t around 0 97.6%
associate-*r/97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0))))
(if (<= l -2.05e-95)
(asin 1.0)
(if (<= l -1e-310)
(asin (/ (- l) t_1))
(if (<= l 2.45e+39) (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 <= -2.05e-95) {
tmp = asin(1.0);
} else if (l <= -1e-310) {
tmp = asin((-l / t_1));
} else if (l <= 2.45e+39) {
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 <= (-2.05d-95)) then
tmp = asin(1.0d0)
else if (l <= (-1d-310)) then
tmp = asin((-l / t_1))
else if (l <= 2.45d+39) 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 <= -2.05e-95) {
tmp = Math.asin(1.0);
} else if (l <= -1e-310) {
tmp = Math.asin((-l / t_1));
} else if (l <= 2.45e+39) {
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 <= -2.05e-95: tmp = math.asin(1.0) elif l <= -1e-310: tmp = math.asin((-l / t_1)) elif l <= 2.45e+39: 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 <= -2.05e-95) tmp = asin(1.0); elseif (l <= -1e-310) tmp = asin(Float64(Float64(-l) / t_1)); elseif (l <= 2.45e+39) 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 <= -2.05e-95) tmp = asin(1.0); elseif (l <= -1e-310) tmp = asin((-l / t_1)); elseif (l <= 2.45e+39) 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, -2.05e-95], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, -1e-310], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 2.45e+39], 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 -2.05 \cdot 10^{-95}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\ell \leq 2.45 \cdot 10^{+39}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -2.0499999999999999e-95 or 2.44999999999999994e39 < l Initial program 94.9%
Taylor expanded in t around 0 69.0%
unpow269.0%
unpow269.0%
times-frac78.0%
unpow278.0%
Simplified78.0%
Taylor expanded in Om around 0 77.7%
if -2.0499999999999999e-95 < l < -9.999999999999969e-311Initial program 82.9%
sqrt-div82.9%
add-sqr-sqrt82.9%
hypot-1-def82.9%
*-commutative82.9%
sqrt-prod82.8%
unpow282.8%
sqrt-prod45.7%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
Taylor expanded in Om around 0 95.9%
Taylor expanded in t around -inf 68.5%
associate-*r/68.5%
neg-mul-168.5%
Simplified68.5%
if -9.999999999999969e-311 < l < 2.44999999999999994e39Initial program 70.0%
sqrt-div70.0%
add-sqr-sqrt70.0%
hypot-1-def70.0%
*-commutative70.0%
sqrt-prod70.0%
unpow270.0%
sqrt-prod48.6%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
Taylor expanded in Om around 0 96.1%
Taylor expanded in t around inf 46.1%
Final simplification67.0%
(FPCore (t l Om Omc)
:precision binary64
(let* ((t_1 (* t (sqrt 2.0))))
(if (<= l -1.04e-92)
(asin (sqrt (- 1.0 (/ (/ Om Omc) (/ Omc Om)))))
(if (<= l -1e-310)
(asin (/ (- l) t_1))
(if (<= l 9.8e+41) (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.04e-92) {
tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else if (l <= -1e-310) {
tmp = asin((-l / t_1));
} else if (l <= 9.8e+41) {
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.04d-92)) then
tmp = asin(sqrt((1.0d0 - ((om / omc) / (omc / om)))))
else if (l <= (-1d-310)) then
tmp = asin((-l / t_1))
else if (l <= 9.8d+41) 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.04e-92) {
tmp = Math.asin(Math.sqrt((1.0 - ((Om / Omc) / (Omc / Om)))));
} else if (l <= -1e-310) {
tmp = Math.asin((-l / t_1));
} else if (l <= 9.8e+41) {
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.04e-92: tmp = math.asin(math.sqrt((1.0 - ((Om / Omc) / (Omc / Om))))) elif l <= -1e-310: tmp = math.asin((-l / t_1)) elif l <= 9.8e+41: 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.04e-92) tmp = asin(sqrt(Float64(1.0 - Float64(Float64(Om / Omc) / Float64(Omc / Om))))); elseif (l <= -1e-310) tmp = asin(Float64(Float64(-l) / t_1)); elseif (l <= 9.8e+41) 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.04e-92) tmp = asin(sqrt((1.0 - ((Om / Omc) / (Omc / Om))))); elseif (l <= -1e-310) tmp = asin((-l / t_1)); elseif (l <= 9.8e+41) 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.04e-92], N[ArcSin[N[Sqrt[N[(1.0 - N[(N[(Om / Omc), $MachinePrecision] / N[(Omc / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -1e-310], N[ArcSin[N[((-l) / t$95$1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 9.8e+41], 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.04 \cdot 10^{-92}:\\
\;\;\;\;\sin^{-1} \left(\sqrt{1 - \frac{\frac{Om}{Omc}}{\frac{Omc}{Om}}}\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sin^{-1} \left(\frac{-\ell}{t_1}\right)\\
\mathbf{elif}\;\ell \leq 9.8 \cdot 10^{+41}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -1.0399999999999999e-92Initial program 92.3%
Taylor expanded in t around 0 66.3%
unpow266.3%
unpow266.3%
times-frac73.9%
unpow273.9%
Simplified73.9%
unpow292.3%
clear-num92.3%
un-div-inv92.3%
Applied egg-rr73.9%
if -1.0399999999999999e-92 < l < -9.999999999999969e-311Initial program 82.9%
sqrt-div82.9%
add-sqr-sqrt82.9%
hypot-1-def82.9%
*-commutative82.9%
sqrt-prod82.8%
unpow282.8%
sqrt-prod45.7%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
Taylor expanded in Om around 0 95.9%
Taylor expanded in t around -inf 68.5%
associate-*r/68.5%
neg-mul-168.5%
Simplified68.5%
if -9.999999999999969e-311 < l < 9.7999999999999998e41Initial program 70.0%
sqrt-div70.0%
add-sqr-sqrt70.0%
hypot-1-def70.0%
*-commutative70.0%
sqrt-prod70.0%
unpow270.0%
sqrt-prod48.6%
add-sqr-sqrt97.9%
Applied egg-rr97.9%
Taylor expanded in Om around 0 96.1%
Taylor expanded in t around inf 46.1%
if 9.7999999999999998e41 < l Initial program 99.6%
Taylor expanded in t around 0 74.0%
unpow274.0%
unpow274.0%
times-frac85.4%
unpow285.4%
Simplified85.4%
Taylor expanded in Om around 0 85.4%
Final simplification67.2%
(FPCore (t l Om Omc) :precision binary64 (if (<= l -4.2e-98) (asin 1.0) (if (<= l 2.6e+39) (asin (/ l (* t (sqrt 2.0)))) (asin 1.0))))
double code(double t, double l, double Om, double Omc) {
double tmp;
if (l <= -4.2e-98) {
tmp = asin(1.0);
} else if (l <= 2.6e+39) {
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 <= (-4.2d-98)) then
tmp = asin(1.0d0)
else if (l <= 2.6d+39) 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 <= -4.2e-98) {
tmp = Math.asin(1.0);
} else if (l <= 2.6e+39) {
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 <= -4.2e-98: tmp = math.asin(1.0) elif l <= 2.6e+39: 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 <= -4.2e-98) tmp = asin(1.0); elseif (l <= 2.6e+39) 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 <= -4.2e-98) tmp = asin(1.0); elseif (l <= 2.6e+39) 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, -4.2e-98], N[ArcSin[1.0], $MachinePrecision], If[LessEqual[l, 2.6e+39], 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 -4.2 \cdot 10^{-98}:\\
\;\;\;\;\sin^{-1} 1\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+39}:\\
\;\;\;\;\sin^{-1} \left(\frac{\ell}{t \cdot \sqrt{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin^{-1} 1\\
\end{array}
\end{array}
if l < -4.19999999999999984e-98 or 2.6e39 < l Initial program 94.9%
Taylor expanded in t around 0 69.0%
unpow269.0%
unpow269.0%
times-frac78.0%
unpow278.0%
Simplified78.0%
Taylor expanded in Om around 0 77.7%
if -4.19999999999999984e-98 < l < 2.6e39Initial program 74.1%
sqrt-div74.2%
add-sqr-sqrt74.2%
hypot-1-def74.2%
*-commutative74.2%
sqrt-prod74.1%
unpow274.1%
sqrt-prod47.7%
add-sqr-sqrt98.1%
Applied egg-rr98.1%
Taylor expanded in Om around 0 96.0%
Taylor expanded in t around inf 50.9%
Final simplification66.0%
(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.8%
Taylor expanded in t around 0 47.5%
unpow247.5%
unpow247.5%
times-frac53.5%
unpow253.5%
Simplified53.5%
Taylor expanded in Om around 0 52.8%
Final simplification52.8%
herbie shell --seed 2023299
(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)))))))