
(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 13 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 (* (* (* (sin k) (/ k l)) (* (sin k) t)) (/ k (* l (cos k))))))
double code(double t, double l, double k) {
return 2.0 / (((sin(k) * (k / l)) * (sin(k) * t)) * (k / (l * cos(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 / (((sin(k) * (k / l)) * (sin(k) * t)) * (k / (l * cos(k))))
end function
public static double code(double t, double l, double k) {
return 2.0 / (((Math.sin(k) * (k / l)) * (Math.sin(k) * t)) * (k / (l * Math.cos(k))));
}
def code(t, l, k): return 2.0 / (((math.sin(k) * (k / l)) * (math.sin(k) * t)) * (k / (l * math.cos(k))))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(sin(k) * Float64(k / l)) * Float64(sin(k) * t)) * Float64(k / Float64(l * cos(k))))) end
function tmp = code(t, l, k) tmp = 2.0 / (((sin(k) * (k / l)) * (sin(k) * t)) * (k / (l * cos(k)))); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[Sin[k], $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\sin k \cdot \frac{k}{\ell}\right) \cdot \left(\sin k \cdot t\right)\right) \cdot \frac{k}{\ell \cdot \cos k}}
\end{array}
Initial program 37.7%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6491.3
Applied rewrites91.3%
Applied rewrites97.1%
Applied rewrites98.2%
Applied rewrites99.3%
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* t (* (* (/ k l) (sin k)) (sin k))) (/ k (* l (cos k))))))
double code(double t, double l, double k) {
return 2.0 / ((t * (((k / l) * sin(k)) * sin(k))) * (k / (l * cos(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 / ((t * (((k / l) * sin(k)) * sin(k))) * (k / (l * cos(k))))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((t * (((k / l) * Math.sin(k)) * Math.sin(k))) * (k / (l * Math.cos(k))));
}
def code(t, l, k): return 2.0 / ((t * (((k / l) * math.sin(k)) * math.sin(k))) * (k / (l * math.cos(k))))
function code(t, l, k) return Float64(2.0 / Float64(Float64(t * Float64(Float64(Float64(k / l) * sin(k)) * sin(k))) * Float64(k / Float64(l * cos(k))))) end
function tmp = code(t, l, k) tmp = 2.0 / ((t * (((k / l) * sin(k)) * sin(k))) * (k / (l * cos(k)))); end
code[t_, l_, k_] := N[(2.0 / N[(N[(t * N[(N[(N[(k / l), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(t \cdot \left(\left(\frac{k}{\ell} \cdot \sin k\right) \cdot \sin k\right)\right) \cdot \frac{k}{\ell \cdot \cos k}}
\end{array}
Initial program 37.7%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6491.3
Applied rewrites91.3%
Applied rewrites97.1%
Applied rewrites98.2%
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* t (* (pow (sin k) 2.0) (/ k l))) (/ k (* l (cos k))))))
double code(double t, double l, double k) {
return 2.0 / ((t * (pow(sin(k), 2.0) * (k / l))) * (k / (l * cos(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 / ((t * ((sin(k) ** 2.0d0) * (k / l))) * (k / (l * cos(k))))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((t * (Math.pow(Math.sin(k), 2.0) * (k / l))) * (k / (l * Math.cos(k))));
}
def code(t, l, k): return 2.0 / ((t * (math.pow(math.sin(k), 2.0) * (k / l))) * (k / (l * math.cos(k))))
function code(t, l, k) return Float64(2.0 / Float64(Float64(t * Float64((sin(k) ^ 2.0) * Float64(k / l))) * Float64(k / Float64(l * cos(k))))) end
function tmp = code(t, l, k) tmp = 2.0 / ((t * ((sin(k) ^ 2.0) * (k / l))) * (k / (l * cos(k)))); end
code[t_, l_, k_] := N[(2.0 / N[(N[(t * N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(t \cdot \left({\sin k}^{2} \cdot \frac{k}{\ell}\right)\right) \cdot \frac{k}{\ell \cdot \cos k}}
\end{array}
Initial program 37.7%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6491.3
Applied rewrites91.3%
Applied rewrites97.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ k (* l (cos k)))))
(if (<= k 0.00345)
(/
2.0
(*
(*
t
(* (* (* (/ (fma -0.16666666666666666 (* k k) 1.0) l) k) k) (sin k)))
t_1))
(/ 2.0 (* (* t (* (- 0.5 (* 0.5 (cos (+ k k)))) (/ k l))) t_1)))))
double code(double t, double l, double k) {
double t_1 = k / (l * cos(k));
double tmp;
if (k <= 0.00345) {
tmp = 2.0 / ((t * ((((fma(-0.16666666666666666, (k * k), 1.0) / l) * k) * k) * sin(k))) * t_1);
} else {
tmp = 2.0 / ((t * ((0.5 - (0.5 * cos((k + k)))) * (k / l))) * t_1);
}
return tmp;
}
function code(t, l, k) t_1 = Float64(k / Float64(l * cos(k))) tmp = 0.0 if (k <= 0.00345) tmp = Float64(2.0 / Float64(Float64(t * Float64(Float64(Float64(Float64(fma(-0.16666666666666666, Float64(k * k), 1.0) / l) * k) * k) * sin(k))) * t_1)); else tmp = Float64(2.0 / Float64(Float64(t * Float64(Float64(0.5 - Float64(0.5 * cos(Float64(k + k)))) * Float64(k / l))) * t_1)); end return tmp end
code[t_, l_, k_] := Block[{t$95$1 = N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 0.00345], N[(2.0 / N[(N[(t * N[(N[(N[(N[(N[(-0.16666666666666666 * N[(k * k), $MachinePrecision] + 1.0), $MachinePrecision] / l), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t * N[(N[(0.5 - N[(0.5 * N[Cos[N[(k + k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{k}{\ell \cdot \cos k}\\
\mathbf{if}\;k \leq 0.00345:\\
\;\;\;\;\frac{2}{\left(t \cdot \left(\left(\left(\frac{\mathsf{fma}\left(-0.16666666666666666, k \cdot k, 1\right)}{\ell} \cdot k\right) \cdot k\right) \cdot \sin k\right)\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(t \cdot \left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot \frac{k}{\ell}\right)\right) \cdot t\_1}\\
\end{array}
\end{array}
if k < 0.0034499999999999999Initial program 39.9%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6491.1
Applied rewrites91.1%
Applied rewrites96.3%
Applied rewrites97.8%
Taylor expanded in k around 0
Applied rewrites86.7%
if 0.0034499999999999999 < k Initial program 30.5%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6491.9
Applied rewrites91.9%
Applied rewrites99.5%
Applied rewrites99.3%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ k (* l (cos k)))))
(if (<= k 8.2e-5)
(/ 2.0 (* (* t (* (* k k) (/ k l))) t_1))
(/ 2.0 (* (* t (* (- 0.5 (* 0.5 (cos (+ k k)))) (/ k l))) t_1)))))
double code(double t, double l, double k) {
double t_1 = k / (l * cos(k));
double tmp;
if (k <= 8.2e-5) {
tmp = 2.0 / ((t * ((k * k) * (k / l))) * t_1);
} else {
tmp = 2.0 / ((t * ((0.5 - (0.5 * cos((k + k)))) * (k / l))) * 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 = k / (l * cos(k))
if (k <= 8.2d-5) then
tmp = 2.0d0 / ((t * ((k * k) * (k / l))) * t_1)
else
tmp = 2.0d0 / ((t * ((0.5d0 - (0.5d0 * cos((k + k)))) * (k / l))) * t_1)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = k / (l * Math.cos(k));
double tmp;
if (k <= 8.2e-5) {
tmp = 2.0 / ((t * ((k * k) * (k / l))) * t_1);
} else {
tmp = 2.0 / ((t * ((0.5 - (0.5 * Math.cos((k + k)))) * (k / l))) * t_1);
}
return tmp;
}
def code(t, l, k): t_1 = k / (l * math.cos(k)) tmp = 0 if k <= 8.2e-5: tmp = 2.0 / ((t * ((k * k) * (k / l))) * t_1) else: tmp = 2.0 / ((t * ((0.5 - (0.5 * math.cos((k + k)))) * (k / l))) * t_1) return tmp
function code(t, l, k) t_1 = Float64(k / Float64(l * cos(k))) tmp = 0.0 if (k <= 8.2e-5) tmp = Float64(2.0 / Float64(Float64(t * Float64(Float64(k * k) * Float64(k / l))) * t_1)); else tmp = Float64(2.0 / Float64(Float64(t * Float64(Float64(0.5 - Float64(0.5 * cos(Float64(k + k)))) * Float64(k / l))) * t_1)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = k / (l * cos(k)); tmp = 0.0; if (k <= 8.2e-5) tmp = 2.0 / ((t * ((k * k) * (k / l))) * t_1); else tmp = 2.0 / ((t * ((0.5 - (0.5 * cos((k + k)))) * (k / l))) * t_1); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 8.2e-5], N[(2.0 / N[(N[(t * N[(N[(k * k), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t * N[(N[(0.5 - N[(0.5 * N[Cos[N[(k + k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{k}{\ell \cdot \cos k}\\
\mathbf{if}\;k \leq 8.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{2}{\left(t \cdot \left(\left(k \cdot k\right) \cdot \frac{k}{\ell}\right)\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(t \cdot \left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot \frac{k}{\ell}\right)\right) \cdot t\_1}\\
\end{array}
\end{array}
if k < 8.20000000000000009e-5Initial program 39.9%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6491.1
Applied rewrites91.1%
Applied rewrites96.3%
Taylor expanded in k around 0
Applied rewrites84.9%
if 8.20000000000000009e-5 < k Initial program 30.5%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6491.9
Applied rewrites91.9%
Applied rewrites99.5%
Applied rewrites99.3%
(FPCore (t l k)
:precision binary64
(if (<= k 0.00096)
(/ 2.0 (* (* t (* (* k k) (/ k l))) (/ k (* l (cos k)))))
(*
(/ (* 2.0 (cos k)) (* (* (- 0.5 (* 0.5 (cos (+ k k)))) t) k))
(/ (* l l) k))))
double code(double t, double l, double k) {
double tmp;
if (k <= 0.00096) {
tmp = 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * cos(k))));
} else {
tmp = ((2.0 * cos(k)) / (((0.5 - (0.5 * cos((k + k)))) * t) * k)) * ((l * l) / 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 (k <= 0.00096d0) then
tmp = 2.0d0 / ((t * ((k * k) * (k / l))) * (k / (l * cos(k))))
else
tmp = ((2.0d0 * cos(k)) / (((0.5d0 - (0.5d0 * cos((k + k)))) * t) * k)) * ((l * l) / k)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 0.00096) {
tmp = 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * Math.cos(k))));
} else {
tmp = ((2.0 * Math.cos(k)) / (((0.5 - (0.5 * Math.cos((k + k)))) * t) * k)) * ((l * l) / k);
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 0.00096: tmp = 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * math.cos(k)))) else: tmp = ((2.0 * math.cos(k)) / (((0.5 - (0.5 * math.cos((k + k)))) * t) * k)) * ((l * l) / k) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 0.00096) tmp = Float64(2.0 / Float64(Float64(t * Float64(Float64(k * k) * Float64(k / l))) * Float64(k / Float64(l * cos(k))))); else tmp = Float64(Float64(Float64(2.0 * cos(k)) / Float64(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(k + k)))) * t) * k)) * Float64(Float64(l * l) / k)); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 0.00096) tmp = 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * cos(k)))); else tmp = ((2.0 * cos(k)) / (((0.5 - (0.5 * cos((k + k)))) * t) * k)) * ((l * l) / k); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 0.00096], N[(2.0 / N[(N[(t * N[(N[(k * k), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 * N[Cos[k], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(0.5 - N[(0.5 * N[Cos[N[(k + k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00096:\\
\;\;\;\;\frac{2}{\left(t \cdot \left(\left(k \cdot k\right) \cdot \frac{k}{\ell}\right)\right) \cdot \frac{k}{\ell \cdot \cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \cos k}{\left(\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t\right) \cdot k} \cdot \frac{\ell \cdot \ell}{k}\\
\end{array}
\end{array}
if k < 9.60000000000000024e-4Initial program 39.9%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6491.1
Applied rewrites91.1%
Applied rewrites96.3%
Taylor expanded in k around 0
Applied rewrites84.9%
if 9.60000000000000024e-4 < k Initial program 30.5%
Taylor expanded in t around 0
associate-*r/N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites79.5%
Applied rewrites79.3%
(FPCore (t l k)
:precision binary64
(if (<= k 0.00105)
(/ 2.0 (* (* t (* (* k k) (/ k l))) (/ k (* l (cos k)))))
(*
(/ 2.0 (* (* k k) t))
(/ (* (* (cos k) l) l) (- 0.5 (* 0.5 (cos (+ k k))))))))
double code(double t, double l, double k) {
double tmp;
if (k <= 0.00105) {
tmp = 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * cos(k))));
} else {
tmp = (2.0 / ((k * k) * t)) * (((cos(k) * l) * l) / (0.5 - (0.5 * cos((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 (k <= 0.00105d0) then
tmp = 2.0d0 / ((t * ((k * k) * (k / l))) * (k / (l * cos(k))))
else
tmp = (2.0d0 / ((k * k) * t)) * (((cos(k) * l) * l) / (0.5d0 - (0.5d0 * cos((k + k)))))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 0.00105) {
tmp = 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * Math.cos(k))));
} else {
tmp = (2.0 / ((k * k) * t)) * (((Math.cos(k) * l) * l) / (0.5 - (0.5 * Math.cos((k + k)))));
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 0.00105: tmp = 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * math.cos(k)))) else: tmp = (2.0 / ((k * k) * t)) * (((math.cos(k) * l) * l) / (0.5 - (0.5 * math.cos((k + k))))) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 0.00105) tmp = Float64(2.0 / Float64(Float64(t * Float64(Float64(k * k) * Float64(k / l))) * Float64(k / Float64(l * cos(k))))); else tmp = Float64(Float64(2.0 / Float64(Float64(k * k) * t)) * Float64(Float64(Float64(cos(k) * l) * l) / Float64(0.5 - Float64(0.5 * cos(Float64(k + k)))))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 0.00105) tmp = 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * cos(k)))); else tmp = (2.0 / ((k * k) * t)) * (((cos(k) * l) * l) / (0.5 - (0.5 * cos((k + k))))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 0.00105], N[(2.0 / N[(N[(t * N[(N[(k * k), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] / N[(0.5 - N[(0.5 * N[Cos[N[(k + k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00105:\\
\;\;\;\;\frac{2}{\left(t \cdot \left(\left(k \cdot k\right) \cdot \frac{k}{\ell}\right)\right) \cdot \frac{k}{\ell \cdot \cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(k \cdot k\right) \cdot t} \cdot \frac{\left(\cos k \cdot \ell\right) \cdot \ell}{0.5 - 0.5 \cdot \cos \left(k + k\right)}\\
\end{array}
\end{array}
if k < 0.00104999999999999994Initial program 39.9%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6491.1
Applied rewrites91.1%
Applied rewrites96.3%
Taylor expanded in k around 0
Applied rewrites84.9%
if 0.00104999999999999994 < k Initial program 30.5%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6491.9
Applied rewrites91.9%
Taylor expanded in t around 0
associate-*r/N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-pow.f64N/A
lower-sin.f6468.1
Applied rewrites68.1%
Applied rewrites68.0%
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* t (* (* k k) (/ k l))) (/ k (* l (cos k))))))
double code(double t, double l, double k) {
return 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * cos(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 / ((t * ((k * k) * (k / l))) * (k / (l * cos(k))))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * Math.cos(k))));
}
def code(t, l, k): return 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * math.cos(k))))
function code(t, l, k) return Float64(2.0 / Float64(Float64(t * Float64(Float64(k * k) * Float64(k / l))) * Float64(k / Float64(l * cos(k))))) end
function tmp = code(t, l, k) tmp = 2.0 / ((t * ((k * k) * (k / l))) * (k / (l * cos(k)))); end
code[t_, l_, k_] := N[(2.0 / N[(N[(t * N[(N[(k * k), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(t \cdot \left(\left(k \cdot k\right) \cdot \frac{k}{\ell}\right)\right) \cdot \frac{k}{\ell \cdot \cos k}}
\end{array}
Initial program 37.7%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f6491.3
Applied rewrites91.3%
Applied rewrites97.1%
Taylor expanded in k around 0
Applied rewrites76.7%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (* k k) l)))
(if (<= k 3.5e-70)
(/ 2.0 (* t (* t_1 t_1)))
(* (/ l (pow k 4.0)) (/ (* l 2.0) t)))))
double code(double t, double l, double k) {
double t_1 = (k * k) / l;
double tmp;
if (k <= 3.5e-70) {
tmp = 2.0 / (t * (t_1 * t_1));
} else {
tmp = (l / pow(k, 4.0)) * ((l * 2.0) / 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
real(8) :: t_1
real(8) :: tmp
t_1 = (k * k) / l
if (k <= 3.5d-70) then
tmp = 2.0d0 / (t * (t_1 * t_1))
else
tmp = (l / (k ** 4.0d0)) * ((l * 2.0d0) / t)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = (k * k) / l;
double tmp;
if (k <= 3.5e-70) {
tmp = 2.0 / (t * (t_1 * t_1));
} else {
tmp = (l / Math.pow(k, 4.0)) * ((l * 2.0) / t);
}
return tmp;
}
def code(t, l, k): t_1 = (k * k) / l tmp = 0 if k <= 3.5e-70: tmp = 2.0 / (t * (t_1 * t_1)) else: tmp = (l / math.pow(k, 4.0)) * ((l * 2.0) / t) return tmp
function code(t, l, k) t_1 = Float64(Float64(k * k) / l) tmp = 0.0 if (k <= 3.5e-70) tmp = Float64(2.0 / Float64(t * Float64(t_1 * t_1))); else tmp = Float64(Float64(l / (k ^ 4.0)) * Float64(Float64(l * 2.0) / t)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = (k * k) / l; tmp = 0.0; if (k <= 3.5e-70) tmp = 2.0 / (t * (t_1 * t_1)); else tmp = (l / (k ^ 4.0)) * ((l * 2.0) / t); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(k * k), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[k, 3.5e-70], N[(2.0 / N[(t * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l / N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision] * N[(N[(l * 2.0), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{k \cdot k}{\ell}\\
\mathbf{if}\;k \leq 3.5 \cdot 10^{-70}:\\
\;\;\;\;\frac{2}{t \cdot \left(t\_1 \cdot t\_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{{k}^{4}} \cdot \frac{\ell \cdot 2}{t}\\
\end{array}
\end{array}
if k < 3.49999999999999974e-70Initial program 41.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-pow.f64N/A
cube-multN/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites65.3%
Taylor expanded in k around 0
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-pow.f6478.2
Applied rewrites78.2%
Applied rewrites82.1%
if 3.49999999999999974e-70 < k Initial program 28.3%
Taylor expanded in k around 0
count-2-revN/A
unpow2N/A
associate-/l*N/A
unpow2N/A
associate-/l*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
count-2-revN/A
lower-*.f6455.3
Applied rewrites55.3%
Applied rewrites61.0%
(FPCore (t l k) :precision binary64 (let* ((t_1 (/ (* k k) l))) (/ 2.0 (* t (* t_1 t_1)))))
double code(double t, double l, double k) {
double t_1 = (k * k) / l;
return 2.0 / (t * (t_1 * t_1));
}
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
t_1 = (k * k) / l
code = 2.0d0 / (t * (t_1 * t_1))
end function
public static double code(double t, double l, double k) {
double t_1 = (k * k) / l;
return 2.0 / (t * (t_1 * t_1));
}
def code(t, l, k): t_1 = (k * k) / l return 2.0 / (t * (t_1 * t_1))
function code(t, l, k) t_1 = Float64(Float64(k * k) / l) return Float64(2.0 / Float64(t * Float64(t_1 * t_1))) end
function tmp = code(t, l, k) t_1 = (k * k) / l; tmp = 2.0 / (t * (t_1 * t_1)); end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(k * k), $MachinePrecision] / l), $MachinePrecision]}, N[(2.0 / N[(t * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{k \cdot k}{\ell}\\
\frac{2}{t \cdot \left(t\_1 \cdot t\_1\right)}
\end{array}
\end{array}
Initial program 37.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-pow.f64N/A
cube-multN/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites63.2%
Taylor expanded in k around 0
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-pow.f6471.6
Applied rewrites71.6%
Applied rewrites74.3%
(FPCore (t l k) :precision binary64 (* (/ l (* (* t (* k k)) (* k k))) (* 2.0 l)))
double code(double t, double l, double k) {
return (l / ((t * (k * k)) * (k * k))) * (2.0 * l);
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (l / ((t * (k * k)) * (k * k))) * (2.0d0 * l)
end function
public static double code(double t, double l, double k) {
return (l / ((t * (k * k)) * (k * k))) * (2.0 * l);
}
def code(t, l, k): return (l / ((t * (k * k)) * (k * k))) * (2.0 * l)
function code(t, l, k) return Float64(Float64(l / Float64(Float64(t * Float64(k * k)) * Float64(k * k))) * Float64(2.0 * l)) end
function tmp = code(t, l, k) tmp = (l / ((t * (k * k)) * (k * k))) * (2.0 * l); end
code[t_, l_, k_] := N[(N[(l / N[(N[(t * N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\ell}{\left(t \cdot \left(k \cdot k\right)\right) \cdot \left(k \cdot k\right)} \cdot \left(2 \cdot \ell\right)
\end{array}
Initial program 37.7%
Taylor expanded in k around 0
count-2-revN/A
unpow2N/A
associate-/l*N/A
unpow2N/A
associate-/l*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
count-2-revN/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites72.4%
(FPCore (t l k) :precision binary64 (* (* l l) (/ -0.11666666666666667 t)))
double code(double t, double l, double k) {
return (l * l) * (-0.11666666666666667 / 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 * l) * ((-0.11666666666666667d0) / t)
end function
public static double code(double t, double l, double k) {
return (l * l) * (-0.11666666666666667 / t);
}
def code(t, l, k): return (l * l) * (-0.11666666666666667 / t)
function code(t, l, k) return Float64(Float64(l * l) * Float64(-0.11666666666666667 / t)) end
function tmp = code(t, l, k) tmp = (l * l) * (-0.11666666666666667 / t); end
code[t_, l_, k_] := N[(N[(l * l), $MachinePrecision] * N[(-0.11666666666666667 / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\ell \cdot \ell\right) \cdot \frac{-0.11666666666666667}{t}
\end{array}
Initial program 37.7%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites31.3%
Taylor expanded in k around inf
Applied rewrites14.7%
Applied rewrites14.7%
(FPCore (t l k) :precision binary64 (* (* -0.11666666666666667 (/ l t)) l))
double code(double t, double l, double k) {
return (-0.11666666666666667 * (l / t)) * l;
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = ((-0.11666666666666667d0) * (l / t)) * l
end function
public static double code(double t, double l, double k) {
return (-0.11666666666666667 * (l / t)) * l;
}
def code(t, l, k): return (-0.11666666666666667 * (l / t)) * l
function code(t, l, k) return Float64(Float64(-0.11666666666666667 * Float64(l / t)) * l) end
function tmp = code(t, l, k) tmp = (-0.11666666666666667 * (l / t)) * l; end
code[t_, l_, k_] := N[(N[(-0.11666666666666667 * N[(l / t), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]
\begin{array}{l}
\\
\left(-0.11666666666666667 \cdot \frac{\ell}{t}\right) \cdot \ell
\end{array}
Initial program 37.7%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites31.3%
Taylor expanded in k around inf
Applied rewrites14.7%
Applied rewrites12.7%
herbie shell --seed 2024326
(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))))