
(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));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
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));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
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}
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 4.5e-90)
(* (* (/ l k_m) 2.0) (/ (/ l k_m) (* (sin k_m) (* k_m t))))
(*
(* (cos k_m) 2.0)
(* (/ l (* k_m (pow (sin k_m) 2.0))) (/ (/ l k_m) t)))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 4.5e-90) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t)));
} else {
tmp = (cos(k_m) * 2.0) * ((l / (k_m * pow(sin(k_m), 2.0))) * ((l / k_m) / t));
}
return tmp;
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (k_m <= 4.5d-90) then
tmp = ((l / k_m) * 2.0d0) * ((l / k_m) / (sin(k_m) * (k_m * t)))
else
tmp = (cos(k_m) * 2.0d0) * ((l / (k_m * (sin(k_m) ** 2.0d0))) * ((l / k_m) / t))
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 4.5e-90) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (Math.sin(k_m) * (k_m * t)));
} else {
tmp = (Math.cos(k_m) * 2.0) * ((l / (k_m * Math.pow(Math.sin(k_m), 2.0))) * ((l / k_m) / t));
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 4.5e-90: tmp = ((l / k_m) * 2.0) * ((l / k_m) / (math.sin(k_m) * (k_m * t))) else: tmp = (math.cos(k_m) * 2.0) * ((l / (k_m * math.pow(math.sin(k_m), 2.0))) * ((l / k_m) / t)) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 4.5e-90) tmp = Float64(Float64(Float64(l / k_m) * 2.0) * Float64(Float64(l / k_m) / Float64(sin(k_m) * Float64(k_m * t)))); else tmp = Float64(Float64(cos(k_m) * 2.0) * Float64(Float64(l / Float64(k_m * (sin(k_m) ^ 2.0))) * Float64(Float64(l / k_m) / t))); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 4.5e-90) tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t))); else tmp = (cos(k_m) * 2.0) * ((l / (k_m * (sin(k_m) ^ 2.0))) * ((l / k_m) / t)); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 4.5e-90], N[(N[(N[(l / k$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(l / k$95$m), $MachinePrecision] / N[(N[Sin[k$95$m], $MachinePrecision] * N[(k$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[k$95$m], $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(l / N[(k$95$m * N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l / k$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 4.5 \cdot 10^{-90}:\\
\;\;\;\;\left(\frac{\ell}{k\_m} \cdot 2\right) \cdot \frac{\frac{\ell}{k\_m}}{\sin k\_m \cdot \left(k\_m \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\cos k\_m \cdot 2\right) \cdot \left(\frac{\ell}{k\_m \cdot {\sin k\_m}^{2}} \cdot \frac{\frac{\ell}{k\_m}}{t}\right)\\
\end{array}
\end{array}
if k < 4.50000000000000009e-90Initial program 34.8%
Taylor expanded in t around 0
count-2-revN/A
div-add-revN/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites78.3%
Applied rewrites95.6%
Taylor expanded in k around 0
Applied rewrites80.1%
if 4.50000000000000009e-90 < k Initial program 25.8%
Taylor expanded in t around 0
count-2-revN/A
div-add-revN/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites75.8%
Applied rewrites99.5%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 8.5e-5)
(* (* (/ l k_m) 2.0) (/ (/ l k_m) (* (sin k_m) (* k_m t))))
(/
2.0
(*
(* t (* (- 0.5 (* 0.5 (cos (+ k_m k_m)))) (/ k_m l)))
(/ k_m (* l (cos k_m)))))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 8.5e-5) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t)));
} else {
tmp = 2.0 / ((t * ((0.5 - (0.5 * cos((k_m + k_m)))) * (k_m / l))) * (k_m / (l * cos(k_m))));
}
return tmp;
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (k_m <= 8.5d-5) then
tmp = ((l / k_m) * 2.0d0) * ((l / k_m) / (sin(k_m) * (k_m * t)))
else
tmp = 2.0d0 / ((t * ((0.5d0 - (0.5d0 * cos((k_m + k_m)))) * (k_m / l))) * (k_m / (l * cos(k_m))))
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 8.5e-5) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (Math.sin(k_m) * (k_m * t)));
} else {
tmp = 2.0 / ((t * ((0.5 - (0.5 * Math.cos((k_m + k_m)))) * (k_m / l))) * (k_m / (l * Math.cos(k_m))));
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 8.5e-5: tmp = ((l / k_m) * 2.0) * ((l / k_m) / (math.sin(k_m) * (k_m * t))) else: tmp = 2.0 / ((t * ((0.5 - (0.5 * math.cos((k_m + k_m)))) * (k_m / l))) * (k_m / (l * math.cos(k_m)))) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 8.5e-5) tmp = Float64(Float64(Float64(l / k_m) * 2.0) * Float64(Float64(l / k_m) / Float64(sin(k_m) * Float64(k_m * t)))); else tmp = Float64(2.0 / Float64(Float64(t * Float64(Float64(0.5 - Float64(0.5 * cos(Float64(k_m + k_m)))) * Float64(k_m / l))) * Float64(k_m / Float64(l * cos(k_m))))); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 8.5e-5) tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t))); else tmp = 2.0 / ((t * ((0.5 - (0.5 * cos((k_m + k_m)))) * (k_m / l))) * (k_m / (l * cos(k_m)))); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 8.5e-5], N[(N[(N[(l / k$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(l / k$95$m), $MachinePrecision] / N[(N[Sin[k$95$m], $MachinePrecision] * N[(k$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t * N[(N[(0.5 - N[(0.5 * N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k$95$m / N[(l * N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 8.5 \cdot 10^{-5}:\\
\;\;\;\;\left(\frac{\ell}{k\_m} \cdot 2\right) \cdot \frac{\frac{\ell}{k\_m}}{\sin k\_m \cdot \left(k\_m \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(t \cdot \left(\left(0.5 - 0.5 \cdot \cos \left(k\_m + k\_m\right)\right) \cdot \frac{k\_m}{\ell}\right)\right) \cdot \frac{k\_m}{\ell \cdot \cos k\_m}}\\
\end{array}
\end{array}
if k < 8.500000000000001e-5Initial program 33.5%
Taylor expanded in t around 0
count-2-revN/A
div-add-revN/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites79.6%
Applied rewrites96.0%
Taylor expanded in k around 0
Applied rewrites82.2%
if 8.500000000000001e-5 < k Initial program 26.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.5
Applied rewrites91.5%
Applied rewrites99.5%
Applied rewrites99.4%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= k_m 3.2e-72) (* (* (/ l k_m) 2.0) (/ (/ l k_m) (* (sin k_m) (* k_m t)))) (/ 2.0 (/ (* (* (tan k_m) (sin k_m)) (* k_m (* t (/ k_m l)))) l))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 3.2e-72) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t)));
} else {
tmp = 2.0 / (((tan(k_m) * sin(k_m)) * (k_m * (t * (k_m / l)))) / l);
}
return tmp;
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (k_m <= 3.2d-72) then
tmp = ((l / k_m) * 2.0d0) * ((l / k_m) / (sin(k_m) * (k_m * t)))
else
tmp = 2.0d0 / (((tan(k_m) * sin(k_m)) * (k_m * (t * (k_m / l)))) / l)
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 3.2e-72) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (Math.sin(k_m) * (k_m * t)));
} else {
tmp = 2.0 / (((Math.tan(k_m) * Math.sin(k_m)) * (k_m * (t * (k_m / l)))) / l);
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 3.2e-72: tmp = ((l / k_m) * 2.0) * ((l / k_m) / (math.sin(k_m) * (k_m * t))) else: tmp = 2.0 / (((math.tan(k_m) * math.sin(k_m)) * (k_m * (t * (k_m / l)))) / l) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 3.2e-72) tmp = Float64(Float64(Float64(l / k_m) * 2.0) * Float64(Float64(l / k_m) / Float64(sin(k_m) * Float64(k_m * t)))); else tmp = Float64(2.0 / Float64(Float64(Float64(tan(k_m) * sin(k_m)) * Float64(k_m * Float64(t * Float64(k_m / l)))) / l)); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 3.2e-72) tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t))); else tmp = 2.0 / (((tan(k_m) * sin(k_m)) * (k_m * (t * (k_m / l)))) / l); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 3.2e-72], N[(N[(N[(l / k$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(l / k$95$m), $MachinePrecision] / N[(N[Sin[k$95$m], $MachinePrecision] * N[(k$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Tan[k$95$m], $MachinePrecision] * N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(k$95$m * N[(t * N[(k$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 3.2 \cdot 10^{-72}:\\
\;\;\;\;\left(\frac{\ell}{k\_m} \cdot 2\right) \cdot \frac{\frac{\ell}{k\_m}}{\sin k\_m \cdot \left(k\_m \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\left(\tan k\_m \cdot \sin k\_m\right) \cdot \left(k\_m \cdot \left(t \cdot \frac{k\_m}{\ell}\right)\right)}{\ell}}\\
\end{array}
\end{array}
if k < 3.19999999999999999e-72Initial program 35.4%
Taylor expanded in t around 0
count-2-revN/A
div-add-revN/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites77.5%
Applied rewrites95.7%
Taylor expanded in k around 0
Applied rewrites80.4%
if 3.19999999999999999e-72 < k Initial program 24.4%
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.f6493.0
Applied rewrites93.0%
Applied rewrites82.4%
Applied rewrites93.2%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= k_m 1.1e-91) (* (* (/ l k_m) 2.0) (/ (/ l k_m) (* (sin k_m) (* k_m t)))) (/ 2.0 (* (tan k_m) (/ (* (* t k_m) (/ (* (sin k_m) k_m) l)) l)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 1.1e-91) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t)));
} else {
tmp = 2.0 / (tan(k_m) * (((t * k_m) * ((sin(k_m) * k_m) / l)) / l));
}
return tmp;
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (k_m <= 1.1d-91) then
tmp = ((l / k_m) * 2.0d0) * ((l / k_m) / (sin(k_m) * (k_m * t)))
else
tmp = 2.0d0 / (tan(k_m) * (((t * k_m) * ((sin(k_m) * k_m) / l)) / l))
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 1.1e-91) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (Math.sin(k_m) * (k_m * t)));
} else {
tmp = 2.0 / (Math.tan(k_m) * (((t * k_m) * ((Math.sin(k_m) * k_m) / l)) / l));
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 1.1e-91: tmp = ((l / k_m) * 2.0) * ((l / k_m) / (math.sin(k_m) * (k_m * t))) else: tmp = 2.0 / (math.tan(k_m) * (((t * k_m) * ((math.sin(k_m) * k_m) / l)) / l)) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 1.1e-91) tmp = Float64(Float64(Float64(l / k_m) * 2.0) * Float64(Float64(l / k_m) / Float64(sin(k_m) * Float64(k_m * t)))); else tmp = Float64(2.0 / Float64(tan(k_m) * Float64(Float64(Float64(t * k_m) * Float64(Float64(sin(k_m) * k_m) / l)) / l))); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 1.1e-91) tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t))); else tmp = 2.0 / (tan(k_m) * (((t * k_m) * ((sin(k_m) * k_m) / l)) / l)); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 1.1e-91], N[(N[(N[(l / k$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(l / k$95$m), $MachinePrecision] / N[(N[Sin[k$95$m], $MachinePrecision] * N[(k$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[Tan[k$95$m], $MachinePrecision] * N[(N[(N[(t * k$95$m), $MachinePrecision] * N[(N[(N[Sin[k$95$m], $MachinePrecision] * k$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 1.1 \cdot 10^{-91}:\\
\;\;\;\;\left(\frac{\ell}{k\_m} \cdot 2\right) \cdot \frac{\frac{\ell}{k\_m}}{\sin k\_m \cdot \left(k\_m \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\tan k\_m \cdot \frac{\left(t \cdot k\_m\right) \cdot \frac{\sin k\_m \cdot k\_m}{\ell}}{\ell}}\\
\end{array}
\end{array}
if k < 1.1e-91Initial program 35.0%
Taylor expanded in t around 0
count-2-revN/A
div-add-revN/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites78.1%
Applied rewrites95.6%
Taylor expanded in k around 0
Applied rewrites79.9%
if 1.1e-91 < k Initial program 25.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.3
Applied rewrites91.3%
Applied rewrites81.8%
Applied rewrites88.0%
Applied rewrites89.2%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= k_m 1.15e-12) (* (* (/ l k_m) 2.0) (/ (/ l k_m) (* (sin k_m) (* k_m t)))) (/ 2.0 (/ (* (* (tan k_m) (sin k_m)) (* (* k_m k_m) t)) (* l l)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 1.15e-12) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t)));
} else {
tmp = 2.0 / (((tan(k_m) * sin(k_m)) * ((k_m * k_m) * t)) / (l * l));
}
return tmp;
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (k_m <= 1.15d-12) then
tmp = ((l / k_m) * 2.0d0) * ((l / k_m) / (sin(k_m) * (k_m * t)))
else
tmp = 2.0d0 / (((tan(k_m) * sin(k_m)) * ((k_m * k_m) * t)) / (l * l))
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 1.15e-12) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (Math.sin(k_m) * (k_m * t)));
} else {
tmp = 2.0 / (((Math.tan(k_m) * Math.sin(k_m)) * ((k_m * k_m) * t)) / (l * l));
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 1.15e-12: tmp = ((l / k_m) * 2.0) * ((l / k_m) / (math.sin(k_m) * (k_m * t))) else: tmp = 2.0 / (((math.tan(k_m) * math.sin(k_m)) * ((k_m * k_m) * t)) / (l * l)) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 1.15e-12) tmp = Float64(Float64(Float64(l / k_m) * 2.0) * Float64(Float64(l / k_m) / Float64(sin(k_m) * Float64(k_m * t)))); else tmp = Float64(2.0 / Float64(Float64(Float64(tan(k_m) * sin(k_m)) * Float64(Float64(k_m * k_m) * t)) / Float64(l * l))); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 1.15e-12) tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t))); else tmp = 2.0 / (((tan(k_m) * sin(k_m)) * ((k_m * k_m) * t)) / (l * l)); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 1.15e-12], N[(N[(N[(l / k$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(l / k$95$m), $MachinePrecision] / N[(N[Sin[k$95$m], $MachinePrecision] * N[(k$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Tan[k$95$m], $MachinePrecision] * N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(k$95$m * k$95$m), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 1.15 \cdot 10^{-12}:\\
\;\;\;\;\left(\frac{\ell}{k\_m} \cdot 2\right) \cdot \frac{\frac{\ell}{k\_m}}{\sin k\_m \cdot \left(k\_m \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\left(\tan k\_m \cdot \sin k\_m\right) \cdot \left(\left(k\_m \cdot k\_m\right) \cdot t\right)}{\ell \cdot \ell}}\\
\end{array}
\end{array}
if k < 1.14999999999999995e-12Initial program 34.1%
Taylor expanded in t around 0
count-2-revN/A
div-add-revN/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites79.3%
Applied rewrites96.0%
Taylor expanded in k around 0
Applied rewrites81.9%
if 1.14999999999999995e-12 < k Initial program 25.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.8
Applied rewrites91.8%
Applied rewrites79.2%
Applied rewrites70.9%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= k_m 1.6e-25) (* (* (/ l k_m) 2.0) (/ (/ l k_m) (* (sin k_m) (* k_m t)))) (* (/ (* 2.0 (cos k_m)) (* (* (* k_m k_m) t) k_m)) (/ (* l l) k_m))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 1.6e-25) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t)));
} else {
tmp = ((2.0 * cos(k_m)) / (((k_m * k_m) * t) * k_m)) * ((l * l) / k_m);
}
return tmp;
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (k_m <= 1.6d-25) then
tmp = ((l / k_m) * 2.0d0) * ((l / k_m) / (sin(k_m) * (k_m * t)))
else
tmp = ((2.0d0 * cos(k_m)) / (((k_m * k_m) * t) * k_m)) * ((l * l) / k_m)
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 1.6e-25) {
tmp = ((l / k_m) * 2.0) * ((l / k_m) / (Math.sin(k_m) * (k_m * t)));
} else {
tmp = ((2.0 * Math.cos(k_m)) / (((k_m * k_m) * t) * k_m)) * ((l * l) / k_m);
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 1.6e-25: tmp = ((l / k_m) * 2.0) * ((l / k_m) / (math.sin(k_m) * (k_m * t))) else: tmp = ((2.0 * math.cos(k_m)) / (((k_m * k_m) * t) * k_m)) * ((l * l) / k_m) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 1.6e-25) tmp = Float64(Float64(Float64(l / k_m) * 2.0) * Float64(Float64(l / k_m) / Float64(sin(k_m) * Float64(k_m * t)))); else tmp = Float64(Float64(Float64(2.0 * cos(k_m)) / Float64(Float64(Float64(k_m * k_m) * t) * k_m)) * Float64(Float64(l * l) / k_m)); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 1.6e-25) tmp = ((l / k_m) * 2.0) * ((l / k_m) / (sin(k_m) * (k_m * t))); else tmp = ((2.0 * cos(k_m)) / (((k_m * k_m) * t) * k_m)) * ((l * l) / k_m); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 1.6e-25], N[(N[(N[(l / k$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(N[(l / k$95$m), $MachinePrecision] / N[(N[Sin[k$95$m], $MachinePrecision] * N[(k$95$m * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 * N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] / k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 1.6 \cdot 10^{-25}:\\
\;\;\;\;\left(\frac{\ell}{k\_m} \cdot 2\right) \cdot \frac{\frac{\ell}{k\_m}}{\sin k\_m \cdot \left(k\_m \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \cos k\_m}{\left(\left(k\_m \cdot k\_m\right) \cdot t\right) \cdot k\_m} \cdot \frac{\ell \cdot \ell}{k\_m}\\
\end{array}
\end{array}
if k < 1.6000000000000001e-25Initial program 34.6%
Taylor expanded in t around 0
count-2-revN/A
div-add-revN/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites78.9%
Applied rewrites95.9%
Taylor expanded in k around 0
Applied rewrites81.6%
if 1.6000000000000001e-25 < k Initial program 24.5%
Taylor expanded in t around 0
count-2-revN/A
div-add-revN/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites73.9%
Taylor expanded in k around 0
Applied rewrites51.5%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= l 5e-19) (/ (* (pow (/ l k_m) 2.0) 2.0) (* (* t k_m) k_m)) (* (/ (* 2.0 (cos k_m)) (* (* (* k_m k_m) t) k_m)) (/ (* l l) k_m))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (l <= 5e-19) {
tmp = (pow((l / k_m), 2.0) * 2.0) / ((t * k_m) * k_m);
} else {
tmp = ((2.0 * cos(k_m)) / (((k_m * k_m) * t) * k_m)) * ((l * l) / k_m);
}
return tmp;
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (l <= 5d-19) then
tmp = (((l / k_m) ** 2.0d0) * 2.0d0) / ((t * k_m) * k_m)
else
tmp = ((2.0d0 * cos(k_m)) / (((k_m * k_m) * t) * k_m)) * ((l * l) / k_m)
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (l <= 5e-19) {
tmp = (Math.pow((l / k_m), 2.0) * 2.0) / ((t * k_m) * k_m);
} else {
tmp = ((2.0 * Math.cos(k_m)) / (((k_m * k_m) * t) * k_m)) * ((l * l) / k_m);
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if l <= 5e-19: tmp = (math.pow((l / k_m), 2.0) * 2.0) / ((t * k_m) * k_m) else: tmp = ((2.0 * math.cos(k_m)) / (((k_m * k_m) * t) * k_m)) * ((l * l) / k_m) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (l <= 5e-19) tmp = Float64(Float64((Float64(l / k_m) ^ 2.0) * 2.0) / Float64(Float64(t * k_m) * k_m)); else tmp = Float64(Float64(Float64(2.0 * cos(k_m)) / Float64(Float64(Float64(k_m * k_m) * t) * k_m)) * Float64(Float64(l * l) / k_m)); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (l <= 5e-19) tmp = (((l / k_m) ^ 2.0) * 2.0) / ((t * k_m) * k_m); else tmp = ((2.0 * cos(k_m)) / (((k_m * k_m) * t) * k_m)) * ((l * l) / k_m); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[l, 5e-19], N[(N[(N[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[(N[(t * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 * N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] / k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\frac{{\left(\frac{\ell}{k\_m}\right)}^{2} \cdot 2}{\left(t \cdot k\_m\right) \cdot k\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \cos k\_m}{\left(\left(k\_m \cdot k\_m\right) \cdot t\right) \cdot k\_m} \cdot \frac{\ell \cdot \ell}{k\_m}\\
\end{array}
\end{array}
if l < 5.0000000000000004e-19Initial program 30.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-*.f6465.1
Applied rewrites65.1%
Applied rewrites67.7%
Applied rewrites67.7%
Applied rewrites72.1%
if 5.0000000000000004e-19 < l Initial program 34.1%
Taylor expanded in t around 0
count-2-revN/A
div-add-revN/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites86.5%
Taylor expanded in k around 0
Applied rewrites70.5%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (/ 2.0 (* (* t (* (* k_m k_m) (/ k_m l))) (/ k_m (* l (cos k_m))))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return 2.0 / ((t * ((k_m * k_m) * (k_m / l))) * (k_m / (l * cos(k_m))));
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
code = 2.0d0 / ((t * ((k_m * k_m) * (k_m / l))) * (k_m / (l * cos(k_m))))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return 2.0 / ((t * ((k_m * k_m) * (k_m / l))) * (k_m / (l * Math.cos(k_m))));
}
k_m = math.fabs(k) def code(t, l, k_m): return 2.0 / ((t * ((k_m * k_m) * (k_m / l))) * (k_m / (l * math.cos(k_m))))
k_m = abs(k) function code(t, l, k_m) return Float64(2.0 / Float64(Float64(t * Float64(Float64(k_m * k_m) * Float64(k_m / l))) * Float64(k_m / Float64(l * cos(k_m))))) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = 2.0 / ((t * ((k_m * k_m) * (k_m / l))) * (k_m / (l * cos(k_m)))); end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(2.0 / N[(N[(t * N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(k$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k$95$m / N[(l * N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
\frac{2}{\left(t \cdot \left(\left(k\_m \cdot k\_m\right) \cdot \frac{k\_m}{\ell}\right)\right) \cdot \frac{k\_m}{\ell \cdot \cos k\_m}}
\end{array}
Initial program 31.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.6
Applied rewrites91.6%
Applied rewrites97.1%
Taylor expanded in k around 0
Applied rewrites72.5%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= k_m 2.2e-12) (/ (* (pow (/ l k_m) 2.0) 2.0) (* (* t k_m) k_m)) (* (/ (/ (* l l) t) k_m) (/ -0.3333333333333333 k_m))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.2e-12) {
tmp = (pow((l / k_m), 2.0) * 2.0) / ((t * k_m) * k_m);
} else {
tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m);
}
return tmp;
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (k_m <= 2.2d-12) then
tmp = (((l / k_m) ** 2.0d0) * 2.0d0) / ((t * k_m) * k_m)
else
tmp = (((l * l) / t) / k_m) * ((-0.3333333333333333d0) / k_m)
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.2e-12) {
tmp = (Math.pow((l / k_m), 2.0) * 2.0) / ((t * k_m) * k_m);
} else {
tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m);
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 2.2e-12: tmp = (math.pow((l / k_m), 2.0) * 2.0) / ((t * k_m) * k_m) else: tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 2.2e-12) tmp = Float64(Float64((Float64(l / k_m) ^ 2.0) * 2.0) / Float64(Float64(t * k_m) * k_m)); else tmp = Float64(Float64(Float64(Float64(l * l) / t) / k_m) * Float64(-0.3333333333333333 / k_m)); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 2.2e-12) tmp = (((l / k_m) ^ 2.0) * 2.0) / ((t * k_m) * k_m); else tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 2.2e-12], N[(N[(N[Power[N[(l / k$95$m), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[(N[(t * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] / t), $MachinePrecision] / k$95$m), $MachinePrecision] * N[(-0.3333333333333333 / k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 2.2 \cdot 10^{-12}:\\
\;\;\;\;\frac{{\left(\frac{\ell}{k\_m}\right)}^{2} \cdot 2}{\left(t \cdot k\_m\right) \cdot k\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\ell \cdot \ell}{t}}{k\_m} \cdot \frac{-0.3333333333333333}{k\_m}\\
\end{array}
\end{array}
if k < 2.19999999999999992e-12Initial program 33.9%
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-*.f6473.1
Applied rewrites73.1%
Applied rewrites76.3%
Applied rewrites76.3%
Applied rewrites80.4%
if 2.19999999999999992e-12 < k Initial program 25.8%
Taylor expanded in k around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-/.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-pow.f6422.1
Applied rewrites22.1%
Taylor expanded in k around inf
Applied rewrites48.3%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 2.2e-12)
(/
(*
(* 2.0 (* l (/ l k_m)))
(/
(fma
(fma (* -0.058333333333333334 k_m) k_m -0.16666666666666666)
(* k_m k_m)
1.0)
(* (* t k_m) k_m)))
k_m)
(* (/ (/ (* l l) t) k_m) (/ -0.3333333333333333 k_m))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.2e-12) {
tmp = ((2.0 * (l * (l / k_m))) * (fma(fma((-0.058333333333333334 * k_m), k_m, -0.16666666666666666), (k_m * k_m), 1.0) / ((t * k_m) * k_m))) / k_m;
} else {
tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m);
}
return tmp;
}
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 2.2e-12) tmp = Float64(Float64(Float64(2.0 * Float64(l * Float64(l / k_m))) * Float64(fma(fma(Float64(-0.058333333333333334 * k_m), k_m, -0.16666666666666666), Float64(k_m * k_m), 1.0) / Float64(Float64(t * k_m) * k_m))) / k_m); else tmp = Float64(Float64(Float64(Float64(l * l) / t) / k_m) * Float64(-0.3333333333333333 / k_m)); end return tmp end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 2.2e-12], N[(N[(N[(2.0 * N[(l * N[(l / k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(-0.058333333333333334 * k$95$m), $MachinePrecision] * k$95$m + -0.16666666666666666), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(t * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k$95$m), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] / t), $MachinePrecision] / k$95$m), $MachinePrecision] * N[(-0.3333333333333333 / k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 2.2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\left(2 \cdot \left(\ell \cdot \frac{\ell}{k\_m}\right)\right) \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.058333333333333334 \cdot k\_m, k\_m, -0.16666666666666666\right), k\_m \cdot k\_m, 1\right)}{\left(t \cdot k\_m\right) \cdot k\_m}}{k\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\ell \cdot \ell}{t}}{k\_m} \cdot \frac{-0.3333333333333333}{k\_m}\\
\end{array}
\end{array}
if k < 2.19999999999999992e-12Initial program 33.9%
Taylor expanded in t around 0
count-2-revN/A
div-add-revN/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites79.4%
Applied rewrites75.5%
Taylor expanded in k around 0
Applied rewrites60.9%
Applied rewrites71.5%
if 2.19999999999999992e-12 < k Initial program 25.8%
Taylor expanded in k around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-/.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-pow.f6422.1
Applied rewrites22.1%
Taylor expanded in k around inf
Applied rewrites48.3%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= k_m 2.2e-12) (* (/ (* l 2.0) (* t (* k_m k_m))) (/ l (* k_m k_m))) (* (/ (/ (* l l) t) k_m) (/ -0.3333333333333333 k_m))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.2e-12) {
tmp = ((l * 2.0) / (t * (k_m * k_m))) * (l / (k_m * k_m));
} else {
tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m);
}
return tmp;
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (k_m <= 2.2d-12) then
tmp = ((l * 2.0d0) / (t * (k_m * k_m))) * (l / (k_m * k_m))
else
tmp = (((l * l) / t) / k_m) * ((-0.3333333333333333d0) / k_m)
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.2e-12) {
tmp = ((l * 2.0) / (t * (k_m * k_m))) * (l / (k_m * k_m));
} else {
tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m);
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 2.2e-12: tmp = ((l * 2.0) / (t * (k_m * k_m))) * (l / (k_m * k_m)) else: tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 2.2e-12) tmp = Float64(Float64(Float64(l * 2.0) / Float64(t * Float64(k_m * k_m))) * Float64(l / Float64(k_m * k_m))); else tmp = Float64(Float64(Float64(Float64(l * l) / t) / k_m) * Float64(-0.3333333333333333 / k_m)); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 2.2e-12) tmp = ((l * 2.0) / (t * (k_m * k_m))) * (l / (k_m * k_m)); else tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 2.2e-12], N[(N[(N[(l * 2.0), $MachinePrecision] / N[(t * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] / t), $MachinePrecision] / k$95$m), $MachinePrecision] * N[(-0.3333333333333333 / k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 2.2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\ell \cdot 2}{t \cdot \left(k\_m \cdot k\_m\right)} \cdot \frac{\ell}{k\_m \cdot k\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\ell \cdot \ell}{t}}{k\_m} \cdot \frac{-0.3333333333333333}{k\_m}\\
\end{array}
\end{array}
if k < 2.19999999999999992e-12Initial program 33.9%
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-*.f6473.1
Applied rewrites73.1%
Applied rewrites79.8%
if 2.19999999999999992e-12 < k Initial program 25.8%
Taylor expanded in k around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-/.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-pow.f6422.1
Applied rewrites22.1%
Taylor expanded in k around inf
Applied rewrites48.3%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= k_m 2.2e-12) (* (/ l (* (* (* k_m t) k_m) (* k_m k_m))) (* 2.0 l)) (* (/ (/ (* l l) t) k_m) (/ -0.3333333333333333 k_m))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.2e-12) {
tmp = (l / (((k_m * t) * k_m) * (k_m * k_m))) * (2.0 * l);
} else {
tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m);
}
return tmp;
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: tmp
if (k_m <= 2.2d-12) then
tmp = (l / (((k_m * t) * k_m) * (k_m * k_m))) * (2.0d0 * l)
else
tmp = (((l * l) / t) / k_m) * ((-0.3333333333333333d0) / k_m)
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.2e-12) {
tmp = (l / (((k_m * t) * k_m) * (k_m * k_m))) * (2.0 * l);
} else {
tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m);
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 2.2e-12: tmp = (l / (((k_m * t) * k_m) * (k_m * k_m))) * (2.0 * l) else: tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 2.2e-12) tmp = Float64(Float64(l / Float64(Float64(Float64(k_m * t) * k_m) * Float64(k_m * k_m))) * Float64(2.0 * l)); else tmp = Float64(Float64(Float64(Float64(l * l) / t) / k_m) * Float64(-0.3333333333333333 / k_m)); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 2.2e-12) tmp = (l / (((k_m * t) * k_m) * (k_m * k_m))) * (2.0 * l); else tmp = (((l * l) / t) / k_m) * (-0.3333333333333333 / k_m); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 2.2e-12], N[(N[(l / N[(N[(N[(k$95$m * t), $MachinePrecision] * k$95$m), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(l * l), $MachinePrecision] / t), $MachinePrecision] / k$95$m), $MachinePrecision] * N[(-0.3333333333333333 / k$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 2.2 \cdot 10^{-12}:\\
\;\;\;\;\frac{\ell}{\left(\left(k\_m \cdot t\right) \cdot k\_m\right) \cdot \left(k\_m \cdot k\_m\right)} \cdot \left(2 \cdot \ell\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\ell \cdot \ell}{t}}{k\_m} \cdot \frac{-0.3333333333333333}{k\_m}\\
\end{array}
\end{array}
if k < 2.19999999999999992e-12Initial program 33.9%
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-*.f6473.1
Applied rewrites73.1%
Applied rewrites76.3%
Applied rewrites76.3%
if 2.19999999999999992e-12 < k Initial program 25.8%
Taylor expanded in k around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-/.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-pow.f6422.1
Applied rewrites22.1%
Taylor expanded in k around inf
Applied rewrites48.3%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (* (/ l (* (* (* k_m t) k_m) (* k_m k_m))) (* 2.0 l)))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return (l / (((k_m * t) * k_m) * (k_m * k_m))) * (2.0 * l);
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
code = (l / (((k_m * t) * k_m) * (k_m * k_m))) * (2.0d0 * l)
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return (l / (((k_m * t) * k_m) * (k_m * k_m))) * (2.0 * l);
}
k_m = math.fabs(k) def code(t, l, k_m): return (l / (((k_m * t) * k_m) * (k_m * k_m))) * (2.0 * l)
k_m = abs(k) function code(t, l, k_m) return Float64(Float64(l / Float64(Float64(Float64(k_m * t) * k_m) * Float64(k_m * k_m))) * Float64(2.0 * l)) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = (l / (((k_m * t) * k_m) * (k_m * k_m))) * (2.0 * l); end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(N[(l / N[(N[(N[(k$95$m * t), $MachinePrecision] * k$95$m), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
\frac{\ell}{\left(\left(k\_m \cdot t\right) \cdot k\_m\right) \cdot \left(k\_m \cdot k\_m\right)} \cdot \left(2 \cdot \ell\right)
\end{array}
Initial program 31.5%
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-*.f6465.0
Applied rewrites65.0%
Applied rewrites67.3%
Applied rewrites67.3%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (* (/ l (* (* t (* k_m k_m)) (* k_m k_m))) (* 2.0 l)))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return (l / ((t * (k_m * k_m)) * (k_m * k_m))) * (2.0 * l);
}
k_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k_m)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
code = (l / ((t * (k_m * k_m)) * (k_m * k_m))) * (2.0d0 * l)
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return (l / ((t * (k_m * k_m)) * (k_m * k_m))) * (2.0 * l);
}
k_m = math.fabs(k) def code(t, l, k_m): return (l / ((t * (k_m * k_m)) * (k_m * k_m))) * (2.0 * l)
k_m = abs(k) function code(t, l, k_m) return Float64(Float64(l / Float64(Float64(t * Float64(k_m * k_m)) * Float64(k_m * k_m))) * Float64(2.0 * l)) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = (l / ((t * (k_m * k_m)) * (k_m * k_m))) * (2.0 * l); end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(N[(l / N[(N[(t * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
\frac{\ell}{\left(t \cdot \left(k\_m \cdot k\_m\right)\right) \cdot \left(k\_m \cdot k\_m\right)} \cdot \left(2 \cdot \ell\right)
\end{array}
Initial program 31.5%
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-*.f6465.0
Applied rewrites65.0%
Applied rewrites67.3%
herbie shell --seed 2024346
(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))))