
(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 14 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 (* (* (/ k l) (* (* (/ (/ k (cos k)) l) t) (sin k))) (sin k))))
double code(double t, double l, double k) {
return 2.0 / (((k / l) * ((((k / cos(k)) / l) * t) * sin(k))) * sin(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 / (((k / l) * ((((k / cos(k)) / l) * t) * sin(k))) * sin(k))
end function
public static double code(double t, double l, double k) {
return 2.0 / (((k / l) * ((((k / Math.cos(k)) / l) * t) * Math.sin(k))) * Math.sin(k));
}
def code(t, l, k): return 2.0 / (((k / l) * ((((k / math.cos(k)) / l) * t) * math.sin(k))) * math.sin(k))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(k / l) * Float64(Float64(Float64(Float64(k / cos(k)) / l) * t) * sin(k))) * sin(k))) end
function tmp = code(t, l, k) tmp = 2.0 / (((k / l) * ((((k / cos(k)) / l) * t) * sin(k))) * sin(k)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(k / l), $MachinePrecision] * N[(N[(N[(N[(k / N[Cos[k], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\frac{k}{\ell} \cdot \left(\left(\frac{\frac{k}{\cos k}}{\ell} \cdot t\right) \cdot \sin k\right)\right) \cdot \sin k}
\end{array}
Initial program 34.2%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.2%
Applied rewrites96.1%
Applied rewrites97.6%
Applied rewrites98.2%
(FPCore (t l k)
:precision binary64
(if (<= k 1.55e-100)
(/
2.0
(*
(*
(/ (/ k (cos k)) l)
(* (* (* (fma -0.3333333333333333 (* k k) 1.0) t) k) k))
(/ k l)))
(/ 2.0 (/ (* (* (pow (sin k) 2.0) (* t (/ k l))) k) (* (cos k) l)))))
double code(double t, double l, double k) {
double tmp;
if (k <= 1.55e-100) {
tmp = 2.0 / ((((k / cos(k)) / l) * (((fma(-0.3333333333333333, (k * k), 1.0) * t) * k) * k)) * (k / l));
} else {
tmp = 2.0 / (((pow(sin(k), 2.0) * (t * (k / l))) * k) / (cos(k) * l));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (k <= 1.55e-100) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k / cos(k)) / l) * Float64(Float64(Float64(fma(-0.3333333333333333, Float64(k * k), 1.0) * t) * k) * k)) * Float64(k / l))); else tmp = Float64(2.0 / Float64(Float64(Float64((sin(k) ^ 2.0) * Float64(t * Float64(k / l))) * k) / Float64(cos(k) * l))); end return tmp end
code[t_, l_, k_] := If[LessEqual[k, 1.55e-100], N[(2.0 / N[(N[(N[(N[(k / N[Cos[k], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(-0.3333333333333333 * N[(k * k), $MachinePrecision] + 1.0), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * N[(t * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.55 \cdot 10^{-100}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{k}{\cos k}}{\ell} \cdot \left(\left(\left(\mathsf{fma}\left(-0.3333333333333333, k \cdot k, 1\right) \cdot t\right) \cdot k\right) \cdot k\right)\right) \cdot \frac{k}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\left({\sin k}^{2} \cdot \left(t \cdot \frac{k}{\ell}\right)\right) \cdot k}{\cos k \cdot \ell}}\\
\end{array}
\end{array}
if k < 1.5499999999999999e-100Initial program 35.7%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites89.9%
Applied rewrites94.7%
Taylor expanded in k around 0
Applied rewrites79.1%
if 1.5499999999999999e-100 < k Initial program 30.8%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.9%
Applied rewrites91.0%
Applied rewrites94.5%
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (/ k (* (cos k) l)) (* (* t (sin k)) (sin k))) (/ k l))))
double code(double t, double l, double k) {
return 2.0 / (((k / (cos(k) * l)) * ((t * sin(k)) * sin(k))) * (k / l));
}
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 / (((k / (cos(k) * l)) * ((t * sin(k)) * sin(k))) * (k / l))
end function
public static double code(double t, double l, double k) {
return 2.0 / (((k / (Math.cos(k) * l)) * ((t * Math.sin(k)) * Math.sin(k))) * (k / l));
}
def code(t, l, k): return 2.0 / (((k / (math.cos(k) * l)) * ((t * math.sin(k)) * math.sin(k))) * (k / l))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(k / Float64(cos(k) * l)) * Float64(Float64(t * sin(k)) * sin(k))) * Float64(k / l))) end
function tmp = code(t, l, k) tmp = 2.0 / (((k / (cos(k) * l)) * ((t * sin(k)) * sin(k))) * (k / l)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(k / N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(N[(t * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\frac{k}{\cos k \cdot \ell} \cdot \left(\left(t \cdot \sin k\right) \cdot \sin k\right)\right) \cdot \frac{k}{\ell}}
\end{array}
Initial program 34.2%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.2%
Applied rewrites96.1%
Applied rewrites97.6%
Applied rewrites97.6%
(FPCore (t l k)
:precision binary64
(if (<= k 0.066)
(/
2.0
(*
(*
(/ (/ k (cos k)) l)
(* (* (* (fma -0.3333333333333333 (* k k) 1.0) t) k) k))
(/ k l)))
(if (<= k 1.06e+212)
(*
(* (* (cos k) l) l)
(/ (/ (/ 2.0 (* (- 0.5 (* 0.5 (cos (+ k k)))) t)) k) k))
(/ 2.0 (* (* (/ k l) (* (* t (sin k)) (sin k))) (/ k l))))))
double code(double t, double l, double k) {
double tmp;
if (k <= 0.066) {
tmp = 2.0 / ((((k / cos(k)) / l) * (((fma(-0.3333333333333333, (k * k), 1.0) * t) * k) * k)) * (k / l));
} else if (k <= 1.06e+212) {
tmp = ((cos(k) * l) * l) * (((2.0 / ((0.5 - (0.5 * cos((k + k)))) * t)) / k) / k);
} else {
tmp = 2.0 / (((k / l) * ((t * sin(k)) * sin(k))) * (k / l));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (k <= 0.066) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k / cos(k)) / l) * Float64(Float64(Float64(fma(-0.3333333333333333, Float64(k * k), 1.0) * t) * k) * k)) * Float64(k / l))); elseif (k <= 1.06e+212) tmp = Float64(Float64(Float64(cos(k) * l) * l) * Float64(Float64(Float64(2.0 / Float64(Float64(0.5 - Float64(0.5 * cos(Float64(k + k)))) * t)) / k) / k)); else tmp = Float64(2.0 / Float64(Float64(Float64(k / l) * Float64(Float64(t * sin(k)) * sin(k))) * Float64(k / l))); end return tmp end
code[t_, l_, k_] := If[LessEqual[k, 0.066], N[(2.0 / N[(N[(N[(N[(k / N[Cos[k], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(-0.3333333333333333 * N[(k * k), $MachinePrecision] + 1.0), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1.06e+212], N[(N[(N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] * N[(N[(N[(2.0 / N[(N[(0.5 - N[(0.5 * N[Cos[N[(k + k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / l), $MachinePrecision] * N[(N[(t * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.066:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{k}{\cos k}}{\ell} \cdot \left(\left(\left(\mathsf{fma}\left(-0.3333333333333333, k \cdot k, 1\right) \cdot t\right) \cdot k\right) \cdot k\right)\right) \cdot \frac{k}{\ell}}\\
\mathbf{elif}\;k \leq 1.06 \cdot 10^{+212}:\\
\;\;\;\;\left(\left(\cos k \cdot \ell\right) \cdot \ell\right) \cdot \frac{\frac{\frac{2}{\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t}}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{\ell} \cdot \left(\left(t \cdot \sin k\right) \cdot \sin k\right)\right) \cdot \frac{k}{\ell}}\\
\end{array}
\end{array}
if k < 0.066000000000000003Initial program 34.6%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.1%
Applied rewrites95.3%
Taylor expanded in k around 0
Applied rewrites81.5%
if 0.066000000000000003 < k < 1.05999999999999995e212Initial program 27.0%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites75.0%
Applied rewrites74.9%
if 1.05999999999999995e212 < k Initial program 42.9%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.0%
Applied rewrites99.7%
Applied rewrites99.7%
Taylor expanded in k around 0
Applied rewrites80.9%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (/ k (cos k)) l)))
(if (<= k 0.0027)
(/
2.0
(*
(* t_1 (* (* (* (fma -0.3333333333333333 (* k k) 1.0) t) k) k))
(/ k l)))
(/ 2.0 (* (/ (* (* (- 0.5 (* 0.5 (cos (+ k k)))) t) k) l) t_1)))))
double code(double t, double l, double k) {
double t_1 = (k / cos(k)) / l;
double tmp;
if (k <= 0.0027) {
tmp = 2.0 / ((t_1 * (((fma(-0.3333333333333333, (k * k), 1.0) * t) * k) * k)) * (k / l));
} else {
tmp = 2.0 / (((((0.5 - (0.5 * cos((k + k)))) * t) * k) / l) * t_1);
}
return tmp;
}
function code(t, l, k) t_1 = Float64(Float64(k / cos(k)) / l) tmp = 0.0 if (k <= 0.0027) tmp = Float64(2.0 / Float64(Float64(t_1 * Float64(Float64(Float64(fma(-0.3333333333333333, Float64(k * k), 1.0) * t) * k) * k)) * Float64(k / l))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(k + k)))) * t) * k) / l) * t_1)); end return tmp end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(k / N[Cos[k], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[k, 0.0027], N[(2.0 / N[(N[(t$95$1 * N[(N[(N[(N[(-0.3333333333333333 * N[(k * k), $MachinePrecision] + 1.0), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(N[(0.5 - N[(0.5 * N[Cos[N[(k + k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision] / l), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{k}{\cos k}}{\ell}\\
\mathbf{if}\;k \leq 0.0027:\\
\;\;\;\;\frac{2}{\left(t\_1 \cdot \left(\left(\left(\mathsf{fma}\left(-0.3333333333333333, k \cdot k, 1\right) \cdot t\right) \cdot k\right) \cdot k\right)\right) \cdot \frac{k}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k}{\ell} \cdot t\_1}\\
\end{array}
\end{array}
if k < 0.0027000000000000001Initial program 34.6%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.1%
Applied rewrites95.3%
Taylor expanded in k around 0
Applied rewrites81.5%
if 0.0027000000000000001 < k Initial program 32.7%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.4%
Applied rewrites85.6%
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (/ k l) (* (* t (sin k)) (sin k))) (/ k l))))
double code(double t, double l, double k) {
return 2.0 / (((k / l) * ((t * sin(k)) * sin(k))) * (k / l));
}
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 / (((k / l) * ((t * sin(k)) * sin(k))) * (k / l))
end function
public static double code(double t, double l, double k) {
return 2.0 / (((k / l) * ((t * Math.sin(k)) * Math.sin(k))) * (k / l));
}
def code(t, l, k): return 2.0 / (((k / l) * ((t * math.sin(k)) * math.sin(k))) * (k / l))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(k / l) * Float64(Float64(t * sin(k)) * sin(k))) * Float64(k / l))) end
function tmp = code(t, l, k) tmp = 2.0 / (((k / l) * ((t * sin(k)) * sin(k))) * (k / l)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(k / l), $MachinePrecision] * N[(N[(t * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\frac{k}{\ell} \cdot \left(\left(t \cdot \sin k\right) \cdot \sin k\right)\right) \cdot \frac{k}{\ell}}
\end{array}
Initial program 34.2%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.2%
Applied rewrites96.1%
Applied rewrites97.6%
Taylor expanded in k around 0
Applied rewrites79.7%
(FPCore (t l k)
:precision binary64
(if (<= l 2.8e+213)
(/
2.0
(*
(*
(/ (/ k (cos k)) l)
(* (* (* (fma -0.3333333333333333 (* k k) 1.0) t) k) k))
(/ k l)))
(*
(* (* (cos k) l) l)
(/ (/ (/ (/ (fma (/ (* k k) t) 0.6666666666666666 (/ 2.0 t)) k) k) k) k))))
double code(double t, double l, double k) {
double tmp;
if (l <= 2.8e+213) {
tmp = 2.0 / ((((k / cos(k)) / l) * (((fma(-0.3333333333333333, (k * k), 1.0) * t) * k) * k)) * (k / l));
} else {
tmp = ((cos(k) * l) * l) * ((((fma(((k * k) / t), 0.6666666666666666, (2.0 / t)) / k) / k) / k) / k);
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (l <= 2.8e+213) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k / cos(k)) / l) * Float64(Float64(Float64(fma(-0.3333333333333333, Float64(k * k), 1.0) * t) * k) * k)) * Float64(k / l))); else tmp = Float64(Float64(Float64(cos(k) * l) * l) * Float64(Float64(Float64(Float64(fma(Float64(Float64(k * k) / t), 0.6666666666666666, Float64(2.0 / t)) / k) / k) / k) / k)); end return tmp end
code[t_, l_, k_] := If[LessEqual[l, 2.8e+213], N[(2.0 / N[(N[(N[(N[(k / N[Cos[k], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(-0.3333333333333333 * N[(k * k), $MachinePrecision] + 1.0), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(k * k), $MachinePrecision] / t), $MachinePrecision] * 0.6666666666666666 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] / k), $MachinePrecision] / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.8 \cdot 10^{+213}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{k}{\cos k}}{\ell} \cdot \left(\left(\left(\mathsf{fma}\left(-0.3333333333333333, k \cdot k, 1\right) \cdot t\right) \cdot k\right) \cdot k\right)\right) \cdot \frac{k}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\cos k \cdot \ell\right) \cdot \ell\right) \cdot \frac{\frac{\frac{\frac{\mathsf{fma}\left(\frac{k \cdot k}{t}, 0.6666666666666666, \frac{2}{t}\right)}{k}}{k}}{k}}{k}\\
\end{array}
\end{array}
if l < 2.7999999999999999e213Initial program 34.0%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.5%
Applied rewrites95.7%
Taylor expanded in k around 0
Applied rewrites78.1%
if 2.7999999999999999e213 < l Initial program 36.0%
Taylor expanded in t around 0
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites72.4%
Taylor expanded in k around 0
Applied rewrites73.0%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (/ k (cos k)) l)))
(if (<= t 1.5e-15)
(/ 2.0 (* (* (* k k) (* k (/ t l))) t_1))
(/
2.0
(*
(* t_1 (* (* (* (fma -0.3333333333333333 (* k k) 1.0) t) k) k))
(/ k l))))))
double code(double t, double l, double k) {
double t_1 = (k / cos(k)) / l;
double tmp;
if (t <= 1.5e-15) {
tmp = 2.0 / (((k * k) * (k * (t / l))) * t_1);
} else {
tmp = 2.0 / ((t_1 * (((fma(-0.3333333333333333, (k * k), 1.0) * t) * k) * k)) * (k / l));
}
return tmp;
}
function code(t, l, k) t_1 = Float64(Float64(k / cos(k)) / l) tmp = 0.0 if (t <= 1.5e-15) tmp = Float64(2.0 / Float64(Float64(Float64(k * k) * Float64(k * Float64(t / l))) * t_1)); else tmp = Float64(2.0 / Float64(Float64(t_1 * Float64(Float64(Float64(fma(-0.3333333333333333, Float64(k * k), 1.0) * t) * k) * k)) * Float64(k / l))); end return tmp end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(k / N[Cos[k], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[t, 1.5e-15], N[(2.0 / N[(N[(N[(k * k), $MachinePrecision] * N[(k * N[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t$95$1 * N[(N[(N[(N[(-0.3333333333333333 * N[(k * k), $MachinePrecision] + 1.0), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{k}{\cos k}}{\ell}\\
\mathbf{if}\;t \leq 1.5 \cdot 10^{-15}:\\
\;\;\;\;\frac{2}{\left(\left(k \cdot k\right) \cdot \left(k \cdot \frac{t}{\ell}\right)\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(t\_1 \cdot \left(\left(\left(\mathsf{fma}\left(-0.3333333333333333, k \cdot k, 1\right) \cdot t\right) \cdot k\right) \cdot k\right)\right) \cdot \frac{k}{\ell}}\\
\end{array}
\end{array}
if t < 1.5e-15Initial program 38.3%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.4%
Taylor expanded in k around 0
Applied rewrites72.9%
Applied rewrites74.4%
if 1.5e-15 < t Initial program 25.0%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.7%
Applied rewrites95.9%
Taylor expanded in k around 0
Applied rewrites81.3%
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (/ (/ k (cos k)) l) (* (* k k) t)) (/ k l))))
double code(double t, double l, double k) {
return 2.0 / ((((k / cos(k)) / l) * ((k * k) * t)) * (k / l));
}
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 / ((((k / cos(k)) / l) * ((k * k) * t)) * (k / l))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((k / Math.cos(k)) / l) * ((k * k) * t)) * (k / l));
}
def code(t, l, k): return 2.0 / ((((k / math.cos(k)) / l) * ((k * k) * t)) * (k / l))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64(k / cos(k)) / l) * Float64(Float64(k * k) * t)) * Float64(k / l))) end
function tmp = code(t, l, k) tmp = 2.0 / ((((k / cos(k)) / l) * ((k * k) * t)) * (k / l)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(k / N[Cos[k], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\frac{\frac{k}{\cos k}}{\ell} \cdot \left(\left(k \cdot k\right) \cdot t\right)\right) \cdot \frac{k}{\ell}}
\end{array}
Initial program 34.2%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.2%
Applied rewrites96.1%
Taylor expanded in k around 0
Applied rewrites76.3%
(FPCore (t l k) :precision binary64 (* (/ (* l 2.0) k) (/ (/ l (* k k)) (* k t))))
double code(double t, double l, double k) {
return ((l * 2.0) / k) * ((l / (k * k)) / (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 = ((l * 2.0d0) / k) * ((l / (k * k)) / (k * t))
end function
public static double code(double t, double l, double k) {
return ((l * 2.0) / k) * ((l / (k * k)) / (k * t));
}
def code(t, l, k): return ((l * 2.0) / k) * ((l / (k * k)) / (k * t))
function code(t, l, k) return Float64(Float64(Float64(l * 2.0) / k) * Float64(Float64(l / Float64(k * k)) / Float64(k * t))) end
function tmp = code(t, l, k) tmp = ((l * 2.0) / k) * ((l / (k * k)) / (k * t)); end
code[t_, l_, k_] := N[(N[(N[(l * 2.0), $MachinePrecision] / k), $MachinePrecision] * N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\ell \cdot 2}{k} \cdot \frac{\frac{\ell}{k \cdot k}}{k \cdot t}
\end{array}
Initial program 34.2%
Taylor expanded in k around 0
associate-*r/N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6469.2
Applied rewrites69.2%
Applied rewrites71.4%
Applied rewrites75.7%
Applied rewrites76.0%
(FPCore (t l k) :precision binary64 (* (* l 2.0) (/ (/ l (* k k)) (* (* k t) k))))
double code(double t, double l, double k) {
return (l * 2.0) * ((l / (k * k)) / ((k * 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 = (l * 2.0d0) * ((l / (k * k)) / ((k * t) * k))
end function
public static double code(double t, double l, double k) {
return (l * 2.0) * ((l / (k * k)) / ((k * t) * k));
}
def code(t, l, k): return (l * 2.0) * ((l / (k * k)) / ((k * t) * k))
function code(t, l, k) return Float64(Float64(l * 2.0) * Float64(Float64(l / Float64(k * k)) / Float64(Float64(k * t) * k))) end
function tmp = code(t, l, k) tmp = (l * 2.0) * ((l / (k * k)) / ((k * t) * k)); end
code[t_, l_, k_] := N[(N[(l * 2.0), $MachinePrecision] * N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] / N[(N[(k * t), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\ell \cdot 2\right) \cdot \frac{\frac{\ell}{k \cdot k}}{\left(k \cdot t\right) \cdot k}
\end{array}
Initial program 34.2%
Taylor expanded in k around 0
associate-*r/N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6469.2
Applied rewrites69.2%
Applied rewrites71.4%
Applied rewrites75.7%
Applied rewrites75.7%
(FPCore (t l k) :precision binary64 (* (* l 2.0) (/ (/ l (* k k)) (* (* k k) t))))
double code(double t, double l, double k) {
return (l * 2.0) * ((l / (k * k)) / ((k * 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 = (l * 2.0d0) * ((l / (k * k)) / ((k * k) * t))
end function
public static double code(double t, double l, double k) {
return (l * 2.0) * ((l / (k * k)) / ((k * k) * t));
}
def code(t, l, k): return (l * 2.0) * ((l / (k * k)) / ((k * k) * t))
function code(t, l, k) return Float64(Float64(l * 2.0) * Float64(Float64(l / Float64(k * k)) / Float64(Float64(k * k) * t))) end
function tmp = code(t, l, k) tmp = (l * 2.0) * ((l / (k * k)) / ((k * k) * t)); end
code[t_, l_, k_] := N[(N[(l * 2.0), $MachinePrecision] * N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] / N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\ell \cdot 2\right) \cdot \frac{\frac{\ell}{k \cdot k}}{\left(k \cdot k\right) \cdot t}
\end{array}
Initial program 34.2%
Taylor expanded in k around 0
associate-*r/N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6469.2
Applied rewrites69.2%
Applied rewrites71.4%
Applied rewrites75.7%
(FPCore (t l k) :precision binary64 (* (* l 2.0) (/ (/ l k) (* (* (* k k) t) k))))
double code(double t, double l, double k) {
return (l * 2.0) * ((l / k) / (((k * k) * 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 = (l * 2.0d0) * ((l / k) / (((k * k) * t) * k))
end function
public static double code(double t, double l, double k) {
return (l * 2.0) * ((l / k) / (((k * k) * t) * k));
}
def code(t, l, k): return (l * 2.0) * ((l / k) / (((k * k) * t) * k))
function code(t, l, k) return Float64(Float64(l * 2.0) * Float64(Float64(l / k) / Float64(Float64(Float64(k * k) * t) * k))) end
function tmp = code(t, l, k) tmp = (l * 2.0) * ((l / k) / (((k * k) * t) * k)); end
code[t_, l_, k_] := N[(N[(l * 2.0), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] / N[(N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\ell \cdot 2\right) \cdot \frac{\frac{\ell}{k}}{\left(\left(k \cdot k\right) \cdot t\right) \cdot k}
\end{array}
Initial program 34.2%
Taylor expanded in k around 0
associate-*r/N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6469.2
Applied rewrites69.2%
Applied rewrites71.4%
Applied rewrites75.7%
Applied rewrites74.7%
(FPCore (t l k) :precision binary64 (* (* l 2.0) (/ l (* (* (* k k) t) (* k k)))))
double code(double t, double l, double k) {
return (l * 2.0) * (l / (((k * k) * t) * (k * k)));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (l * 2.0d0) * (l / (((k * k) * t) * (k * k)))
end function
public static double code(double t, double l, double k) {
return (l * 2.0) * (l / (((k * k) * t) * (k * k)));
}
def code(t, l, k): return (l * 2.0) * (l / (((k * k) * t) * (k * k)))
function code(t, l, k) return Float64(Float64(l * 2.0) * Float64(l / Float64(Float64(Float64(k * k) * t) * Float64(k * k)))) end
function tmp = code(t, l, k) tmp = (l * 2.0) * (l / (((k * k) * t) * (k * k))); end
code[t_, l_, k_] := N[(N[(l * 2.0), $MachinePrecision] * N[(l / N[(N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\ell \cdot 2\right) \cdot \frac{\ell}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(k \cdot k\right)}
\end{array}
Initial program 34.2%
Taylor expanded in k around 0
associate-*r/N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6469.2
Applied rewrites69.2%
Applied rewrites71.4%
Applied rewrites75.7%
Applied rewrites73.7%
Final simplification73.7%
herbie shell --seed 2024322
(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))))