| Alternative 1 | |
|---|---|
| Error | 6.6 |
| Cost | 21004 |
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (sin k) 2.0)) (t_2 (* (cos k) (pow (sin k) -2.0))))
(if (<= l -1e+204)
(*
l
(*
2.0
(/ (* (/ l k) (/ (cos k) (* t (+ 0.5 (* (cos (+ k k)) -0.5))))) k)))
(if (<= l -1e-70)
(/ (* (* l 2.0) (/ l k)) (* (* t t_1) (/ k (cos k))))
(if (<= l -6.2120009789235366e-164)
(/ (* (* l 2.0) t_2) (* k (* k (/ t l))))
(if (<= l -1.2702272780502075e-242)
(* l (* 2.0 (/ (* (/ l k) (/ (cos k) (* k (* t k)))) k)))
(if (<= l -1.1647704497195727e-268)
(* (/ (* l (/ 2.0 t)) (* k k)) (/ l (* k k)))
(if (<= l 3.135246037673392e-306)
(/ (* (* l 2.0) (* (/ (/ l k) t_1) (/ (cos k) t))) k)
(if (<= l 1.3180425805095456e-230)
(* 2.0 (/ (pow (/ (sqrt l) k) 4.0) t))
(* l (* 2.0 (/ t_2 (/ k (/ (/ l k) t))))))))))))))double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
double code(double t, double l, double k) {
double t_1 = pow(sin(k), 2.0);
double t_2 = cos(k) * pow(sin(k), -2.0);
double tmp;
if (l <= -1e+204) {
tmp = l * (2.0 * (((l / k) * (cos(k) / (t * (0.5 + (cos((k + k)) * -0.5))))) / k));
} else if (l <= -1e-70) {
tmp = ((l * 2.0) * (l / k)) / ((t * t_1) * (k / cos(k)));
} else if (l <= -6.2120009789235366e-164) {
tmp = ((l * 2.0) * t_2) / (k * (k * (t / l)));
} else if (l <= -1.2702272780502075e-242) {
tmp = l * (2.0 * (((l / k) * (cos(k) / (k * (t * k)))) / k));
} else if (l <= -1.1647704497195727e-268) {
tmp = ((l * (2.0 / t)) / (k * k)) * (l / (k * k));
} else if (l <= 3.135246037673392e-306) {
tmp = ((l * 2.0) * (((l / k) / t_1) * (cos(k) / t))) / k;
} else if (l <= 1.3180425805095456e-230) {
tmp = 2.0 * (pow((sqrt(l) / k), 4.0) / t);
} else {
tmp = l * (2.0 * (t_2 / (k / ((l / k) / t))));
}
return tmp;
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sin(k) ** 2.0d0
t_2 = cos(k) * (sin(k) ** (-2.0d0))
if (l <= (-1d+204)) then
tmp = l * (2.0d0 * (((l / k) * (cos(k) / (t * (0.5d0 + (cos((k + k)) * (-0.5d0)))))) / k))
else if (l <= (-1d-70)) then
tmp = ((l * 2.0d0) * (l / k)) / ((t * t_1) * (k / cos(k)))
else if (l <= (-6.2120009789235366d-164)) then
tmp = ((l * 2.0d0) * t_2) / (k * (k * (t / l)))
else if (l <= (-1.2702272780502075d-242)) then
tmp = l * (2.0d0 * (((l / k) * (cos(k) / (k * (t * k)))) / k))
else if (l <= (-1.1647704497195727d-268)) then
tmp = ((l * (2.0d0 / t)) / (k * k)) * (l / (k * k))
else if (l <= 3.135246037673392d-306) then
tmp = ((l * 2.0d0) * (((l / k) / t_1) * (cos(k) / t))) / k
else if (l <= 1.3180425805095456d-230) then
tmp = 2.0d0 * (((sqrt(l) / k) ** 4.0d0) / t)
else
tmp = l * (2.0d0 * (t_2 / (k / ((l / k) / t))))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
public static double code(double t, double l, double k) {
double t_1 = Math.pow(Math.sin(k), 2.0);
double t_2 = Math.cos(k) * Math.pow(Math.sin(k), -2.0);
double tmp;
if (l <= -1e+204) {
tmp = l * (2.0 * (((l / k) * (Math.cos(k) / (t * (0.5 + (Math.cos((k + k)) * -0.5))))) / k));
} else if (l <= -1e-70) {
tmp = ((l * 2.0) * (l / k)) / ((t * t_1) * (k / Math.cos(k)));
} else if (l <= -6.2120009789235366e-164) {
tmp = ((l * 2.0) * t_2) / (k * (k * (t / l)));
} else if (l <= -1.2702272780502075e-242) {
tmp = l * (2.0 * (((l / k) * (Math.cos(k) / (k * (t * k)))) / k));
} else if (l <= -1.1647704497195727e-268) {
tmp = ((l * (2.0 / t)) / (k * k)) * (l / (k * k));
} else if (l <= 3.135246037673392e-306) {
tmp = ((l * 2.0) * (((l / k) / t_1) * (Math.cos(k) / t))) / k;
} else if (l <= 1.3180425805095456e-230) {
tmp = 2.0 * (Math.pow((Math.sqrt(l) / k), 4.0) / t);
} else {
tmp = l * (2.0 * (t_2 / (k / ((l / k) / t))));
}
return tmp;
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
def code(t, l, k): t_1 = math.pow(math.sin(k), 2.0) t_2 = math.cos(k) * math.pow(math.sin(k), -2.0) tmp = 0 if l <= -1e+204: tmp = l * (2.0 * (((l / k) * (math.cos(k) / (t * (0.5 + (math.cos((k + k)) * -0.5))))) / k)) elif l <= -1e-70: tmp = ((l * 2.0) * (l / k)) / ((t * t_1) * (k / math.cos(k))) elif l <= -6.2120009789235366e-164: tmp = ((l * 2.0) * t_2) / (k * (k * (t / l))) elif l <= -1.2702272780502075e-242: tmp = l * (2.0 * (((l / k) * (math.cos(k) / (k * (t * k)))) / k)) elif l <= -1.1647704497195727e-268: tmp = ((l * (2.0 / t)) / (k * k)) * (l / (k * k)) elif l <= 3.135246037673392e-306: tmp = ((l * 2.0) * (((l / k) / t_1) * (math.cos(k) / t))) / k elif l <= 1.3180425805095456e-230: tmp = 2.0 * (math.pow((math.sqrt(l) / k), 4.0) / t) else: tmp = l * (2.0 * (t_2 / (k / ((l / k) / t)))) return tmp
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0))) end
function code(t, l, k) t_1 = sin(k) ^ 2.0 t_2 = Float64(cos(k) * (sin(k) ^ -2.0)) tmp = 0.0 if (l <= -1e+204) tmp = Float64(l * Float64(2.0 * Float64(Float64(Float64(l / k) * Float64(cos(k) / Float64(t * Float64(0.5 + Float64(cos(Float64(k + k)) * -0.5))))) / k))); elseif (l <= -1e-70) tmp = Float64(Float64(Float64(l * 2.0) * Float64(l / k)) / Float64(Float64(t * t_1) * Float64(k / cos(k)))); elseif (l <= -6.2120009789235366e-164) tmp = Float64(Float64(Float64(l * 2.0) * t_2) / Float64(k * Float64(k * Float64(t / l)))); elseif (l <= -1.2702272780502075e-242) tmp = Float64(l * Float64(2.0 * Float64(Float64(Float64(l / k) * Float64(cos(k) / Float64(k * Float64(t * k)))) / k))); elseif (l <= -1.1647704497195727e-268) tmp = Float64(Float64(Float64(l * Float64(2.0 / t)) / Float64(k * k)) * Float64(l / Float64(k * k))); elseif (l <= 3.135246037673392e-306) tmp = Float64(Float64(Float64(l * 2.0) * Float64(Float64(Float64(l / k) / t_1) * Float64(cos(k) / t))) / k); elseif (l <= 1.3180425805095456e-230) tmp = Float64(2.0 * Float64((Float64(sqrt(l) / k) ^ 4.0) / t)); else tmp = Float64(l * Float64(2.0 * Float64(t_2 / Float64(k / Float64(Float64(l / k) / t))))); end return tmp end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0)); end
function tmp_2 = code(t, l, k) t_1 = sin(k) ^ 2.0; t_2 = cos(k) * (sin(k) ^ -2.0); tmp = 0.0; if (l <= -1e+204) tmp = l * (2.0 * (((l / k) * (cos(k) / (t * (0.5 + (cos((k + k)) * -0.5))))) / k)); elseif (l <= -1e-70) tmp = ((l * 2.0) * (l / k)) / ((t * t_1) * (k / cos(k))); elseif (l <= -6.2120009789235366e-164) tmp = ((l * 2.0) * t_2) / (k * (k * (t / l))); elseif (l <= -1.2702272780502075e-242) tmp = l * (2.0 * (((l / k) * (cos(k) / (k * (t * k)))) / k)); elseif (l <= -1.1647704497195727e-268) tmp = ((l * (2.0 / t)) / (k * k)) * (l / (k * k)); elseif (l <= 3.135246037673392e-306) tmp = ((l * 2.0) * (((l / k) / t_1) * (cos(k) / t))) / k; elseif (l <= 1.3180425805095456e-230) tmp = 2.0 * (((sqrt(l) / k) ^ 4.0) / t); else tmp = l * (2.0 * (t_2 / (k / ((l / k) / t)))); end tmp_2 = tmp; end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[k], $MachinePrecision] * N[Power[N[Sin[k], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e+204], N[(l * N[(2.0 * N[(N[(N[(l / k), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(t * N[(0.5 + N[(N[Cos[N[(k + k), $MachinePrecision]], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-70], N[(N[(N[(l * 2.0), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] / N[(N[(t * t$95$1), $MachinePrecision] * N[(k / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -6.2120009789235366e-164], N[(N[(N[(l * 2.0), $MachinePrecision] * t$95$2), $MachinePrecision] / N[(k * N[(k * N[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.2702272780502075e-242], N[(l * N[(2.0 * N[(N[(N[(l / k), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(k * N[(t * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.1647704497195727e-268], N[(N[(N[(l * N[(2.0 / t), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.135246037673392e-306], N[(N[(N[(l * 2.0), $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] / t$95$1), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[l, 1.3180425805095456e-230], N[(2.0 * N[(N[Power[N[(N[Sqrt[l], $MachinePrecision] / k), $MachinePrecision], 4.0], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(l * N[(2.0 * N[(t$95$2 / N[(k / N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\begin{array}{l}
t_1 := {\sin k}^{2}\\
t_2 := \cos k \cdot {\sin k}^{-2}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+204}:\\
\;\;\;\;\ell \cdot \left(2 \cdot \frac{\frac{\ell}{k} \cdot \frac{\cos k}{t \cdot \left(0.5 + \cos \left(k + k\right) \cdot -0.5\right)}}{k}\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-70}:\\
\;\;\;\;\frac{\left(\ell \cdot 2\right) \cdot \frac{\ell}{k}}{\left(t \cdot t_1\right) \cdot \frac{k}{\cos k}}\\
\mathbf{elif}\;\ell \leq -6.2120009789235366 \cdot 10^{-164}:\\
\;\;\;\;\frac{\left(\ell \cdot 2\right) \cdot t_2}{k \cdot \left(k \cdot \frac{t}{\ell}\right)}\\
\mathbf{elif}\;\ell \leq -1.2702272780502075 \cdot 10^{-242}:\\
\;\;\;\;\ell \cdot \left(2 \cdot \frac{\frac{\ell}{k} \cdot \frac{\cos k}{k \cdot \left(t \cdot k\right)}}{k}\right)\\
\mathbf{elif}\;\ell \leq -1.1647704497195727 \cdot 10^{-268}:\\
\;\;\;\;\frac{\ell \cdot \frac{2}{t}}{k \cdot k} \cdot \frac{\ell}{k \cdot k}\\
\mathbf{elif}\;\ell \leq 3.135246037673392 \cdot 10^{-306}:\\
\;\;\;\;\frac{\left(\ell \cdot 2\right) \cdot \left(\frac{\frac{\ell}{k}}{t_1} \cdot \frac{\cos k}{t}\right)}{k}\\
\mathbf{elif}\;\ell \leq 1.3180425805095456 \cdot 10^{-230}:\\
\;\;\;\;2 \cdot \frac{{\left(\frac{\sqrt{\ell}}{k}\right)}^{4}}{t}\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \left(2 \cdot \frac{t_2}{\frac{k}{\frac{\frac{\ell}{k}}{t}}}\right)\\
\end{array}
Results
if l < -9.99999999999999989e203Initial program 64.0
Simplified51.6
Taylor expanded in k around inf 50.0
Simplified39.4
Applied egg-rr11.7
Applied egg-rr12.2
if -9.99999999999999989e203 < l < -9.99999999999999996e-71Initial program 48.1
Simplified37.8
Taylor expanded in k around inf 17.4
Simplified15.0
Applied egg-rr5.1
Applied egg-rr5.6
if -9.99999999999999996e-71 < l < -6.21200097892353657e-164Initial program 40.9
Simplified29.9
Taylor expanded in k around inf 7.4
Simplified6.1
Applied egg-rr5.9
Applied egg-rr4.0
Applied egg-rr4.2
if -6.21200097892353657e-164 < l < -1.27022727805020754e-242Initial program 44.9
Simplified34.3
Taylor expanded in k around inf 12.9
Simplified9.4
Applied egg-rr8.8
Taylor expanded in k around 0 11.6
Simplified10.8
if -1.27022727805020754e-242 < l < -1.1647704497195727e-268Initial program 44.3
Simplified33.2
Taylor expanded in k around 0 18.4
Simplified18.3
Applied egg-rr14.4
Applied egg-rr8.0
if -1.1647704497195727e-268 < l < 3.135246037673392e-306Initial program 46.4
Simplified35.0
Taylor expanded in k around inf 17.8
Simplified12.9
Applied egg-rr12.7
Applied egg-rr11.1
if 3.135246037673392e-306 < l < 1.3180425805095456e-230Initial program 45.4
Simplified35.0
Taylor expanded in k around 0 17.1
Simplified17.1
Taylor expanded in k around 0 17.1
Simplified3.6
if 1.3180425805095456e-230 < l Initial program 47.7
Simplified37.9
Taylor expanded in k around inf 18.6
Simplified15.3
Applied egg-rr10.4
Applied egg-rr6.7
Final simplification6.9
| Alternative 1 | |
|---|---|
| Error | 6.6 |
| Cost | 21004 |
| Alternative 2 | |
|---|---|
| Error | 6.4 |
| Cost | 21004 |
| Alternative 3 | |
|---|---|
| Error | 7.4 |
| Cost | 20488 |
| Alternative 4 | |
|---|---|
| Error | 7.0 |
| Cost | 20488 |
| Alternative 5 | |
|---|---|
| Error | 6.9 |
| Cost | 20488 |
| Alternative 6 | |
|---|---|
| Error | 6.2 |
| Cost | 20420 |
| Alternative 7 | |
|---|---|
| Error | 7.9 |
| Cost | 14276 |
| Alternative 8 | |
|---|---|
| Error | 8.0 |
| Cost | 14024 |
| Alternative 9 | |
|---|---|
| Error | 7.6 |
| Cost | 14024 |
| Alternative 10 | |
|---|---|
| Error | 24.4 |
| Cost | 7816 |
| Alternative 11 | |
|---|---|
| Error | 23.6 |
| Cost | 7744 |
| Alternative 12 | |
|---|---|
| Error | 24.3 |
| Cost | 7620 |
| Alternative 13 | |
|---|---|
| Error | 25.4 |
| Cost | 1344 |
| Alternative 14 | |
|---|---|
| Error | 28.4 |
| Cost | 960 |
| Alternative 15 | |
|---|---|
| Error | 28.4 |
| Cost | 960 |
| Alternative 16 | |
|---|---|
| Error | 26.3 |
| Cost | 960 |
| Alternative 17 | |
|---|---|
| Error | 25.9 |
| Cost | 960 |
| Alternative 18 | |
|---|---|
| Error | 37.4 |
| Cost | 704 |
| Alternative 19 | |
|---|---|
| Error | 32.5 |
| Cost | 704 |
| Alternative 20 | |
|---|---|
| Error | 46.8 |
| Cost | 448 |
| Alternative 21 | |
|---|---|
| Error | 44.3 |
| Cost | 448 |

herbie shell --seed 2022225
(FPCore (t l k)
:name "Toniolo and Linder, Equation (10-)"
:precision binary64
(/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))