| Alternative 1 | |
|---|---|
| Error | 28.5 |
| Cost | 34008 |
(FPCore (n U t l Om U*) :precision binary64 (sqrt (* (* (* 2.0 n) U) (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))
(FPCore (n U t l Om U*)
:precision binary64
(let* ((t_1 (/ n (/ Om (* U l))))
(t_2 (* n (* U 2.0)))
(t_3 (sqrt (* n 2.0))))
(if (<= n -8e-145)
(sqrt
(fma
t_2
t
(* (fma l -2.0 (* n (* (/ l Om) (- U* U)))) (* t_2 (/ l Om)))))
(if (<= n 1.55e-291)
(sqrt (fma 2.0 (* t (* n U)) (/ -4.0 (/ Om (* U (* l (* n l)))))))
(if (<= n 2.7e-256)
(*
t_3
(sqrt (+ (* U t) (* (* l l) (* (/ U Om) (+ -2.0 (* n (/ U* Om))))))))
(if (<= n 1.2e-195)
(sqrt (* 2.0 (* U (* n (fma -2.0 (/ l (/ Om l)) t)))))
(if (<= n 1.5e-85)
(sqrt
(+
(* 2.0 (* n (* U t)))
(*
-2.0
(/
(* (* n (* U l)) (- (* 2.0 l) (/ (* n (* l (- U* U))) Om)))
Om))))
(if (<= n 3.1e-27)
(*
t_3
(*
(sqrt (fma (/ l Om) (fma l -2.0 (/ l (/ Om (* n U*)))) t))
(sqrt U)))
(if (<= n 1.4e+133)
(*
t_3
(sqrt
(*
U
(-
t
(fma
2.0
(* l (/ l Om))
(* n (* (pow (/ l Om) 2.0) (- U U*))))))))
(if (<= n 2.7e+160)
(sqrt (* 2.0 (* t_1 (- (* l -2.0) t_1))))
(*
t_3
(sqrt
(*
U
(+
t
(*
(/ l Om)
(fma
l
-2.0
(*
(/ (* l U*) (pow (cbrt Om) 2.0))
(/ n (cbrt Om)))))))))))))))))))double code(double n, double U, double t, double l, double Om, double U_42_) {
return sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))));
}
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = n / (Om / (U * l));
double t_2 = n * (U * 2.0);
double t_3 = sqrt((n * 2.0));
double tmp;
if (n <= -8e-145) {
tmp = sqrt(fma(t_2, t, (fma(l, -2.0, (n * ((l / Om) * (U_42_ - U)))) * (t_2 * (l / Om)))));
} else if (n <= 1.55e-291) {
tmp = sqrt(fma(2.0, (t * (n * U)), (-4.0 / (Om / (U * (l * (n * l)))))));
} else if (n <= 2.7e-256) {
tmp = t_3 * sqrt(((U * t) + ((l * l) * ((U / Om) * (-2.0 + (n * (U_42_ / Om)))))));
} else if (n <= 1.2e-195) {
tmp = sqrt((2.0 * (U * (n * fma(-2.0, (l / (Om / l)), t)))));
} else if (n <= 1.5e-85) {
tmp = sqrt(((2.0 * (n * (U * t))) + (-2.0 * (((n * (U * l)) * ((2.0 * l) - ((n * (l * (U_42_ - U))) / Om))) / Om))));
} else if (n <= 3.1e-27) {
tmp = t_3 * (sqrt(fma((l / Om), fma(l, -2.0, (l / (Om / (n * U_42_)))), t)) * sqrt(U));
} else if (n <= 1.4e+133) {
tmp = t_3 * sqrt((U * (t - fma(2.0, (l * (l / Om)), (n * (pow((l / Om), 2.0) * (U - U_42_)))))));
} else if (n <= 2.7e+160) {
tmp = sqrt((2.0 * (t_1 * ((l * -2.0) - t_1))));
} else {
tmp = t_3 * sqrt((U * (t + ((l / Om) * fma(l, -2.0, (((l * U_42_) / pow(cbrt(Om), 2.0)) * (n / cbrt(Om))))))));
}
return tmp;
}
function code(n, U, t, l, Om, U_42_) return sqrt(Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * (Float64(l / Om) ^ 2.0)) * Float64(U - U_42_))))) end
function code(n, U, t, l, Om, U_42_) t_1 = Float64(n / Float64(Om / Float64(U * l))) t_2 = Float64(n * Float64(U * 2.0)) t_3 = sqrt(Float64(n * 2.0)) tmp = 0.0 if (n <= -8e-145) tmp = sqrt(fma(t_2, t, Float64(fma(l, -2.0, Float64(n * Float64(Float64(l / Om) * Float64(U_42_ - U)))) * Float64(t_2 * Float64(l / Om))))); elseif (n <= 1.55e-291) tmp = sqrt(fma(2.0, Float64(t * Float64(n * U)), Float64(-4.0 / Float64(Om / Float64(U * Float64(l * Float64(n * l))))))); elseif (n <= 2.7e-256) tmp = Float64(t_3 * sqrt(Float64(Float64(U * t) + Float64(Float64(l * l) * Float64(Float64(U / Om) * Float64(-2.0 + Float64(n * Float64(U_42_ / Om)))))))); elseif (n <= 1.2e-195) tmp = sqrt(Float64(2.0 * Float64(U * Float64(n * fma(-2.0, Float64(l / Float64(Om / l)), t))))); elseif (n <= 1.5e-85) tmp = sqrt(Float64(Float64(2.0 * Float64(n * Float64(U * t))) + Float64(-2.0 * Float64(Float64(Float64(n * Float64(U * l)) * Float64(Float64(2.0 * l) - Float64(Float64(n * Float64(l * Float64(U_42_ - U))) / Om))) / Om)))); elseif (n <= 3.1e-27) tmp = Float64(t_3 * Float64(sqrt(fma(Float64(l / Om), fma(l, -2.0, Float64(l / Float64(Om / Float64(n * U_42_)))), t)) * sqrt(U))); elseif (n <= 1.4e+133) tmp = Float64(t_3 * sqrt(Float64(U * Float64(t - fma(2.0, Float64(l * Float64(l / Om)), Float64(n * Float64((Float64(l / Om) ^ 2.0) * Float64(U - U_42_)))))))); elseif (n <= 2.7e+160) tmp = sqrt(Float64(2.0 * Float64(t_1 * Float64(Float64(l * -2.0) - t_1)))); else tmp = Float64(t_3 * sqrt(Float64(U * Float64(t + Float64(Float64(l / Om) * fma(l, -2.0, Float64(Float64(Float64(l * U_42_) / (cbrt(Om) ^ 2.0)) * Float64(n / cbrt(Om))))))))); end return tmp end
code[n_, U_, t_, l_, Om_, U$42$_] := N[Sqrt[N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[(n / N[(Om / N[(U * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(n * N[(U * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(n * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -8e-145], N[Sqrt[N[(t$95$2 * t + N[(N[(l * -2.0 + N[(n * N[(N[(l / Om), $MachinePrecision] * N[(U$42$ - U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * N[(l / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 1.55e-291], N[Sqrt[N[(2.0 * N[(t * N[(n * U), $MachinePrecision]), $MachinePrecision] + N[(-4.0 / N[(Om / N[(U * N[(l * N[(n * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 2.7e-256], N[(t$95$3 * N[Sqrt[N[(N[(U * t), $MachinePrecision] + N[(N[(l * l), $MachinePrecision] * N[(N[(U / Om), $MachinePrecision] * N[(-2.0 + N[(n * N[(U$42$ / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.2e-195], N[Sqrt[N[(2.0 * N[(U * N[(n * N[(-2.0 * N[(l / N[(Om / l), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 1.5e-85], N[Sqrt[N[(N[(2.0 * N[(n * N[(U * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(N[(N[(n * N[(U * l), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * l), $MachinePrecision] - N[(N[(n * N[(l * N[(U$42$ - U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 3.1e-27], N[(t$95$3 * N[(N[Sqrt[N[(N[(l / Om), $MachinePrecision] * N[(l * -2.0 + N[(l / N[(Om / N[(n * U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]], $MachinePrecision] * N[Sqrt[U], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.4e+133], N[(t$95$3 * N[Sqrt[N[(U * N[(t - N[(2.0 * N[(l * N[(l / Om), $MachinePrecision]), $MachinePrecision] + N[(n * N[(N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.7e+160], N[Sqrt[N[(2.0 * N[(t$95$1 * N[(N[(l * -2.0), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$3 * N[Sqrt[N[(U * N[(t + N[(N[(l / Om), $MachinePrecision] * N[(l * -2.0 + N[(N[(N[(l * U$42$), $MachinePrecision] / N[Power[N[Power[Om, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(n / N[Power[Om, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\begin{array}{l}
t_1 := \frac{n}{\frac{Om}{U \cdot \ell}}\\
t_2 := n \cdot \left(U \cdot 2\right)\\
t_3 := \sqrt{n \cdot 2}\\
\mathbf{if}\;n \leq -8 \cdot 10^{-145}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(t_2, t, \mathsf{fma}\left(\ell, -2, n \cdot \left(\frac{\ell}{Om} \cdot \left(U* - U\right)\right)\right) \cdot \left(t_2 \cdot \frac{\ell}{Om}\right)\right)}\\
\mathbf{elif}\;n \leq 1.55 \cdot 10^{-291}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(2, t \cdot \left(n \cdot U\right), \frac{-4}{\frac{Om}{U \cdot \left(\ell \cdot \left(n \cdot \ell\right)\right)}}\right)}\\
\mathbf{elif}\;n \leq 2.7 \cdot 10^{-256}:\\
\;\;\;\;t_3 \cdot \sqrt{U \cdot t + \left(\ell \cdot \ell\right) \cdot \left(\frac{U}{Om} \cdot \left(-2 + n \cdot \frac{U*}{Om}\right)\right)}\\
\mathbf{elif}\;n \leq 1.2 \cdot 10^{-195}:\\
\;\;\;\;\sqrt{2 \cdot \left(U \cdot \left(n \cdot \mathsf{fma}\left(-2, \frac{\ell}{\frac{Om}{\ell}}, t\right)\right)\right)}\\
\mathbf{elif}\;n \leq 1.5 \cdot 10^{-85}:\\
\;\;\;\;\sqrt{2 \cdot \left(n \cdot \left(U \cdot t\right)\right) + -2 \cdot \frac{\left(n \cdot \left(U \cdot \ell\right)\right) \cdot \left(2 \cdot \ell - \frac{n \cdot \left(\ell \cdot \left(U* - U\right)\right)}{Om}\right)}{Om}}\\
\mathbf{elif}\;n \leq 3.1 \cdot 10^{-27}:\\
\;\;\;\;t_3 \cdot \left(\sqrt{\mathsf{fma}\left(\frac{\ell}{Om}, \mathsf{fma}\left(\ell, -2, \frac{\ell}{\frac{Om}{n \cdot U*}}\right), t\right)} \cdot \sqrt{U}\right)\\
\mathbf{elif}\;n \leq 1.4 \cdot 10^{+133}:\\
\;\;\;\;t_3 \cdot \sqrt{U \cdot \left(t - \mathsf{fma}\left(2, \ell \cdot \frac{\ell}{Om}, n \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(U - U*\right)\right)\right)\right)}\\
\mathbf{elif}\;n \leq 2.7 \cdot 10^{+160}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_1 \cdot \left(\ell \cdot -2 - t_1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \sqrt{U \cdot \left(t + \frac{\ell}{Om} \cdot \mathsf{fma}\left(\ell, -2, \frac{\ell \cdot U*}{{\left(\sqrt[3]{Om}\right)}^{2}} \cdot \frac{n}{\sqrt[3]{Om}}\right)\right)}\\
\end{array}
if n < -7.99999999999999932e-145Initial program 32.9
Simplified30.6
Applied egg-rr27.0
if -7.99999999999999932e-145 < n < 1.55000000000000006e-291Initial program 38.8
Simplified39.0
Taylor expanded in U* around 0 38.0
Simplified38.8
Taylor expanded in Om around inf 38.3
Simplified31.0
if 1.55000000000000006e-291 < n < 2.7000000000000002e-256Initial program 38.6
Simplified39.7
Taylor expanded in U around 0 37.0
Applied egg-rr21.3
Taylor expanded in l around -inf 25.5
Simplified26.7
if 2.7000000000000002e-256 < n < 1.2e-195Initial program 39.3
Simplified39.3
Taylor expanded in U around 0 40.2
Taylor expanded in n around 0 40.4
Simplified34.5
if 1.2e-195 < n < 1.50000000000000011e-85Initial program 34.5
Simplified33.8
Taylor expanded in t around inf 29.5
if 1.50000000000000011e-85 < n < 3.0999999999999998e-27Initial program 33.2
Simplified30.6
Taylor expanded in U around 0 32.2
Applied egg-rr26.6
Applied egg-rr42.0
if 3.0999999999999998e-27 < n < 1.40000000000000008e133Initial program 29.9
Applied egg-rr24.2
if 1.40000000000000008e133 < n < 2.7e160Initial program 32.2
Simplified28.0
Taylor expanded in t around 0 56.9
Taylor expanded in U* around 0 61.8
Simplified60.8
if 2.7e160 < n Initial program 38.9
Simplified35.5
Taylor expanded in U around 0 42.3
Applied egg-rr37.0
Applied egg-rr23.5
Final simplification29.4
| Alternative 1 | |
|---|---|
| Error | 28.5 |
| Cost | 34008 |
| Alternative 2 | |
|---|---|
| Error | 28.5 |
| Cost | 28060 |
| Alternative 3 | |
|---|---|
| Error | 29.1 |
| Cost | 27604 |
| Alternative 4 | |
|---|---|
| Error | 29.2 |
| Cost | 27476 |
| Alternative 5 | |
|---|---|
| Error | 29.3 |
| Cost | 21468 |
| Alternative 6 | |
|---|---|
| Error | 29.3 |
| Cost | 21468 |
| Alternative 7 | |
|---|---|
| Error | 31.8 |
| Cost | 21088 |
| Alternative 8 | |
|---|---|
| Error | 32.9 |
| Cost | 15580 |
| Alternative 9 | |
|---|---|
| Error | 29.7 |
| Cost | 15188 |
| Alternative 10 | |
|---|---|
| Error | 30.1 |
| Cost | 14800 |
| Alternative 11 | |
|---|---|
| Error | 32.0 |
| Cost | 14556 |
| Alternative 12 | |
|---|---|
| Error | 32.0 |
| Cost | 14556 |
| Alternative 13 | |
|---|---|
| Error | 32.1 |
| Cost | 14556 |
| Alternative 14 | |
|---|---|
| Error | 30.2 |
| Cost | 14276 |
| Alternative 15 | |
|---|---|
| Error | 31.9 |
| Cost | 14160 |
| Alternative 16 | |
|---|---|
| Error | 31.9 |
| Cost | 14160 |
| Alternative 17 | |
|---|---|
| Error | 32.0 |
| Cost | 14040 |
| Alternative 18 | |
|---|---|
| Error | 32.2 |
| Cost | 9176 |
| Alternative 19 | |
|---|---|
| Error | 36.6 |
| Cost | 8928 |
| Alternative 20 | |
|---|---|
| Error | 36.3 |
| Cost | 8672 |
| Alternative 21 | |
|---|---|
| Error | 34.5 |
| Cost | 8668 |
| Alternative 22 | |
|---|---|
| Error | 33.9 |
| Cost | 8396 |
| Alternative 23 | |
|---|---|
| Error | 34.5 |
| Cost | 8276 |
| Alternative 24 | |
|---|---|
| Error | 31.9 |
| Cost | 8272 |
| Alternative 25 | |
|---|---|
| Error | 34.8 |
| Cost | 8272 |
| Alternative 26 | |
|---|---|
| Error | 36.0 |
| Cost | 7888 |
| Alternative 27 | |
|---|---|
| Error | 38.6 |
| Cost | 7496 |
| Alternative 28 | |
|---|---|
| Error | 35.4 |
| Cost | 7492 |
| Alternative 29 | |
|---|---|
| Error | 40.8 |
| Cost | 6980 |
| Alternative 30 | |
|---|---|
| Error | 40.7 |
| Cost | 6848 |

herbie shell --seed 2022298
(FPCore (n U t l Om U*)
:name "Toniolo and Linder, Equation (13)"
:precision binary64
(sqrt (* (* (* 2.0 n) U) (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))