
(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))))
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));
}
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
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));
}
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))
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 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
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]
\begin{array}{l}
\\
\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)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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))))
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));
}
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
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));
}
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))
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 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
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]
\begin{array}{l}
\\
\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)}
\end{array}
(FPCore (t l k) :precision binary64 (* 2.0 (* (/ (/ l k) t) (* (* (/ l k) (cos k)) (pow (sin k) -2.0)))))
double code(double t, double l, double k) {
return 2.0 * (((l / k) / t) * (((l / k) * cos(k)) * pow(sin(k), -2.0)));
}
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 * (((l / k) / t) * (((l / k) * cos(k)) * (sin(k) ** (-2.0d0))))
end function
public static double code(double t, double l, double k) {
return 2.0 * (((l / k) / t) * (((l / k) * Math.cos(k)) * Math.pow(Math.sin(k), -2.0)));
}
def code(t, l, k): return 2.0 * (((l / k) / t) * (((l / k) * math.cos(k)) * math.pow(math.sin(k), -2.0)))
function code(t, l, k) return Float64(2.0 * Float64(Float64(Float64(l / k) / t) * Float64(Float64(Float64(l / k) * cos(k)) * (sin(k) ^ -2.0)))) end
function tmp = code(t, l, k) tmp = 2.0 * (((l / k) / t) * (((l / k) * cos(k)) * (sin(k) ^ -2.0))); end
code[t_, l_, k_] := N[(2.0 * N[(N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] * N[Cos[k], $MachinePrecision]), $MachinePrecision] * N[Power[N[Sin[k], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\frac{\frac{\ell}{k}}{t} \cdot \left(\left(\frac{\ell}{k} \cdot \cos k\right) \cdot {\sin k}^{-2}\right)\right)
\end{array}
Initial program 35.0%
associate-/r*35.1%
*-commutative35.1%
associate-/r*37.2%
associate-*r/37.5%
associate-/l*37.1%
+-commutative37.1%
unpow237.1%
sqr-neg37.1%
distribute-frac-neg37.1%
distribute-frac-neg37.1%
unpow237.1%
associate--l+45.4%
metadata-eval45.4%
+-rgt-identity45.4%
unpow245.4%
distribute-frac-neg45.4%
Simplified45.4%
Taylor expanded in k around inf 73.9%
unpow273.9%
associate-*r*73.9%
unpow273.9%
Simplified73.9%
Taylor expanded in l around 0 73.9%
unpow273.9%
unpow273.9%
associate-*r*73.9%
times-frac74.4%
associate-/l*81.6%
associate-*r/83.6%
associate-*l*88.8%
*-commutative88.8%
associate-*l/91.5%
Simplified91.5%
associate-*l/92.4%
associate-/l*93.5%
Applied egg-rr93.5%
expm1-log1p-u61.5%
expm1-udef45.2%
associate-/l*45.2%
associate-/r/43.5%
div-inv43.5%
pow-flip43.5%
metadata-eval43.5%
Applied egg-rr43.5%
expm1-def59.4%
expm1-log1p89.0%
associate-/r/88.8%
*-commutative88.8%
associate-*l/91.5%
*-commutative91.5%
associate-/r/91.5%
associate-/r/91.9%
associate-*l*92.7%
associate-/r*95.9%
associate-*r*95.9%
Simplified95.9%
Final simplification95.9%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (sin k) 2.0)))
(if (<= t 1.5e+117)
(* 2.0 (* (* (/ l k) (/ l (* k t))) (/ (cos k) t_1)))
(* 2.0 (* (* l (/ l (* k k))) (/ (cos k) (* t t_1)))))))
double code(double t, double l, double k) {
double t_1 = pow(sin(k), 2.0);
double tmp;
if (t <= 1.5e+117) {
tmp = 2.0 * (((l / k) * (l / (k * t))) * (cos(k) / t_1));
} else {
tmp = 2.0 * ((l * (l / (k * k))) * (cos(k) / (t * t_1)));
}
return tmp;
}
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) :: tmp
t_1 = sin(k) ** 2.0d0
if (t <= 1.5d+117) then
tmp = 2.0d0 * (((l / k) * (l / (k * t))) * (cos(k) / t_1))
else
tmp = 2.0d0 * ((l * (l / (k * k))) * (cos(k) / (t * t_1)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.pow(Math.sin(k), 2.0);
double tmp;
if (t <= 1.5e+117) {
tmp = 2.0 * (((l / k) * (l / (k * t))) * (Math.cos(k) / t_1));
} else {
tmp = 2.0 * ((l * (l / (k * k))) * (Math.cos(k) / (t * t_1)));
}
return tmp;
}
def code(t, l, k): t_1 = math.pow(math.sin(k), 2.0) tmp = 0 if t <= 1.5e+117: tmp = 2.0 * (((l / k) * (l / (k * t))) * (math.cos(k) / t_1)) else: tmp = 2.0 * ((l * (l / (k * k))) * (math.cos(k) / (t * t_1))) return tmp
function code(t, l, k) t_1 = sin(k) ^ 2.0 tmp = 0.0 if (t <= 1.5e+117) tmp = Float64(2.0 * Float64(Float64(Float64(l / k) * Float64(l / Float64(k * t))) * Float64(cos(k) / t_1))); else tmp = Float64(2.0 * Float64(Float64(l * Float64(l / Float64(k * k))) * Float64(cos(k) / Float64(t * t_1)))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = sin(k) ^ 2.0; tmp = 0.0; if (t <= 1.5e+117) tmp = 2.0 * (((l / k) * (l / (k * t))) * (cos(k) / t_1)); else tmp = 2.0 * ((l * (l / (k * k))) * (cos(k) / (t * t_1))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t, 1.5e+117], N[(2.0 * N[(N[(N[(l / k), $MachinePrecision] * N[(l / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(l * N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(t * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin k}^{2}\\
\mathbf{if}\;t \leq 1.5 \cdot 10^{+117}:\\
\;\;\;\;2 \cdot \left(\left(\frac{\ell}{k} \cdot \frac{\ell}{k \cdot t}\right) \cdot \frac{\cos k}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(\ell \cdot \frac{\ell}{k \cdot k}\right) \cdot \frac{\cos k}{t \cdot t_1}\right)\\
\end{array}
\end{array}
if t < 1.5e117Initial program 36.9%
associate-/r*36.9%
*-commutative36.9%
associate-/r*39.3%
associate-*r/39.8%
associate-/l*39.3%
+-commutative39.3%
unpow239.3%
sqr-neg39.3%
distribute-frac-neg39.3%
distribute-frac-neg39.3%
unpow239.3%
associate--l+46.4%
metadata-eval46.4%
+-rgt-identity46.4%
unpow246.4%
distribute-frac-neg46.4%
Simplified46.4%
Taylor expanded in k around inf 74.5%
unpow274.5%
associate-*r*74.5%
unpow274.5%
Simplified74.5%
Taylor expanded in l around 0 74.5%
unpow274.5%
unpow274.5%
associate-*r*74.5%
times-frac75.0%
associate-/l*82.8%
associate-*r/84.8%
associate-*l*90.6%
*-commutative90.6%
associate-*l/93.6%
Simplified93.6%
Taylor expanded in l around 0 75.0%
unpow275.0%
unpow275.0%
associate-*r*78.9%
*-commutative78.9%
times-frac94.2%
*-commutative94.2%
Simplified94.2%
if 1.5e117 < t Initial program 21.9%
associate-/r*21.9%
*-commutative21.9%
associate-/r*22.0%
associate-*r/22.0%
associate-/l*22.0%
+-commutative22.0%
unpow222.0%
sqr-neg22.0%
distribute-frac-neg22.0%
distribute-frac-neg22.0%
unpow222.0%
associate--l+37.9%
metadata-eval37.9%
+-rgt-identity37.9%
unpow237.9%
distribute-frac-neg37.9%
Simplified37.9%
Taylor expanded in k around inf 69.6%
unpow269.6%
associate-*r*69.6%
unpow269.6%
Simplified69.6%
Taylor expanded in l around 0 69.6%
unpow269.6%
unpow269.6%
associate-*r*69.6%
times-frac69.5%
associate-/l*73.2%
associate-*r/75.7%
associate-*l*75.8%
*-commutative75.8%
associate-*l/76.2%
Simplified76.2%
associate-*l/79.2%
associate-/l*82.1%
Applied egg-rr82.1%
Taylor expanded in l around 0 69.6%
times-frac75.5%
unpow275.5%
associate-*r/92.7%
unpow292.7%
Simplified92.7%
Final simplification94.0%
(FPCore (t l k)
:precision binary64
(if (<= k 0.0148)
(*
2.0
(/
(+
(fma
(* k k)
(-
(* l 0.041666666666666664)
(fma l 0.044444444444444446 (* l 0.05555555555555555)))
(/ l (* k k)))
(* l -0.16666666666666666))
(* k (/ t (/ l k)))))
(*
2.0
(* (/ l (* k (/ (* k t) l))) (/ (cos k) (- 0.5 (/ (cos (+ k k)) 2.0)))))))
double code(double t, double l, double k) {
double tmp;
if (k <= 0.0148) {
tmp = 2.0 * ((fma((k * k), ((l * 0.041666666666666664) - fma(l, 0.044444444444444446, (l * 0.05555555555555555))), (l / (k * k))) + (l * -0.16666666666666666)) / (k * (t / (l / k))));
} else {
tmp = 2.0 * ((l / (k * ((k * t) / l))) * (cos(k) / (0.5 - (cos((k + k)) / 2.0))));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (k <= 0.0148) tmp = Float64(2.0 * Float64(Float64(fma(Float64(k * k), Float64(Float64(l * 0.041666666666666664) - fma(l, 0.044444444444444446, Float64(l * 0.05555555555555555))), Float64(l / Float64(k * k))) + Float64(l * -0.16666666666666666)) / Float64(k * Float64(t / Float64(l / k))))); else tmp = Float64(2.0 * Float64(Float64(l / Float64(k * Float64(Float64(k * t) / l))) * Float64(cos(k) / Float64(0.5 - Float64(cos(Float64(k + k)) / 2.0))))); end return tmp end
code[t_, l_, k_] := If[LessEqual[k, 0.0148], N[(2.0 * N[(N[(N[(N[(k * k), $MachinePrecision] * N[(N[(l * 0.041666666666666664), $MachinePrecision] - N[(l * 0.044444444444444446 + N[(l * 0.05555555555555555), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] / N[(k * N[(t / N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(l / N[(k * N[(N[(k * t), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(0.5 - N[(N[Cos[N[(k + k), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.0148:\\
\;\;\;\;2 \cdot \frac{\mathsf{fma}\left(k \cdot k, \ell \cdot 0.041666666666666664 - \mathsf{fma}\left(\ell, 0.044444444444444446, \ell \cdot 0.05555555555555555\right), \frac{\ell}{k \cdot k}\right) + \ell \cdot -0.16666666666666666}{k \cdot \frac{t}{\frac{\ell}{k}}}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{\ell}{k \cdot \frac{k \cdot t}{\ell}} \cdot \frac{\cos k}{0.5 - \frac{\cos \left(k + k\right)}{2}}\right)\\
\end{array}
\end{array}
if k < 0.014800000000000001Initial program 36.6%
associate-/r*36.6%
*-commutative36.6%
associate-/r*39.5%
associate-*r/40.0%
associate-/l*39.4%
+-commutative39.4%
unpow239.4%
sqr-neg39.4%
distribute-frac-neg39.4%
distribute-frac-neg39.4%
unpow239.4%
associate--l+45.2%
metadata-eval45.2%
+-rgt-identity45.2%
unpow245.2%
distribute-frac-neg45.2%
Simplified45.2%
Taylor expanded in k around inf 73.6%
unpow273.6%
associate-*r*73.6%
unpow273.6%
Simplified73.6%
Taylor expanded in l around 0 73.6%
unpow273.6%
unpow273.6%
associate-*r*73.6%
times-frac74.2%
associate-/l*83.1%
associate-*r/83.8%
associate-*l*87.8%
*-commutative87.8%
associate-*l/90.0%
Simplified90.0%
associate-*l/91.2%
associate-/l*92.3%
Applied egg-rr92.3%
Taylor expanded in k around 0 63.2%
+-commutative63.2%
associate--l+63.2%
Simplified63.2%
if 0.014800000000000001 < k Initial program 30.8%
associate-/r*30.8%
*-commutative30.8%
associate-/r*30.9%
associate-*r/30.9%
associate-/l*30.9%
+-commutative30.9%
unpow230.9%
sqr-neg30.9%
distribute-frac-neg30.9%
distribute-frac-neg30.9%
unpow230.9%
associate--l+45.8%
metadata-eval45.8%
+-rgt-identity45.8%
unpow245.8%
distribute-frac-neg45.8%
Simplified45.8%
Taylor expanded in k around inf 74.7%
unpow274.7%
associate-*r*74.8%
unpow274.8%
Simplified74.8%
Taylor expanded in l around 0 74.7%
unpow274.7%
unpow274.7%
associate-*r*74.8%
times-frac74.7%
associate-/l*77.7%
associate-*r/83.2%
associate-*l*91.3%
*-commutative91.3%
associate-*l/95.3%
Simplified95.3%
unpow295.3%
sin-mult95.0%
Applied egg-rr95.0%
div-sub95.0%
+-inverses95.0%
cos-095.0%
metadata-eval95.0%
Simplified95.0%
Final simplification71.7%
(FPCore (t l k)
:precision binary64
(if (<= k 3.1e-5)
(* 2.0 (/ (+ (/ l (* k k)) (* l -0.16666666666666666)) (* k (/ t (/ l k)))))
(*
2.0
(* (/ l (* k (/ (* k t) l))) (/ (cos k) (- 0.5 (/ (cos (+ k k)) 2.0)))))))
double code(double t, double l, double k) {
double tmp;
if (k <= 3.1e-5) {
tmp = 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k))));
} else {
tmp = 2.0 * ((l / (k * ((k * t) / l))) * (cos(k) / (0.5 - (cos((k + k)) / 2.0))));
}
return tmp;
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 3.1d-5) then
tmp = 2.0d0 * (((l / (k * k)) + (l * (-0.16666666666666666d0))) / (k * (t / (l / k))))
else
tmp = 2.0d0 * ((l / (k * ((k * t) / l))) * (cos(k) / (0.5d0 - (cos((k + k)) / 2.0d0))))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 3.1e-5) {
tmp = 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k))));
} else {
tmp = 2.0 * ((l / (k * ((k * t) / l))) * (Math.cos(k) / (0.5 - (Math.cos((k + k)) / 2.0))));
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 3.1e-5: tmp = 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k)))) else: tmp = 2.0 * ((l / (k * ((k * t) / l))) * (math.cos(k) / (0.5 - (math.cos((k + k)) / 2.0)))) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 3.1e-5) tmp = Float64(2.0 * Float64(Float64(Float64(l / Float64(k * k)) + Float64(l * -0.16666666666666666)) / Float64(k * Float64(t / Float64(l / k))))); else tmp = Float64(2.0 * Float64(Float64(l / Float64(k * Float64(Float64(k * t) / l))) * Float64(cos(k) / Float64(0.5 - Float64(cos(Float64(k + k)) / 2.0))))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 3.1e-5) tmp = 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k)))); else tmp = 2.0 * ((l / (k * ((k * t) / l))) * (cos(k) / (0.5 - (cos((k + k)) / 2.0)))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 3.1e-5], N[(2.0 * N[(N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] / N[(k * N[(t / N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(l / N[(k * N[(N[(k * t), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(0.5 - N[(N[Cos[N[(k + k), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.1 \cdot 10^{-5}:\\
\;\;\;\;2 \cdot \frac{\frac{\ell}{k \cdot k} + \ell \cdot -0.16666666666666666}{k \cdot \frac{t}{\frac{\ell}{k}}}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{\ell}{k \cdot \frac{k \cdot t}{\ell}} \cdot \frac{\cos k}{0.5 - \frac{\cos \left(k + k\right)}{2}}\right)\\
\end{array}
\end{array}
if k < 3.10000000000000014e-5Initial program 36.6%
associate-/r*36.6%
*-commutative36.6%
associate-/r*39.5%
associate-*r/40.0%
associate-/l*39.4%
+-commutative39.4%
unpow239.4%
sqr-neg39.4%
distribute-frac-neg39.4%
distribute-frac-neg39.4%
unpow239.4%
associate--l+45.2%
metadata-eval45.2%
+-rgt-identity45.2%
unpow245.2%
distribute-frac-neg45.2%
Simplified45.2%
Taylor expanded in k around inf 73.6%
unpow273.6%
associate-*r*73.6%
unpow273.6%
Simplified73.6%
Taylor expanded in l around 0 73.6%
unpow273.6%
unpow273.6%
associate-*r*73.6%
times-frac74.2%
associate-/l*83.1%
associate-*r/83.8%
associate-*l*87.8%
*-commutative87.8%
associate-*l/90.0%
Simplified90.0%
associate-*l/91.2%
associate-/l*92.3%
Applied egg-rr92.3%
Taylor expanded in k around 0 76.3%
+-commutative76.3%
unpow276.3%
associate--l+76.3%
distribute-rgt-out--76.3%
metadata-eval76.3%
Simplified76.3%
if 3.10000000000000014e-5 < k Initial program 30.8%
associate-/r*30.8%
*-commutative30.8%
associate-/r*30.9%
associate-*r/30.9%
associate-/l*30.9%
+-commutative30.9%
unpow230.9%
sqr-neg30.9%
distribute-frac-neg30.9%
distribute-frac-neg30.9%
unpow230.9%
associate--l+45.8%
metadata-eval45.8%
+-rgt-identity45.8%
unpow245.8%
distribute-frac-neg45.8%
Simplified45.8%
Taylor expanded in k around inf 74.7%
unpow274.7%
associate-*r*74.8%
unpow274.8%
Simplified74.8%
Taylor expanded in l around 0 74.7%
unpow274.7%
unpow274.7%
associate-*r*74.8%
times-frac74.7%
associate-/l*77.7%
associate-*r/83.2%
associate-*l*91.3%
*-commutative91.3%
associate-*l/95.3%
Simplified95.3%
unpow295.3%
sin-mult95.0%
Applied egg-rr95.0%
div-sub95.0%
+-inverses95.0%
cos-095.0%
metadata-eval95.0%
Simplified95.0%
Final simplification81.4%
(FPCore (t l k) :precision binary64 (if (<= (* l l) 1e+33) (* 2.0 (/ (+ (/ l (* k k)) (* l -0.16666666666666666)) (* k (/ t (/ l k))))) (* 2.0 (* (/ l (* k (/ (* k t) l))) (/ (cos k) (* k k))))))
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+33) {
tmp = 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k))));
} else {
tmp = 2.0 * ((l / (k * ((k * t) / l))) * (cos(k) / (k * k)));
}
return tmp;
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if ((l * l) <= 1d+33) then
tmp = 2.0d0 * (((l / (k * k)) + (l * (-0.16666666666666666d0))) / (k * (t / (l / k))))
else
tmp = 2.0d0 * ((l / (k * ((k * t) / l))) * (cos(k) / (k * k)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+33) {
tmp = 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k))));
} else {
tmp = 2.0 * ((l / (k * ((k * t) / l))) * (Math.cos(k) / (k * k)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 1e+33: tmp = 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k)))) else: tmp = 2.0 * ((l / (k * ((k * t) / l))) * (math.cos(k) / (k * k))) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 1e+33) tmp = Float64(2.0 * Float64(Float64(Float64(l / Float64(k * k)) + Float64(l * -0.16666666666666666)) / Float64(k * Float64(t / Float64(l / k))))); else tmp = Float64(2.0 * Float64(Float64(l / Float64(k * Float64(Float64(k * t) / l))) * Float64(cos(k) / Float64(k * k)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 1e+33) tmp = 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k)))); else tmp = 2.0 * ((l / (k * ((k * t) / l))) * (cos(k) / (k * k))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 1e+33], N[(2.0 * N[(N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] / N[(k * N[(t / N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(l / N[(k * N[(N[(k * t), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 10^{+33}:\\
\;\;\;\;2 \cdot \frac{\frac{\ell}{k \cdot k} + \ell \cdot -0.16666666666666666}{k \cdot \frac{t}{\frac{\ell}{k}}}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{\ell}{k \cdot \frac{k \cdot t}{\ell}} \cdot \frac{\cos k}{k \cdot k}\right)\\
\end{array}
\end{array}
if (*.f64 l l) < 9.9999999999999995e32Initial program 37.1%
associate-/r*37.2%
*-commutative37.2%
associate-/r*40.2%
associate-*r/40.9%
associate-/l*40.1%
+-commutative40.1%
unpow240.1%
sqr-neg40.1%
distribute-frac-neg40.1%
distribute-frac-neg40.1%
unpow240.1%
associate--l+52.1%
metadata-eval52.1%
+-rgt-identity52.1%
unpow252.1%
distribute-frac-neg52.1%
Simplified52.1%
Taylor expanded in k around inf 74.9%
unpow274.9%
associate-*r*75.0%
unpow275.0%
Simplified75.0%
Taylor expanded in l around 0 74.9%
unpow274.9%
unpow274.9%
associate-*r*75.0%
times-frac75.8%
associate-/l*86.6%
associate-*r/86.2%
associate-*l*89.4%
*-commutative89.4%
associate-*l/90.9%
Simplified90.9%
associate-*l/92.5%
associate-/l*93.2%
Applied egg-rr93.2%
Taylor expanded in k around 0 79.1%
+-commutative79.1%
unpow279.1%
associate--l+79.1%
distribute-rgt-out--79.1%
metadata-eval79.1%
Simplified79.1%
if 9.9999999999999995e32 < (*.f64 l l) Initial program 32.5%
associate-/r*32.5%
*-commutative32.5%
associate-/r*33.4%
associate-*r/33.4%
associate-/l*33.5%
+-commutative33.5%
unpow233.5%
sqr-neg33.5%
distribute-frac-neg33.5%
distribute-frac-neg33.5%
unpow233.5%
associate--l+37.2%
metadata-eval37.2%
+-rgt-identity37.2%
unpow237.2%
distribute-frac-neg37.2%
Simplified37.2%
Taylor expanded in k around inf 72.6%
unpow272.6%
associate-*r*72.6%
unpow272.6%
Simplified72.6%
Taylor expanded in l around 0 72.6%
unpow272.6%
unpow272.6%
associate-*r*72.6%
times-frac72.5%
associate-/l*75.5%
associate-*r/80.4%
associate-*l*88.0%
*-commutative88.0%
associate-*l/92.1%
Simplified92.1%
Taylor expanded in k around 0 62.8%
unpow262.8%
Simplified62.8%
Final simplification71.8%
(FPCore (t l k) :precision binary64 (* 2.0 (/ (+ (/ l (* k k)) (* l -0.16666666666666666)) (* k (/ t (/ l k))))))
double code(double t, double l, double k) {
return 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k))));
}
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 * (((l / (k * k)) + (l * (-0.16666666666666666d0))) / (k * (t / (l / k))))
end function
public static double code(double t, double l, double k) {
return 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k))));
}
def code(t, l, k): return 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k))))
function code(t, l, k) return Float64(2.0 * Float64(Float64(Float64(l / Float64(k * k)) + Float64(l * -0.16666666666666666)) / Float64(k * Float64(t / Float64(l / k))))) end
function tmp = code(t, l, k) tmp = 2.0 * (((l / (k * k)) + (l * -0.16666666666666666)) / (k * (t / (l / k)))); end
code[t_, l_, k_] := N[(2.0 * N[(N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] / N[(k * N[(t / N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \frac{\frac{\ell}{k \cdot k} + \ell \cdot -0.16666666666666666}{k \cdot \frac{t}{\frac{\ell}{k}}}
\end{array}
Initial program 35.0%
associate-/r*35.1%
*-commutative35.1%
associate-/r*37.2%
associate-*r/37.5%
associate-/l*37.1%
+-commutative37.1%
unpow237.1%
sqr-neg37.1%
distribute-frac-neg37.1%
distribute-frac-neg37.1%
unpow237.1%
associate--l+45.4%
metadata-eval45.4%
+-rgt-identity45.4%
unpow245.4%
distribute-frac-neg45.4%
Simplified45.4%
Taylor expanded in k around inf 73.9%
unpow273.9%
associate-*r*73.9%
unpow273.9%
Simplified73.9%
Taylor expanded in l around 0 73.9%
unpow273.9%
unpow273.9%
associate-*r*73.9%
times-frac74.4%
associate-/l*81.6%
associate-*r/83.6%
associate-*l*88.8%
*-commutative88.8%
associate-*l/91.5%
Simplified91.5%
associate-*l/92.4%
associate-/l*93.5%
Applied egg-rr93.5%
Taylor expanded in k around 0 69.6%
+-commutative69.6%
unpow269.6%
associate--l+69.6%
distribute-rgt-out--69.6%
metadata-eval69.6%
Simplified69.6%
Final simplification69.6%
(FPCore (t l k) :precision binary64 (* 2.0 (/ (/ l (* k k)) (* k (/ t (/ l k))))))
double code(double t, double l, double k) {
return 2.0 * ((l / (k * k)) / (k * (t / (l / k))));
}
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 * ((l / (k * k)) / (k * (t / (l / k))))
end function
public static double code(double t, double l, double k) {
return 2.0 * ((l / (k * k)) / (k * (t / (l / k))));
}
def code(t, l, k): return 2.0 * ((l / (k * k)) / (k * (t / (l / k))))
function code(t, l, k) return Float64(2.0 * Float64(Float64(l / Float64(k * k)) / Float64(k * Float64(t / Float64(l / k))))) end
function tmp = code(t, l, k) tmp = 2.0 * ((l / (k * k)) / (k * (t / (l / k)))); end
code[t_, l_, k_] := N[(2.0 * N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] / N[(k * N[(t / N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \frac{\frac{\ell}{k \cdot k}}{k \cdot \frac{t}{\frac{\ell}{k}}}
\end{array}
Initial program 35.0%
associate-/r*35.1%
*-commutative35.1%
associate-/r*37.2%
associate-*r/37.5%
associate-/l*37.1%
+-commutative37.1%
unpow237.1%
sqr-neg37.1%
distribute-frac-neg37.1%
distribute-frac-neg37.1%
unpow237.1%
associate--l+45.4%
metadata-eval45.4%
+-rgt-identity45.4%
unpow245.4%
distribute-frac-neg45.4%
Simplified45.4%
Taylor expanded in k around inf 73.9%
unpow273.9%
associate-*r*73.9%
unpow273.9%
Simplified73.9%
Taylor expanded in l around 0 73.9%
unpow273.9%
unpow273.9%
associate-*r*73.9%
times-frac74.4%
associate-/l*81.6%
associate-*r/83.6%
associate-*l*88.8%
*-commutative88.8%
associate-*l/91.5%
Simplified91.5%
associate-*l/92.4%
associate-/l*93.5%
Applied egg-rr93.5%
Taylor expanded in k around 0 68.4%
unpow268.4%
Simplified68.4%
Final simplification68.4%
(FPCore (t l k) :precision binary64 (* -0.3333333333333333 (* (/ l k) (/ (/ l t) k))))
double code(double t, double l, double k) {
return -0.3333333333333333 * ((l / k) * ((l / t) / k));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (-0.3333333333333333d0) * ((l / k) * ((l / t) / k))
end function
public static double code(double t, double l, double k) {
return -0.3333333333333333 * ((l / k) * ((l / t) / k));
}
def code(t, l, k): return -0.3333333333333333 * ((l / k) * ((l / t) / k))
function code(t, l, k) return Float64(-0.3333333333333333 * Float64(Float64(l / k) * Float64(Float64(l / t) / k))) end
function tmp = code(t, l, k) tmp = -0.3333333333333333 * ((l / k) * ((l / t) / k)); end
code[t_, l_, k_] := N[(-0.3333333333333333 * N[(N[(l / k), $MachinePrecision] * N[(N[(l / t), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\frac{\ell}{t}}{k}\right)
\end{array}
Initial program 35.0%
associate-/r*35.1%
*-commutative35.1%
associate-/r*37.2%
associate-*r/37.5%
associate-/l*37.1%
+-commutative37.1%
unpow237.1%
sqr-neg37.1%
distribute-frac-neg37.1%
distribute-frac-neg37.1%
unpow237.1%
associate--l+45.4%
metadata-eval45.4%
+-rgt-identity45.4%
unpow245.4%
distribute-frac-neg45.4%
Simplified45.4%
Taylor expanded in k around 0 33.9%
+-commutative33.9%
fma-def33.9%
*-commutative33.9%
associate-/r*33.7%
unpow233.7%
associate-/l*35.4%
associate-*r/35.4%
times-frac35.8%
unpow235.8%
unpow235.8%
associate-/l*36.6%
Simplified36.6%
Taylor expanded in k around inf 31.2%
*-commutative31.2%
unpow231.2%
unpow231.2%
times-frac32.0%
Simplified32.0%
Taylor expanded in l around 0 31.2%
unpow231.2%
unpow231.2%
times-frac32.0%
associate-*l/31.9%
times-frac32.5%
Simplified32.5%
Final simplification32.5%
(FPCore (t l k) :precision binary64 (* -0.3333333333333333 (* (/ l k) (/ (/ l k) t))))
double code(double t, double l, double k) {
return -0.3333333333333333 * ((l / k) * ((l / k) / t));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (-0.3333333333333333d0) * ((l / k) * ((l / k) / t))
end function
public static double code(double t, double l, double k) {
return -0.3333333333333333 * ((l / k) * ((l / k) / t));
}
def code(t, l, k): return -0.3333333333333333 * ((l / k) * ((l / k) / t))
function code(t, l, k) return Float64(-0.3333333333333333 * Float64(Float64(l / k) * Float64(Float64(l / k) / t))) end
function tmp = code(t, l, k) tmp = -0.3333333333333333 * ((l / k) * ((l / k) / t)); end
code[t_, l_, k_] := N[(-0.3333333333333333 * N[(N[(l / k), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.3333333333333333 \cdot \left(\frac{\ell}{k} \cdot \frac{\frac{\ell}{k}}{t}\right)
\end{array}
Initial program 35.0%
associate-/r*35.1%
*-commutative35.1%
associate-/r*37.2%
associate-*r/37.5%
associate-/l*37.1%
+-commutative37.1%
unpow237.1%
sqr-neg37.1%
distribute-frac-neg37.1%
distribute-frac-neg37.1%
unpow237.1%
associate--l+45.4%
metadata-eval45.4%
+-rgt-identity45.4%
unpow245.4%
distribute-frac-neg45.4%
Simplified45.4%
Taylor expanded in k around 0 33.9%
+-commutative33.9%
fma-def33.9%
*-commutative33.9%
associate-/r*33.7%
unpow233.7%
associate-/l*35.4%
associate-*r/35.4%
times-frac35.8%
unpow235.8%
unpow235.8%
associate-/l*36.6%
Simplified36.6%
Taylor expanded in k around inf 31.2%
*-commutative31.2%
unpow231.2%
unpow231.2%
times-frac32.0%
Simplified32.0%
Taylor expanded in l around 0 31.2%
unpow231.2%
unpow231.2%
times-frac32.0%
associate-*l/31.9%
times-frac32.5%
Simplified32.5%
Taylor expanded in l around 0 31.2%
associate-/r*31.1%
unpow231.1%
unpow231.1%
times-frac32.2%
associate-*l/32.5%
Simplified32.5%
Final simplification32.5%
herbie shell --seed 2023287
(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))))