(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 (* t (/ k l)))
(t_3 (* (sqrt (* (cos k) (/ l (* k t)))) (/ 1.0 (sin k)))))
(if (<= k -3e-124)
(* 2.0 (pow (* t_2 (/ (/ (/ k l) t_1) (cos k))) -1.0))
(if (<= k 7.5e-155)
(* 2.0 (* t_3 (* t_3 (/ l k))))
(* 2.0 (/ (* (pow t_2 -1.0) (* t_1 (cos k))) (/ k l)))))))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 = t * (k / l);
double t_3 = sqrt((cos(k) * (l / (k * t)))) * (1.0 / sin(k));
double tmp;
if (k <= -3e-124) {
tmp = 2.0 * pow((t_2 * (((k / l) / t_1) / cos(k))), -1.0);
} else if (k <= 7.5e-155) {
tmp = 2.0 * (t_3 * (t_3 * (l / k)));
} else {
tmp = 2.0 * ((pow(t_2, -1.0) * (t_1 * cos(k))) / (k / l));
}
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) :: t_3
real(8) :: tmp
t_1 = sin(k) ** (-2.0d0)
t_2 = t * (k / l)
t_3 = sqrt((cos(k) * (l / (k * t)))) * (1.0d0 / sin(k))
if (k <= (-3d-124)) then
tmp = 2.0d0 * ((t_2 * (((k / l) / t_1) / cos(k))) ** (-1.0d0))
else if (k <= 7.5d-155) then
tmp = 2.0d0 * (t_3 * (t_3 * (l / k)))
else
tmp = 2.0d0 * (((t_2 ** (-1.0d0)) * (t_1 * cos(k))) / (k / l))
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 = t * (k / l);
double t_3 = Math.sqrt((Math.cos(k) * (l / (k * t)))) * (1.0 / Math.sin(k));
double tmp;
if (k <= -3e-124) {
tmp = 2.0 * Math.pow((t_2 * (((k / l) / t_1) / Math.cos(k))), -1.0);
} else if (k <= 7.5e-155) {
tmp = 2.0 * (t_3 * (t_3 * (l / k)));
} else {
tmp = 2.0 * ((Math.pow(t_2, -1.0) * (t_1 * Math.cos(k))) / (k / l));
}
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 = t * (k / l) t_3 = math.sqrt((math.cos(k) * (l / (k * t)))) * (1.0 / math.sin(k)) tmp = 0 if k <= -3e-124: tmp = 2.0 * math.pow((t_2 * (((k / l) / t_1) / math.cos(k))), -1.0) elif k <= 7.5e-155: tmp = 2.0 * (t_3 * (t_3 * (l / k))) else: tmp = 2.0 * ((math.pow(t_2, -1.0) * (t_1 * math.cos(k))) / (k / l)) 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(t * Float64(k / l)) t_3 = Float64(sqrt(Float64(cos(k) * Float64(l / Float64(k * t)))) * Float64(1.0 / sin(k))) tmp = 0.0 if (k <= -3e-124) tmp = Float64(2.0 * (Float64(t_2 * Float64(Float64(Float64(k / l) / t_1) / cos(k))) ^ -1.0)); elseif (k <= 7.5e-155) tmp = Float64(2.0 * Float64(t_3 * Float64(t_3 * Float64(l / k)))); else tmp = Float64(2.0 * Float64(Float64((t_2 ^ -1.0) * Float64(t_1 * cos(k))) / Float64(k / l))); 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 = t * (k / l); t_3 = sqrt((cos(k) * (l / (k * t)))) * (1.0 / sin(k)); tmp = 0.0; if (k <= -3e-124) tmp = 2.0 * ((t_2 * (((k / l) / t_1) / cos(k))) ^ -1.0); elseif (k <= 7.5e-155) tmp = 2.0 * (t_3 * (t_3 * (l / k))); else tmp = 2.0 * (((t_2 ^ -1.0) * (t_1 * cos(k))) / (k / l)); 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[(t * N[(k / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(N[Cos[k], $MachinePrecision] * N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, -3e-124], N[(2.0 * N[Power[N[(t$95$2 * N[(N[(N[(k / l), $MachinePrecision] / t$95$1), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 7.5e-155], N[(2.0 * N[(t$95$3 * N[(t$95$3 * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[Power[t$95$2, -1.0], $MachinePrecision] * N[(t$95$1 * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k / l), $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 := t \cdot \frac{k}{\ell}\\
t_3 := \sqrt{\cos k \cdot \frac{\ell}{k \cdot t}} \cdot \frac{1}{\sin k}\\
\mathbf{if}\;k \leq -3 \cdot 10^{-124}:\\
\;\;\;\;2 \cdot {\left(t_2 \cdot \frac{\frac{\frac{k}{\ell}}{t_1}}{\cos k}\right)}^{-1}\\
\mathbf{elif}\;k \leq 7.5 \cdot 10^{-155}:\\
\;\;\;\;2 \cdot \left(t_3 \cdot \left(t_3 \cdot \frac{\ell}{k}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{{t_2}^{-1} \cdot \left(t_1 \cdot \cos k\right)}{\frac{k}{\ell}}\\
\end{array}



Bits error versus t



Bits error versus l



Bits error versus k
Results
if k < -3e-124Initial program 46.4
Simplified38.3
Taylor expanded in t around 0 20.0
Simplified5.2
Applied egg-rr0.8
Applied egg-rr1.2
if -3e-124 < k < 7.5000000000000006e-155Initial program 64.0
Simplified64.0
Taylor expanded in t around 0 61.5
Simplified51.1
Applied egg-rr50.5
Applied egg-rr34.2
if 7.5000000000000006e-155 < k Initial program 47.5
Simplified39.8
Taylor expanded in t around 0 20.9
Simplified5.6
Applied egg-rr1.2
Applied egg-rr1.3
Final simplification2.8
herbie shell --seed 2022156
(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))))