
(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}
Herbie found 16 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 5.8e-73)
(* (/ l (* (* t k_m) (* t k_m))) (/ l t))
(/
2.0
(*
(*
(* (sin k_m) (tan k_m))
(fma (/ k_m l) (/ k_m l) (* (+ t t) (/ (/ t l) l))))
t))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 5.8e-73) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / (((sin(k_m) * tan(k_m)) * fma((k_m / l), (k_m / l), ((t + t) * ((t / l) / l)))) * t);
}
return tmp;
}
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 5.8e-73) tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); else tmp = Float64(2.0 / Float64(Float64(Float64(sin(k_m) * tan(k_m)) * fma(Float64(k_m / l), Float64(k_m / l), Float64(Float64(t + t) * Float64(Float64(t / l) / l)))) * t)); end return tmp end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 5.8e-73], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(k$95$m / l), $MachinePrecision] * N[(k$95$m / l), $MachinePrecision] + N[(N[(t + t), $MachinePrecision] * N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 5.8 \cdot 10^{-73}:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\sin k\_m \cdot \tan k\_m\right) \cdot \mathsf{fma}\left(\frac{k\_m}{\ell}, \frac{k\_m}{\ell}, \left(t + t\right) \cdot \frac{\frac{t}{\ell}}{\ell}\right)\right) \cdot t}\\
\end{array}
\end{array}
if k < 5.8e-73Initial program 63.4%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6462.4
Applied rewrites62.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
if 5.8e-73 < k Initial program 49.5%
Taylor expanded in t around 0
Applied rewrites76.8%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*r/N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*l/N/A
frac-addN/A
Applied rewrites86.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 2.45e-73)
(* (/ l (* (* t k_m) (* t k_m))) (/ l t))
(/
2.0
(*
(* (* (sin k_m) (tan k_m)) (/ (fma (/ k_m l) k_m (* (+ t t) (/ t l))) l))
t))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.45e-73) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / (((sin(k_m) * tan(k_m)) * (fma((k_m / l), k_m, ((t + t) * (t / l))) / l)) * t);
}
return tmp;
}
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 2.45e-73) tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); else tmp = Float64(2.0 / Float64(Float64(Float64(sin(k_m) * tan(k_m)) * Float64(fma(Float64(k_m / l), k_m, Float64(Float64(t + t) * Float64(t / l))) / l)) * t)); end return tmp end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 2.45e-73], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(k$95$m / l), $MachinePrecision] * k$95$m + N[(N[(t + t), $MachinePrecision] * N[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 2.45 \cdot 10^{-73}:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\sin k\_m \cdot \tan k\_m\right) \cdot \frac{\mathsf{fma}\left(\frac{k\_m}{\ell}, k\_m, \left(t + t\right) \cdot \frac{t}{\ell}\right)}{\ell}\right) \cdot t}\\
\end{array}
\end{array}
if k < 2.45000000000000014e-73Initial program 63.4%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6462.4
Applied rewrites62.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
if 2.45000000000000014e-73 < k Initial program 49.5%
Taylor expanded in t around 0
Applied rewrites76.8%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*r/N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*l/N/A
frac-addN/A
Applied rewrites86.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-/.f6489.1
Applied rewrites89.1%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 155.0)
(* (/ l (* (* t k_m) (* t k_m))) (/ l t))
(if (<= k_m 1e+151)
(/
(* (cos k_m) (* l (+ l l)))
(* (* (- 0.5 (* 0.5 (cos (+ k_m k_m)))) t) (* k_m k_m)))
(/ 2.0 (* (* (* (sin k_m) (tan k_m)) (* (/ k_m (* l l)) k_m)) t)))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 155.0) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else if (k_m <= 1e+151) {
tmp = (cos(k_m) * (l * (l + l))) / (((0.5 - (0.5 * cos((k_m + k_m)))) * t) * (k_m * k_m));
} else {
tmp = 2.0 / (((sin(k_m) * tan(k_m)) * ((k_m / (l * 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 <= 155.0d0) then
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t)
else if (k_m <= 1d+151) then
tmp = (cos(k_m) * (l * (l + l))) / (((0.5d0 - (0.5d0 * cos((k_m + k_m)))) * t) * (k_m * k_m))
else
tmp = 2.0d0 / (((sin(k_m) * tan(k_m)) * ((k_m / (l * 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 <= 155.0) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else if (k_m <= 1e+151) {
tmp = (Math.cos(k_m) * (l * (l + l))) / (((0.5 - (0.5 * Math.cos((k_m + k_m)))) * t) * (k_m * k_m));
} else {
tmp = 2.0 / (((Math.sin(k_m) * Math.tan(k_m)) * ((k_m / (l * l)) * k_m)) * t);
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 155.0: tmp = (l / ((t * k_m) * (t * k_m))) * (l / t) elif k_m <= 1e+151: tmp = (math.cos(k_m) * (l * (l + l))) / (((0.5 - (0.5 * math.cos((k_m + k_m)))) * t) * (k_m * k_m)) else: tmp = 2.0 / (((math.sin(k_m) * math.tan(k_m)) * ((k_m / (l * l)) * k_m)) * t) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 155.0) tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); elseif (k_m <= 1e+151) tmp = Float64(Float64(cos(k_m) * Float64(l * Float64(l + l))) / Float64(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(k_m + k_m)))) * t) * Float64(k_m * k_m))); else tmp = Float64(2.0 / Float64(Float64(Float64(sin(k_m) * tan(k_m)) * Float64(Float64(k_m / Float64(l * 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 <= 155.0) tmp = (l / ((t * k_m) * (t * k_m))) * (l / t); elseif (k_m <= 1e+151) tmp = (cos(k_m) * (l * (l + l))) / (((0.5 - (0.5 * cos((k_m + k_m)))) * t) * (k_m * k_m)); else tmp = 2.0 / (((sin(k_m) * tan(k_m)) * ((k_m / (l * 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, 155.0], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[k$95$m, 1e+151], N[(N[(N[Cos[k$95$m], $MachinePrecision] * N[(l * N[(l + l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(0.5 - N[(0.5 * N[Cos[N[(k$95$m + k$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(k$95$m / N[(l * l), $MachinePrecision]), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 155:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\mathbf{elif}\;k\_m \leq 10^{+151}:\\
\;\;\;\;\frac{\cos k\_m \cdot \left(\ell \cdot \left(\ell + \ell\right)\right)}{\left(\left(0.5 - 0.5 \cdot \cos \left(k\_m + k\_m\right)\right) \cdot t\right) \cdot \left(k\_m \cdot k\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\sin k\_m \cdot \tan k\_m\right) \cdot \left(\frac{k\_m}{\ell \cdot \ell} \cdot k\_m\right)\right) \cdot t}\\
\end{array}
\end{array}
if k < 155Initial program 62.3%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6485.7
Applied rewrites85.7%
if 155 < k < 1.00000000000000002e151Initial program 48.4%
Taylor expanded in t around 0
associate-*r/N/A
lower-/.f64N/A
count-2-revN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-cos.f64N/A
pow2N/A
pow2N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.5%
if 1.00000000000000002e151 < k Initial program 46.1%
Taylor expanded in t around 0
Applied rewrites71.4%
Taylor expanded in t around 0
pow2N/A
associate-*r/N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6471.3
Applied rewrites71.3%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(let* ((t_1 (* (sin k_m) (tan k_m))))
(if (<= k_m 155.0)
(* (/ l (* (* t k_m) (* t k_m))) (/ l t))
(if (<= k_m 1e+151)
(/ 2.0 (* (/ (* (* k_m k_m) t) (* l l)) t_1))
(/ 2.0 (* (* t_1 (* (/ k_m (* l l)) k_m)) t))))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double t_1 = sin(k_m) * tan(k_m);
double tmp;
if (k_m <= 155.0) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else if (k_m <= 1e+151) {
tmp = 2.0 / ((((k_m * k_m) * t) / (l * l)) * t_1);
} else {
tmp = 2.0 / ((t_1 * ((k_m / (l * 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) :: t_1
real(8) :: tmp
t_1 = sin(k_m) * tan(k_m)
if (k_m <= 155.0d0) then
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t)
else if (k_m <= 1d+151) then
tmp = 2.0d0 / ((((k_m * k_m) * t) / (l * l)) * t_1)
else
tmp = 2.0d0 / ((t_1 * ((k_m / (l * 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 t_1 = Math.sin(k_m) * Math.tan(k_m);
double tmp;
if (k_m <= 155.0) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else if (k_m <= 1e+151) {
tmp = 2.0 / ((((k_m * k_m) * t) / (l * l)) * t_1);
} else {
tmp = 2.0 / ((t_1 * ((k_m / (l * l)) * k_m)) * t);
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): t_1 = math.sin(k_m) * math.tan(k_m) tmp = 0 if k_m <= 155.0: tmp = (l / ((t * k_m) * (t * k_m))) * (l / t) elif k_m <= 1e+151: tmp = 2.0 / ((((k_m * k_m) * t) / (l * l)) * t_1) else: tmp = 2.0 / ((t_1 * ((k_m / (l * l)) * k_m)) * t) return tmp
k_m = abs(k) function code(t, l, k_m) t_1 = Float64(sin(k_m) * tan(k_m)) tmp = 0.0 if (k_m <= 155.0) tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); elseif (k_m <= 1e+151) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k_m * k_m) * t) / Float64(l * l)) * t_1)); else tmp = Float64(2.0 / Float64(Float64(t_1 * Float64(Float64(k_m / Float64(l * l)) * k_m)) * t)); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) t_1 = sin(k_m) * tan(k_m); tmp = 0.0; if (k_m <= 155.0) tmp = (l / ((t * k_m) * (t * k_m))) * (l / t); elseif (k_m <= 1e+151) tmp = 2.0 / ((((k_m * k_m) * t) / (l * l)) * t_1); else tmp = 2.0 / ((t_1 * ((k_m / (l * l)) * k_m)) * t); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := Block[{t$95$1 = N[(N[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k$95$m, 155.0], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[k$95$m, 1e+151], N[(2.0 / N[(N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * t), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t$95$1 * N[(N[(k$95$m / N[(l * l), $MachinePrecision]), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
t_1 := \sin k\_m \cdot \tan k\_m\\
\mathbf{if}\;k\_m \leq 155:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\mathbf{elif}\;k\_m \leq 10^{+151}:\\
\;\;\;\;\frac{2}{\frac{\left(k\_m \cdot k\_m\right) \cdot t}{\ell \cdot \ell} \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(t\_1 \cdot \left(\frac{k\_m}{\ell \cdot \ell} \cdot k\_m\right)\right) \cdot t}\\
\end{array}
\end{array}
if k < 155Initial program 62.3%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6485.7
Applied rewrites85.7%
if 155 < k < 1.00000000000000002e151Initial program 48.4%
Taylor expanded in t around 0
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
unpow2N/A
associate-/l*N/A
quot-tanN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-tan.f6477.6
Applied rewrites77.6%
if 1.00000000000000002e151 < k Initial program 46.1%
Taylor expanded in t around 0
Applied rewrites71.4%
Taylor expanded in t around 0
pow2N/A
associate-*r/N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6471.3
Applied rewrites71.3%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= k_m 155.0) (* (/ l (* (* t k_m) (* t k_m))) (/ l t)) (/ 2.0 (* (* (* (sin k_m) (tan k_m)) (* (/ k_m (* l l)) k_m)) t))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 155.0) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / (((sin(k_m) * tan(k_m)) * ((k_m / (l * 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 <= 155.0d0) then
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t)
else
tmp = 2.0d0 / (((sin(k_m) * tan(k_m)) * ((k_m / (l * 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 <= 155.0) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / (((Math.sin(k_m) * Math.tan(k_m)) * ((k_m / (l * l)) * k_m)) * t);
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 155.0: tmp = (l / ((t * k_m) * (t * k_m))) * (l / t) else: tmp = 2.0 / (((math.sin(k_m) * math.tan(k_m)) * ((k_m / (l * l)) * k_m)) * t) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 155.0) tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); else tmp = Float64(2.0 / Float64(Float64(Float64(sin(k_m) * tan(k_m)) * Float64(Float64(k_m / Float64(l * 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 <= 155.0) tmp = (l / ((t * k_m) * (t * k_m))) * (l / t); else tmp = 2.0 / (((sin(k_m) * tan(k_m)) * ((k_m / (l * 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, 155.0], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(k$95$m / N[(l * l), $MachinePrecision]), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 155:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\sin k\_m \cdot \tan k\_m\right) \cdot \left(\frac{k\_m}{\ell \cdot \ell} \cdot k\_m\right)\right) \cdot t}\\
\end{array}
\end{array}
if k < 155Initial program 62.3%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6485.7
Applied rewrites85.7%
if 155 < k Initial program 47.2%
Taylor expanded in t around 0
Applied rewrites75.4%
Taylor expanded in t around 0
pow2N/A
associate-*r/N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f6471.1
Applied rewrites71.1%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= k_m 155.0) (* (/ l (* (* t k_m) (* t k_m))) (/ l t)) (/ 2.0 (* (* k_m k_m) (* (/ t (* l l)) (* (tan k_m) (sin k_m)))))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 155.0) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / ((k_m * k_m) * ((t / (l * l)) * (tan(k_m) * sin(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 <= 155.0d0) then
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t)
else
tmp = 2.0d0 / ((k_m * k_m) * ((t / (l * l)) * (tan(k_m) * sin(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 <= 155.0) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / ((k_m * k_m) * ((t / (l * l)) * (Math.tan(k_m) * Math.sin(k_m))));
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 155.0: tmp = (l / ((t * k_m) * (t * k_m))) * (l / t) else: tmp = 2.0 / ((k_m * k_m) * ((t / (l * l)) * (math.tan(k_m) * math.sin(k_m)))) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 155.0) tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); else tmp = Float64(2.0 / Float64(Float64(k_m * k_m) * Float64(Float64(t / Float64(l * l)) * Float64(tan(k_m) * sin(k_m))))); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 155.0) tmp = (l / ((t * k_m) * (t * k_m))) * (l / t); else tmp = 2.0 / ((k_m * k_m) * ((t / (l * l)) * (tan(k_m) * sin(k_m)))); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 155.0], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(N[Tan[k$95$m], $MachinePrecision] * N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 155:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(k\_m \cdot k\_m\right) \cdot \left(\frac{t}{\ell \cdot \ell} \cdot \left(\tan k\_m \cdot \sin k\_m\right)\right)}\\
\end{array}
\end{array}
if k < 155Initial program 62.3%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6485.7
Applied rewrites85.7%
if 155 < k Initial program 47.2%
Taylor expanded in t around 0
Applied rewrites75.4%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*r/N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*l/N/A
frac-addN/A
Applied rewrites87.2%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
times-fracN/A
pow2N/A
unpow2N/A
associate-/l*N/A
quot-tanN/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-tan.f64N/A
lift-sin.f6466.1
Applied rewrites66.1%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 5.8e-73)
(* (/ l (* (* t k_m) (* t k_m))) (/ l t))
(/
2.0
(*
(* (* k_m (tan k_m)) (fma (/ k_m l) (/ k_m l) (* (+ t t) (/ (/ t l) l))))
t))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 5.8e-73) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / (((k_m * tan(k_m)) * fma((k_m / l), (k_m / l), ((t + t) * ((t / l) / l)))) * t);
}
return tmp;
}
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 5.8e-73) tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); else tmp = Float64(2.0 / Float64(Float64(Float64(k_m * tan(k_m)) * fma(Float64(k_m / l), Float64(k_m / l), Float64(Float64(t + t) * Float64(Float64(t / l) / l)))) * t)); end return tmp end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 5.8e-73], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k$95$m * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(k$95$m / l), $MachinePrecision] * N[(k$95$m / l), $MachinePrecision] + N[(N[(t + t), $MachinePrecision] * N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 5.8 \cdot 10^{-73}:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(k\_m \cdot \tan k\_m\right) \cdot \mathsf{fma}\left(\frac{k\_m}{\ell}, \frac{k\_m}{\ell}, \left(t + t\right) \cdot \frac{\frac{t}{\ell}}{\ell}\right)\right) \cdot t}\\
\end{array}
\end{array}
if k < 5.8e-73Initial program 63.4%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6462.4
Applied rewrites62.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
if 5.8e-73 < k Initial program 49.5%
Taylor expanded in t around 0
Applied rewrites76.8%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*r/N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*l/N/A
frac-addN/A
Applied rewrites86.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
Taylor expanded in k around 0
Applied rewrites64.0%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 2.7e-36)
(* (/ l (* (* t k_m) (* t k_m))) (/ l t))
(/
2.0
(*
(* (* k_m (tan k_m)) (fma (/ k_m l) (/ k_m l) (* (+ t t) (/ t (* l l)))))
t))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.7e-36) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / (((k_m * tan(k_m)) * fma((k_m / l), (k_m / l), ((t + t) * (t / (l * l))))) * t);
}
return tmp;
}
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 2.7e-36) tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); else tmp = Float64(2.0 / Float64(Float64(Float64(k_m * tan(k_m)) * fma(Float64(k_m / l), Float64(k_m / l), Float64(Float64(t + t) * Float64(t / Float64(l * l))))) * t)); end return tmp end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 2.7e-36], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k$95$m * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(k$95$m / l), $MachinePrecision] * N[(k$95$m / l), $MachinePrecision] + N[(N[(t + t), $MachinePrecision] * N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 2.7 \cdot 10^{-36}:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(k\_m \cdot \tan k\_m\right) \cdot \mathsf{fma}\left(\frac{k\_m}{\ell}, \frac{k\_m}{\ell}, \left(t + t\right) \cdot \frac{t}{\ell \cdot \ell}\right)\right) \cdot t}\\
\end{array}
\end{array}
if k < 2.70000000000000007e-36Initial program 62.6%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
if 2.70000000000000007e-36 < k Initial program 48.6%
Taylor expanded in t around 0
Applied rewrites76.4%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*r/N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*l/N/A
frac-addN/A
Applied rewrites86.9%
Taylor expanded in k around 0
Applied rewrites59.7%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= t 5.4e-111)
(/
2.0
(* (* (* k_m k_m) (fma (/ k_m l) (/ k_m l) (* (+ t t) (/ (/ t l) l)))) t))
(* (/ l (* (* t k_m) (* t k_m))) (/ l t))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (t <= 5.4e-111) {
tmp = 2.0 / (((k_m * k_m) * fma((k_m / l), (k_m / l), ((t + t) * ((t / l) / l)))) * t);
} else {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
}
return tmp;
}
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (t <= 5.4e-111) tmp = Float64(2.0 / Float64(Float64(Float64(k_m * k_m) * fma(Float64(k_m / l), Float64(k_m / l), Float64(Float64(t + t) * Float64(Float64(t / l) / l)))) * t)); else tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); end return tmp end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[t, 5.4e-111], N[(2.0 / N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(N[(k$95$m / l), $MachinePrecision] * N[(k$95$m / l), $MachinePrecision] + N[(N[(t + t), $MachinePrecision] * N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5.4 \cdot 10^{-111}:\\
\;\;\;\;\frac{2}{\left(\left(k\_m \cdot k\_m\right) \cdot \mathsf{fma}\left(\frac{k\_m}{\ell}, \frac{k\_m}{\ell}, \left(t + t\right) \cdot \frac{\frac{t}{\ell}}{\ell}\right)\right) \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\end{array}
\end{array}
if t < 5.39999999999999977e-111Initial program 48.3%
Taylor expanded in t around 0
Applied rewrites72.0%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*r/N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*l/N/A
frac-addN/A
Applied rewrites77.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6483.4
Applied rewrites83.4%
Taylor expanded in k around 0
pow2N/A
lift-*.f6465.0
Applied rewrites65.0%
if 5.39999999999999977e-111 < t Initial program 67.6%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6459.0
Applied rewrites59.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6475.8
Applied rewrites75.8%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 2.7e-36)
(* (/ l (* (* t k_m) (* t k_m))) (/ l t))
(/
2.0
(*
(* (* k_m k_m) (fma (/ k_m l) (/ k_m l) (* (+ t t) (/ t (* l l)))))
t))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.7e-36) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / (((k_m * k_m) * fma((k_m / l), (k_m / l), ((t + t) * (t / (l * l))))) * t);
}
return tmp;
}
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 2.7e-36) tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); else tmp = Float64(2.0 / Float64(Float64(Float64(k_m * k_m) * fma(Float64(k_m / l), Float64(k_m / l), Float64(Float64(t + t) * Float64(t / Float64(l * l))))) * t)); end return tmp end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 2.7e-36], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(N[(k$95$m / l), $MachinePrecision] * N[(k$95$m / l), $MachinePrecision] + N[(N[(t + t), $MachinePrecision] * N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 2.7 \cdot 10^{-36}:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(k\_m \cdot k\_m\right) \cdot \mathsf{fma}\left(\frac{k\_m}{\ell}, \frac{k\_m}{\ell}, \left(t + t\right) \cdot \frac{t}{\ell \cdot \ell}\right)\right) \cdot t}\\
\end{array}
\end{array}
if k < 2.70000000000000007e-36Initial program 62.6%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
if 2.70000000000000007e-36 < k Initial program 48.6%
Taylor expanded in t around 0
Applied rewrites76.4%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*r/N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*l/N/A
frac-addN/A
Applied rewrites86.9%
Taylor expanded in k around 0
pow2N/A
lift-*.f6458.9
Applied rewrites58.9%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(if (<= k_m 2.7e-36)
(* (/ l (* (* t k_m) (* t k_m))) (/ l t))
(/
2.0
(*
(* (* k_m k_m) (fma k_m (/ k_m (* l l)) (* (/ t (* l l)) (+ t t))))
t))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.7e-36) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / (((k_m * k_m) * fma(k_m, (k_m / (l * l)), ((t / (l * l)) * (t + t)))) * t);
}
return tmp;
}
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 2.7e-36) tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); else tmp = Float64(2.0 / Float64(Float64(Float64(k_m * k_m) * fma(k_m, Float64(k_m / Float64(l * l)), Float64(Float64(t / Float64(l * l)) * Float64(t + t)))) * t)); end return tmp end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 2.7e-36], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(k$95$m * N[(k$95$m / N[(l * l), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 2.7 \cdot 10^{-36}:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(k\_m \cdot k\_m\right) \cdot \mathsf{fma}\left(k\_m, \frac{k\_m}{\ell \cdot \ell}, \frac{t}{\ell \cdot \ell} \cdot \left(t + t\right)\right)\right) \cdot t}\\
\end{array}
\end{array}
if k < 2.70000000000000007e-36Initial program 62.6%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
if 2.70000000000000007e-36 < k Initial program 48.6%
Taylor expanded in t around 0
Applied rewrites76.4%
Taylor expanded in k around 0
pow2N/A
lift-*.f6457.7
Applied rewrites57.7%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (if (<= k_m 2.75e-36) (* (/ l (* (* t k_m) (* t k_m))) (/ l t)) (/ 2.0 (* (* (* k_m k_m) (* (/ t (* l l)) (+ t t))) t))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double tmp;
if (k_m <= 2.75e-36) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / (((k_m * k_m) * ((t / (l * l)) * (t + t))) * 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 <= 2.75d-36) then
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t)
else
tmp = 2.0d0 / (((k_m * k_m) * ((t / (l * l)) * (t + t))) * 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 <= 2.75e-36) {
tmp = (l / ((t * k_m) * (t * k_m))) * (l / t);
} else {
tmp = 2.0 / (((k_m * k_m) * ((t / (l * l)) * (t + t))) * t);
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): tmp = 0 if k_m <= 2.75e-36: tmp = (l / ((t * k_m) * (t * k_m))) * (l / t) else: tmp = 2.0 / (((k_m * k_m) * ((t / (l * l)) * (t + t))) * t) return tmp
k_m = abs(k) function code(t, l, k_m) tmp = 0.0 if (k_m <= 2.75e-36) tmp = Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)); else tmp = Float64(2.0 / Float64(Float64(Float64(k_m * k_m) * Float64(Float64(t / Float64(l * l)) * Float64(t + t))) * t)); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) tmp = 0.0; if (k_m <= 2.75e-36) tmp = (l / ((t * k_m) * (t * k_m))) * (l / t); else tmp = 2.0 / (((k_m * k_m) * ((t / (l * l)) * (t + t))) * t); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := If[LessEqual[k$95$m, 2.75e-36], N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
\mathbf{if}\;k\_m \leq 2.75 \cdot 10^{-36}:\\
\;\;\;\;\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(k\_m \cdot k\_m\right) \cdot \left(\frac{t}{\ell \cdot \ell} \cdot \left(t + t\right)\right)\right) \cdot t}\\
\end{array}
\end{array}
if k < 2.74999999999999992e-36Initial program 62.6%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6488.1
Applied rewrites88.1%
if 2.74999999999999992e-36 < k Initial program 48.6%
Taylor expanded in t around 0
Applied rewrites76.4%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*r/N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*l/N/A
frac-addN/A
Applied rewrites86.9%
Taylor expanded in k around 0
count-2-revN/A
associate-/l*N/A
associate-/l*N/A
distribute-lft-outN/A
count-2-revN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
count-2-revN/A
div-add-revN/A
pow2N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
*-commutativeN/A
associate-*r/N/A
pow2N/A
Applied rewrites55.2%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (* (/ l (* (* t k_m) (* t k_m))) (/ l t)))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return (l / ((t * k_m) * (t * k_m))) * (l / t);
}
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) * (t * k_m))) * (l / t)
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return (l / ((t * k_m) * (t * k_m))) * (l / t);
}
k_m = math.fabs(k) def code(t, l, k_m): return (l / ((t * k_m) * (t * k_m))) * (l / t)
k_m = abs(k) function code(t, l, k_m) return Float64(Float64(l / Float64(Float64(t * k_m) * Float64(t * k_m))) * Float64(l / t)) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = (l / ((t * k_m) * (t * k_m))) * (l / t); end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(N[(l / N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
\frac{\ell}{\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)} \cdot \frac{\ell}{t}
\end{array}
Initial program 54.8%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6467.9
Applied rewrites67.9%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (* (/ l (* (* (* t k_m) (* t k_m)) t)) l))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return (l / (((t * k_m) * (t * k_m)) * t)) * 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) * (t * k_m)) * t)) * l
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return (l / (((t * k_m) * (t * k_m)) * t)) * l;
}
k_m = math.fabs(k) def code(t, l, k_m): return (l / (((t * k_m) * (t * k_m)) * t)) * l
k_m = abs(k) function code(t, l, k_m) return Float64(Float64(l / Float64(Float64(Float64(t * k_m) * Float64(t * k_m)) * t)) * l) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = (l / (((t * k_m) * (t * k_m)) * t)) * l; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(N[(l / N[(N[(N[(t * k$95$m), $MachinePrecision] * N[(t * k$95$m), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
\frac{\ell}{\left(\left(t \cdot k\_m\right) \cdot \left(t \cdot k\_m\right)\right) \cdot t} \cdot \ell
\end{array}
Initial program 54.8%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6455.2
Applied rewrites55.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
pow-prod-downN/A
pow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6465.8
Applied rewrites65.8%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (* (/ l (* (* (* k_m (* t t)) t) k_m)) l))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return (l / (((k_m * (t * t)) * t) * k_m)) * 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 * t)) * t) * k_m)) * l
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return (l / (((k_m * (t * t)) * t) * k_m)) * l;
}
k_m = math.fabs(k) def code(t, l, k_m): return (l / (((k_m * (t * t)) * t) * k_m)) * l
k_m = abs(k) function code(t, l, k_m) return Float64(Float64(l / Float64(Float64(Float64(k_m * Float64(t * t)) * t) * k_m)) * l) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = (l / (((k_m * (t * t)) * t) * k_m)) * l; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(N[(l / N[(N[(N[(k$95$m * N[(t * t), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
\frac{\ell}{\left(\left(k\_m \cdot \left(t \cdot t\right)\right) \cdot t\right) \cdot k\_m} \cdot \ell
\end{array}
Initial program 54.8%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6455.2
Applied rewrites55.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow3N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f6459.6
Applied rewrites59.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6459.6
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow3N/A
unpow3N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6462.6
Applied rewrites62.6%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (* (/ l (* k_m (* k_m (* (* t t) t)))) l))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return (l / (k_m * (k_m * ((t * t) * t)))) * 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 * (k_m * ((t * t) * t)))) * l
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return (l / (k_m * (k_m * ((t * t) * t)))) * l;
}
k_m = math.fabs(k) def code(t, l, k_m): return (l / (k_m * (k_m * ((t * t) * t)))) * l
k_m = abs(k) function code(t, l, k_m) return Float64(Float64(l / Float64(k_m * Float64(k_m * Float64(Float64(t * t) * t)))) * l) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = (l / (k_m * (k_m * ((t * t) * t)))) * l; end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(N[(l / N[(k$95$m * N[(k$95$m * N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
\frac{\ell}{k\_m \cdot \left(k\_m \cdot \left(\left(t \cdot t\right) \cdot t\right)\right)} \cdot \ell
\end{array}
Initial program 54.8%
Taylor expanded in k around 0
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6455.2
Applied rewrites55.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow3N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f6459.6
Applied rewrites59.6%
herbie shell --seed 2025130
(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))))