
(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]
\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)}
Herbie found 15 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]
\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)}
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (cos (fabs k)) l)))
(if (<= (fabs k) 0.024)
(*
t_1
(* (/ l (* (fabs k) (fabs k))) (/ 2.0 (* (pow (fabs k) 2.0) t))))
(*
t_1
(/
(* (/ l (fabs k)) 2.0)
(*
(fabs k)
(* (- 0.5 (* 0.5 (cos (+ (fabs k) (fabs k))))) t)))))))double code(double t, double l, double k) {
double t_1 = cos(fabs(k)) * l;
double tmp;
if (fabs(k) <= 0.024) {
tmp = t_1 * ((l / (fabs(k) * fabs(k))) * (2.0 / (pow(fabs(k), 2.0) * t)));
} else {
tmp = t_1 * (((l / fabs(k)) * 2.0) / (fabs(k) * ((0.5 - (0.5 * cos((fabs(k) + fabs(k))))) * t)));
}
return tmp;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = cos(abs(k)) * l
if (abs(k) <= 0.024d0) then
tmp = t_1 * ((l / (abs(k) * abs(k))) * (2.0d0 / ((abs(k) ** 2.0d0) * t)))
else
tmp = t_1 * (((l / abs(k)) * 2.0d0) / (abs(k) * ((0.5d0 - (0.5d0 * cos((abs(k) + abs(k))))) * t)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(Math.abs(k)) * l;
double tmp;
if (Math.abs(k) <= 0.024) {
tmp = t_1 * ((l / (Math.abs(k) * Math.abs(k))) * (2.0 / (Math.pow(Math.abs(k), 2.0) * t)));
} else {
tmp = t_1 * (((l / Math.abs(k)) * 2.0) / (Math.abs(k) * ((0.5 - (0.5 * Math.cos((Math.abs(k) + Math.abs(k))))) * t)));
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(math.fabs(k)) * l tmp = 0 if math.fabs(k) <= 0.024: tmp = t_1 * ((l / (math.fabs(k) * math.fabs(k))) * (2.0 / (math.pow(math.fabs(k), 2.0) * t))) else: tmp = t_1 * (((l / math.fabs(k)) * 2.0) / (math.fabs(k) * ((0.5 - (0.5 * math.cos((math.fabs(k) + math.fabs(k))))) * t))) return tmp
function code(t, l, k) t_1 = Float64(cos(abs(k)) * l) tmp = 0.0 if (abs(k) <= 0.024) tmp = Float64(t_1 * Float64(Float64(l / Float64(abs(k) * abs(k))) * Float64(2.0 / Float64((abs(k) ^ 2.0) * t)))); else tmp = Float64(t_1 * Float64(Float64(Float64(l / abs(k)) * 2.0) / Float64(abs(k) * Float64(Float64(0.5 - Float64(0.5 * cos(Float64(abs(k) + abs(k))))) * t)))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(abs(k)) * l; tmp = 0.0; if (abs(k) <= 0.024) tmp = t_1 * ((l / (abs(k) * abs(k))) * (2.0 / ((abs(k) ^ 2.0) * t))); else tmp = t_1 * (((l / abs(k)) * 2.0) / (abs(k) * ((0.5 - (0.5 * cos((abs(k) + abs(k))))) * t))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 0.024], N[(t$95$1 * N[(N[(l / N[(N[Abs[k], $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(N[(l / N[Abs[k], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] / N[(N[Abs[k], $MachinePrecision] * N[(N[(0.5 - N[(0.5 * N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \cos \left(\left|k\right|\right) \cdot \ell\\
\mathbf{if}\;\left|k\right| \leq 0.024:\\
\;\;\;\;t\_1 \cdot \left(\frac{\ell}{\left|k\right| \cdot \left|k\right|} \cdot \frac{2}{{\left(\left|k\right|\right)}^{2} \cdot t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{\frac{\ell}{\left|k\right|} \cdot 2}{\left|k\right| \cdot \left(\left(0.5 - 0.5 \cdot \cos \left(\left|k\right| + \left|k\right|\right)\right) \cdot t\right)}\\
\end{array}
if k < 0.024Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6472.8%
Applied rewrites72.8%
if 0.024 < k Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
Applied rewrites82.9%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (cos (fabs k)))
(t_2 (* t_1 l))
(t_3 (/ l (* (fabs k) (fabs k))))
(t_4 (cos (+ (fabs k) (fabs k)))))
(if (<= (fabs k) 0.024)
(* t_2 (* t_3 (/ 2.0 (* (pow (fabs k) 2.0) t))))
(if (<= (fabs k) 8.5e+150)
(* t_2 (* t_3 (/ -2.0 (* (- (* t_4 0.5) 0.5) t))))
(*
(/ t_1 (* (* (* (fabs k) t) (fabs k)) (- 0.5 (* 0.5 t_4))))
(* (* l l) 2.0))))))double code(double t, double l, double k) {
double t_1 = cos(fabs(k));
double t_2 = t_1 * l;
double t_3 = l / (fabs(k) * fabs(k));
double t_4 = cos((fabs(k) + fabs(k)));
double tmp;
if (fabs(k) <= 0.024) {
tmp = t_2 * (t_3 * (2.0 / (pow(fabs(k), 2.0) * t)));
} else if (fabs(k) <= 8.5e+150) {
tmp = t_2 * (t_3 * (-2.0 / (((t_4 * 0.5) - 0.5) * t)));
} else {
tmp = (t_1 / (((fabs(k) * t) * fabs(k)) * (0.5 - (0.5 * t_4)))) * ((l * l) * 2.0);
}
return tmp;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = cos(abs(k))
t_2 = t_1 * l
t_3 = l / (abs(k) * abs(k))
t_4 = cos((abs(k) + abs(k)))
if (abs(k) <= 0.024d0) then
tmp = t_2 * (t_3 * (2.0d0 / ((abs(k) ** 2.0d0) * t)))
else if (abs(k) <= 8.5d+150) then
tmp = t_2 * (t_3 * ((-2.0d0) / (((t_4 * 0.5d0) - 0.5d0) * t)))
else
tmp = (t_1 / (((abs(k) * t) * abs(k)) * (0.5d0 - (0.5d0 * t_4)))) * ((l * l) * 2.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(Math.abs(k));
double t_2 = t_1 * l;
double t_3 = l / (Math.abs(k) * Math.abs(k));
double t_4 = Math.cos((Math.abs(k) + Math.abs(k)));
double tmp;
if (Math.abs(k) <= 0.024) {
tmp = t_2 * (t_3 * (2.0 / (Math.pow(Math.abs(k), 2.0) * t)));
} else if (Math.abs(k) <= 8.5e+150) {
tmp = t_2 * (t_3 * (-2.0 / (((t_4 * 0.5) - 0.5) * t)));
} else {
tmp = (t_1 / (((Math.abs(k) * t) * Math.abs(k)) * (0.5 - (0.5 * t_4)))) * ((l * l) * 2.0);
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(math.fabs(k)) t_2 = t_1 * l t_3 = l / (math.fabs(k) * math.fabs(k)) t_4 = math.cos((math.fabs(k) + math.fabs(k))) tmp = 0 if math.fabs(k) <= 0.024: tmp = t_2 * (t_3 * (2.0 / (math.pow(math.fabs(k), 2.0) * t))) elif math.fabs(k) <= 8.5e+150: tmp = t_2 * (t_3 * (-2.0 / (((t_4 * 0.5) - 0.5) * t))) else: tmp = (t_1 / (((math.fabs(k) * t) * math.fabs(k)) * (0.5 - (0.5 * t_4)))) * ((l * l) * 2.0) return tmp
function code(t, l, k) t_1 = cos(abs(k)) t_2 = Float64(t_1 * l) t_3 = Float64(l / Float64(abs(k) * abs(k))) t_4 = cos(Float64(abs(k) + abs(k))) tmp = 0.0 if (abs(k) <= 0.024) tmp = Float64(t_2 * Float64(t_3 * Float64(2.0 / Float64((abs(k) ^ 2.0) * t)))); elseif (abs(k) <= 8.5e+150) tmp = Float64(t_2 * Float64(t_3 * Float64(-2.0 / Float64(Float64(Float64(t_4 * 0.5) - 0.5) * t)))); else tmp = Float64(Float64(t_1 / Float64(Float64(Float64(abs(k) * t) * abs(k)) * Float64(0.5 - Float64(0.5 * t_4)))) * Float64(Float64(l * l) * 2.0)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(abs(k)); t_2 = t_1 * l; t_3 = l / (abs(k) * abs(k)); t_4 = cos((abs(k) + abs(k))); tmp = 0.0; if (abs(k) <= 0.024) tmp = t_2 * (t_3 * (2.0 / ((abs(k) ^ 2.0) * t))); elseif (abs(k) <= 8.5e+150) tmp = t_2 * (t_3 * (-2.0 / (((t_4 * 0.5) - 0.5) * t))); else tmp = (t_1 / (((abs(k) * t) * abs(k)) * (0.5 - (0.5 * t_4)))) * ((l * l) * 2.0); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * l), $MachinePrecision]}, Block[{t$95$3 = N[(l / N[(N[Abs[k], $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 0.024], N[(t$95$2 * N[(t$95$3 * N[(2.0 / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[k], $MachinePrecision], 8.5e+150], N[(t$95$2 * N[(t$95$3 * N[(-2.0 / N[(N[(N[(t$95$4 * 0.5), $MachinePrecision] - 0.5), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(N[(N[(N[Abs[k], $MachinePrecision] * t), $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision] * N[(0.5 - N[(0.5 * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := \cos \left(\left|k\right|\right)\\
t_2 := t\_1 \cdot \ell\\
t_3 := \frac{\ell}{\left|k\right| \cdot \left|k\right|}\\
t_4 := \cos \left(\left|k\right| + \left|k\right|\right)\\
\mathbf{if}\;\left|k\right| \leq 0.024:\\
\;\;\;\;t\_2 \cdot \left(t\_3 \cdot \frac{2}{{\left(\left|k\right|\right)}^{2} \cdot t}\right)\\
\mathbf{elif}\;\left|k\right| \leq 8.5 \cdot 10^{+150}:\\
\;\;\;\;t\_2 \cdot \left(t\_3 \cdot \frac{-2}{\left(t\_4 \cdot 0.5 - 0.5\right) \cdot t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\left(\left(\left|k\right| \cdot t\right) \cdot \left|k\right|\right) \cdot \left(0.5 - 0.5 \cdot t\_4\right)} \cdot \left(\left(\ell \cdot \ell\right) \cdot 2\right)\\
\end{array}
if k < 0.024Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6472.8%
Applied rewrites72.8%
if 0.024 < k < 8.4999999999999999e150Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
if 8.4999999999999999e150 < k Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
count-2-revN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-outN/A
count-2-revN/A
lower-*.f64N/A
Applied rewrites67.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6470.1%
Applied rewrites70.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (cos (fabs k)))
(t_2 (* t_1 l))
(t_3 (- 0.5 (* 0.5 (cos (+ (fabs k) (fabs k))))))
(t_4 (* (fabs k) (fabs k))))
(if (<= (fabs k) 0.024)
(* t_2 (* (/ l t_4) (/ 2.0 (* (pow (fabs k) 2.0) t))))
(if (<= (fabs k) 7e+150)
(* t_2 (/ (/ (+ l l) (* t_3 t)) t_4))
(*
(/ t_1 (* (* (* (fabs k) t) (fabs k)) t_3))
(* (* l l) 2.0))))))double code(double t, double l, double k) {
double t_1 = cos(fabs(k));
double t_2 = t_1 * l;
double t_3 = 0.5 - (0.5 * cos((fabs(k) + fabs(k))));
double t_4 = fabs(k) * fabs(k);
double tmp;
if (fabs(k) <= 0.024) {
tmp = t_2 * ((l / t_4) * (2.0 / (pow(fabs(k), 2.0) * t)));
} else if (fabs(k) <= 7e+150) {
tmp = t_2 * (((l + l) / (t_3 * t)) / t_4);
} else {
tmp = (t_1 / (((fabs(k) * t) * fabs(k)) * t_3)) * ((l * l) * 2.0);
}
return tmp;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = cos(abs(k))
t_2 = t_1 * l
t_3 = 0.5d0 - (0.5d0 * cos((abs(k) + abs(k))))
t_4 = abs(k) * abs(k)
if (abs(k) <= 0.024d0) then
tmp = t_2 * ((l / t_4) * (2.0d0 / ((abs(k) ** 2.0d0) * t)))
else if (abs(k) <= 7d+150) then
tmp = t_2 * (((l + l) / (t_3 * t)) / t_4)
else
tmp = (t_1 / (((abs(k) * t) * abs(k)) * t_3)) * ((l * l) * 2.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(Math.abs(k));
double t_2 = t_1 * l;
double t_3 = 0.5 - (0.5 * Math.cos((Math.abs(k) + Math.abs(k))));
double t_4 = Math.abs(k) * Math.abs(k);
double tmp;
if (Math.abs(k) <= 0.024) {
tmp = t_2 * ((l / t_4) * (2.0 / (Math.pow(Math.abs(k), 2.0) * t)));
} else if (Math.abs(k) <= 7e+150) {
tmp = t_2 * (((l + l) / (t_3 * t)) / t_4);
} else {
tmp = (t_1 / (((Math.abs(k) * t) * Math.abs(k)) * t_3)) * ((l * l) * 2.0);
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(math.fabs(k)) t_2 = t_1 * l t_3 = 0.5 - (0.5 * math.cos((math.fabs(k) + math.fabs(k)))) t_4 = math.fabs(k) * math.fabs(k) tmp = 0 if math.fabs(k) <= 0.024: tmp = t_2 * ((l / t_4) * (2.0 / (math.pow(math.fabs(k), 2.0) * t))) elif math.fabs(k) <= 7e+150: tmp = t_2 * (((l + l) / (t_3 * t)) / t_4) else: tmp = (t_1 / (((math.fabs(k) * t) * math.fabs(k)) * t_3)) * ((l * l) * 2.0) return tmp
function code(t, l, k) t_1 = cos(abs(k)) t_2 = Float64(t_1 * l) t_3 = Float64(0.5 - Float64(0.5 * cos(Float64(abs(k) + abs(k))))) t_4 = Float64(abs(k) * abs(k)) tmp = 0.0 if (abs(k) <= 0.024) tmp = Float64(t_2 * Float64(Float64(l / t_4) * Float64(2.0 / Float64((abs(k) ^ 2.0) * t)))); elseif (abs(k) <= 7e+150) tmp = Float64(t_2 * Float64(Float64(Float64(l + l) / Float64(t_3 * t)) / t_4)); else tmp = Float64(Float64(t_1 / Float64(Float64(Float64(abs(k) * t) * abs(k)) * t_3)) * Float64(Float64(l * l) * 2.0)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(abs(k)); t_2 = t_1 * l; t_3 = 0.5 - (0.5 * cos((abs(k) + abs(k)))); t_4 = abs(k) * abs(k); tmp = 0.0; if (abs(k) <= 0.024) tmp = t_2 * ((l / t_4) * (2.0 / ((abs(k) ^ 2.0) * t))); elseif (abs(k) <= 7e+150) tmp = t_2 * (((l + l) / (t_3 * t)) / t_4); else tmp = (t_1 / (((abs(k) * t) * abs(k)) * t_3)) * ((l * l) * 2.0); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * l), $MachinePrecision]}, Block[{t$95$3 = N[(0.5 - N[(0.5 * N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[k], $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 0.024], N[(t$95$2 * N[(N[(l / t$95$4), $MachinePrecision] * N[(2.0 / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[k], $MachinePrecision], 7e+150], N[(t$95$2 * N[(N[(N[(l + l), $MachinePrecision] / N[(t$95$3 * t), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(N[(N[(N[Abs[k], $MachinePrecision] * t), $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := \cos \left(\left|k\right|\right)\\
t_2 := t\_1 \cdot \ell\\
t_3 := 0.5 - 0.5 \cdot \cos \left(\left|k\right| + \left|k\right|\right)\\
t_4 := \left|k\right| \cdot \left|k\right|\\
\mathbf{if}\;\left|k\right| \leq 0.024:\\
\;\;\;\;t\_2 \cdot \left(\frac{\ell}{t\_4} \cdot \frac{2}{{\left(\left|k\right|\right)}^{2} \cdot t}\right)\\
\mathbf{elif}\;\left|k\right| \leq 7 \cdot 10^{+150}:\\
\;\;\;\;t\_2 \cdot \frac{\frac{\ell + \ell}{t\_3 \cdot t}}{t\_4}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\left(\left(\left|k\right| \cdot t\right) \cdot \left|k\right|\right) \cdot t\_3} \cdot \left(\left(\ell \cdot \ell\right) \cdot 2\right)\\
\end{array}
if k < 0.024Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6472.8%
Applied rewrites72.8%
if 0.024 < k < 6.9999999999999997e150Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites76.6%
if 6.9999999999999997e150 < k Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
count-2-revN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-outN/A
count-2-revN/A
lower-*.f64N/A
Applied rewrites67.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6470.1%
Applied rewrites70.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (cos (fabs k)))
(t_2 (/ l (* (fabs k) (fabs k))))
(t_3 (cos (+ (fabs k) (fabs k)))))
(if (<= (fabs k) 4.2e-7)
(* (* t_1 l) (* t_2 (/ 2.0 (* (pow (fabs k) 2.0) t))))
(if (<= (fabs k) 8.5e+150)
(* t_1 (/ (* t_2 (+ l l)) (* (- 0.5 (* t_3 0.5)) t)))
(*
(/ t_1 (* (* (* (fabs k) t) (fabs k)) (- 0.5 (* 0.5 t_3))))
(* (* l l) 2.0))))))double code(double t, double l, double k) {
double t_1 = cos(fabs(k));
double t_2 = l / (fabs(k) * fabs(k));
double t_3 = cos((fabs(k) + fabs(k)));
double tmp;
if (fabs(k) <= 4.2e-7) {
tmp = (t_1 * l) * (t_2 * (2.0 / (pow(fabs(k), 2.0) * t)));
} else if (fabs(k) <= 8.5e+150) {
tmp = t_1 * ((t_2 * (l + l)) / ((0.5 - (t_3 * 0.5)) * t));
} else {
tmp = (t_1 / (((fabs(k) * t) * fabs(k)) * (0.5 - (0.5 * t_3)))) * ((l * l) * 2.0);
}
return tmp;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = cos(abs(k))
t_2 = l / (abs(k) * abs(k))
t_3 = cos((abs(k) + abs(k)))
if (abs(k) <= 4.2d-7) then
tmp = (t_1 * l) * (t_2 * (2.0d0 / ((abs(k) ** 2.0d0) * t)))
else if (abs(k) <= 8.5d+150) then
tmp = t_1 * ((t_2 * (l + l)) / ((0.5d0 - (t_3 * 0.5d0)) * t))
else
tmp = (t_1 / (((abs(k) * t) * abs(k)) * (0.5d0 - (0.5d0 * t_3)))) * ((l * l) * 2.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(Math.abs(k));
double t_2 = l / (Math.abs(k) * Math.abs(k));
double t_3 = Math.cos((Math.abs(k) + Math.abs(k)));
double tmp;
if (Math.abs(k) <= 4.2e-7) {
tmp = (t_1 * l) * (t_2 * (2.0 / (Math.pow(Math.abs(k), 2.0) * t)));
} else if (Math.abs(k) <= 8.5e+150) {
tmp = t_1 * ((t_2 * (l + l)) / ((0.5 - (t_3 * 0.5)) * t));
} else {
tmp = (t_1 / (((Math.abs(k) * t) * Math.abs(k)) * (0.5 - (0.5 * t_3)))) * ((l * l) * 2.0);
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(math.fabs(k)) t_2 = l / (math.fabs(k) * math.fabs(k)) t_3 = math.cos((math.fabs(k) + math.fabs(k))) tmp = 0 if math.fabs(k) <= 4.2e-7: tmp = (t_1 * l) * (t_2 * (2.0 / (math.pow(math.fabs(k), 2.0) * t))) elif math.fabs(k) <= 8.5e+150: tmp = t_1 * ((t_2 * (l + l)) / ((0.5 - (t_3 * 0.5)) * t)) else: tmp = (t_1 / (((math.fabs(k) * t) * math.fabs(k)) * (0.5 - (0.5 * t_3)))) * ((l * l) * 2.0) return tmp
function code(t, l, k) t_1 = cos(abs(k)) t_2 = Float64(l / Float64(abs(k) * abs(k))) t_3 = cos(Float64(abs(k) + abs(k))) tmp = 0.0 if (abs(k) <= 4.2e-7) tmp = Float64(Float64(t_1 * l) * Float64(t_2 * Float64(2.0 / Float64((abs(k) ^ 2.0) * t)))); elseif (abs(k) <= 8.5e+150) tmp = Float64(t_1 * Float64(Float64(t_2 * Float64(l + l)) / Float64(Float64(0.5 - Float64(t_3 * 0.5)) * t))); else tmp = Float64(Float64(t_1 / Float64(Float64(Float64(abs(k) * t) * abs(k)) * Float64(0.5 - Float64(0.5 * t_3)))) * Float64(Float64(l * l) * 2.0)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(abs(k)); t_2 = l / (abs(k) * abs(k)); t_3 = cos((abs(k) + abs(k))); tmp = 0.0; if (abs(k) <= 4.2e-7) tmp = (t_1 * l) * (t_2 * (2.0 / ((abs(k) ^ 2.0) * t))); elseif (abs(k) <= 8.5e+150) tmp = t_1 * ((t_2 * (l + l)) / ((0.5 - (t_3 * 0.5)) * t)); else tmp = (t_1 / (((abs(k) * t) * abs(k)) * (0.5 - (0.5 * t_3)))) * ((l * l) * 2.0); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(l / N[(N[Abs[k], $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 4.2e-7], N[(N[(t$95$1 * l), $MachinePrecision] * N[(t$95$2 * N[(2.0 / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[k], $MachinePrecision], 8.5e+150], N[(t$95$1 * N[(N[(t$95$2 * N[(l + l), $MachinePrecision]), $MachinePrecision] / N[(N[(0.5 - N[(t$95$3 * 0.5), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(N[(N[(N[Abs[k], $MachinePrecision] * t), $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision] * N[(0.5 - N[(0.5 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \cos \left(\left|k\right|\right)\\
t_2 := \frac{\ell}{\left|k\right| \cdot \left|k\right|}\\
t_3 := \cos \left(\left|k\right| + \left|k\right|\right)\\
\mathbf{if}\;\left|k\right| \leq 4.2 \cdot 10^{-7}:\\
\;\;\;\;\left(t\_1 \cdot \ell\right) \cdot \left(t\_2 \cdot \frac{2}{{\left(\left|k\right|\right)}^{2} \cdot t}\right)\\
\mathbf{elif}\;\left|k\right| \leq 8.5 \cdot 10^{+150}:\\
\;\;\;\;t\_1 \cdot \frac{t\_2 \cdot \left(\ell + \ell\right)}{\left(0.5 - t\_3 \cdot 0.5\right) \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\left(\left(\left|k\right| \cdot t\right) \cdot \left|k\right|\right) \cdot \left(0.5 - 0.5 \cdot t\_3\right)} \cdot \left(\left(\ell \cdot \ell\right) \cdot 2\right)\\
\end{array}
if k < 4.2e-7Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6472.8%
Applied rewrites72.8%
if 4.2e-7 < k < 8.4999999999999999e150Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6475.1%
Applied rewrites75.1%
if 8.4999999999999999e150 < k Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
count-2-revN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-outN/A
count-2-revN/A
lower-*.f64N/A
Applied rewrites67.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6470.1%
Applied rewrites70.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (cos (fabs k)))
(t_2 (* t_1 l))
(t_3 (* (fabs k) (fabs k)))
(t_4 (* 0.5 (cos (+ (fabs k) (fabs k))))))
(if (<= (fabs k) 0.024)
(* t_2 (* (/ l t_3) (/ 2.0 (* (pow (fabs k) 2.0) t))))
(if (<= (fabs k) 2e+150)
(* t_2 (* l (/ -2.0 (* (* t_3 t) (- t_4 0.5)))))
(*
(/ t_1 (* (* (* (fabs k) t) (fabs k)) (- 0.5 t_4)))
(* (* l l) 2.0))))))double code(double t, double l, double k) {
double t_1 = cos(fabs(k));
double t_2 = t_1 * l;
double t_3 = fabs(k) * fabs(k);
double t_4 = 0.5 * cos((fabs(k) + fabs(k)));
double tmp;
if (fabs(k) <= 0.024) {
tmp = t_2 * ((l / t_3) * (2.0 / (pow(fabs(k), 2.0) * t)));
} else if (fabs(k) <= 2e+150) {
tmp = t_2 * (l * (-2.0 / ((t_3 * t) * (t_4 - 0.5))));
} else {
tmp = (t_1 / (((fabs(k) * t) * fabs(k)) * (0.5 - t_4))) * ((l * l) * 2.0);
}
return tmp;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = cos(abs(k))
t_2 = t_1 * l
t_3 = abs(k) * abs(k)
t_4 = 0.5d0 * cos((abs(k) + abs(k)))
if (abs(k) <= 0.024d0) then
tmp = t_2 * ((l / t_3) * (2.0d0 / ((abs(k) ** 2.0d0) * t)))
else if (abs(k) <= 2d+150) then
tmp = t_2 * (l * ((-2.0d0) / ((t_3 * t) * (t_4 - 0.5d0))))
else
tmp = (t_1 / (((abs(k) * t) * abs(k)) * (0.5d0 - t_4))) * ((l * l) * 2.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(Math.abs(k));
double t_2 = t_1 * l;
double t_3 = Math.abs(k) * Math.abs(k);
double t_4 = 0.5 * Math.cos((Math.abs(k) + Math.abs(k)));
double tmp;
if (Math.abs(k) <= 0.024) {
tmp = t_2 * ((l / t_3) * (2.0 / (Math.pow(Math.abs(k), 2.0) * t)));
} else if (Math.abs(k) <= 2e+150) {
tmp = t_2 * (l * (-2.0 / ((t_3 * t) * (t_4 - 0.5))));
} else {
tmp = (t_1 / (((Math.abs(k) * t) * Math.abs(k)) * (0.5 - t_4))) * ((l * l) * 2.0);
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(math.fabs(k)) t_2 = t_1 * l t_3 = math.fabs(k) * math.fabs(k) t_4 = 0.5 * math.cos((math.fabs(k) + math.fabs(k))) tmp = 0 if math.fabs(k) <= 0.024: tmp = t_2 * ((l / t_3) * (2.0 / (math.pow(math.fabs(k), 2.0) * t))) elif math.fabs(k) <= 2e+150: tmp = t_2 * (l * (-2.0 / ((t_3 * t) * (t_4 - 0.5)))) else: tmp = (t_1 / (((math.fabs(k) * t) * math.fabs(k)) * (0.5 - t_4))) * ((l * l) * 2.0) return tmp
function code(t, l, k) t_1 = cos(abs(k)) t_2 = Float64(t_1 * l) t_3 = Float64(abs(k) * abs(k)) t_4 = Float64(0.5 * cos(Float64(abs(k) + abs(k)))) tmp = 0.0 if (abs(k) <= 0.024) tmp = Float64(t_2 * Float64(Float64(l / t_3) * Float64(2.0 / Float64((abs(k) ^ 2.0) * t)))); elseif (abs(k) <= 2e+150) tmp = Float64(t_2 * Float64(l * Float64(-2.0 / Float64(Float64(t_3 * t) * Float64(t_4 - 0.5))))); else tmp = Float64(Float64(t_1 / Float64(Float64(Float64(abs(k) * t) * abs(k)) * Float64(0.5 - t_4))) * Float64(Float64(l * l) * 2.0)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(abs(k)); t_2 = t_1 * l; t_3 = abs(k) * abs(k); t_4 = 0.5 * cos((abs(k) + abs(k))); tmp = 0.0; if (abs(k) <= 0.024) tmp = t_2 * ((l / t_3) * (2.0 / ((abs(k) ^ 2.0) * t))); elseif (abs(k) <= 2e+150) tmp = t_2 * (l * (-2.0 / ((t_3 * t) * (t_4 - 0.5)))); else tmp = (t_1 / (((abs(k) * t) * abs(k)) * (0.5 - t_4))) * ((l * l) * 2.0); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * l), $MachinePrecision]}, Block[{t$95$3 = N[(N[Abs[k], $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(0.5 * N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 0.024], N[(t$95$2 * N[(N[(l / t$95$3), $MachinePrecision] * N[(2.0 / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[k], $MachinePrecision], 2e+150], N[(t$95$2 * N[(l * N[(-2.0 / N[(N[(t$95$3 * t), $MachinePrecision] * N[(t$95$4 - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(N[(N[(N[Abs[k], $MachinePrecision] * t), $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision] * N[(0.5 - t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := \cos \left(\left|k\right|\right)\\
t_2 := t\_1 \cdot \ell\\
t_3 := \left|k\right| \cdot \left|k\right|\\
t_4 := 0.5 \cdot \cos \left(\left|k\right| + \left|k\right|\right)\\
\mathbf{if}\;\left|k\right| \leq 0.024:\\
\;\;\;\;t\_2 \cdot \left(\frac{\ell}{t\_3} \cdot \frac{2}{{\left(\left|k\right|\right)}^{2} \cdot t}\right)\\
\mathbf{elif}\;\left|k\right| \leq 2 \cdot 10^{+150}:\\
\;\;\;\;t\_2 \cdot \left(\ell \cdot \frac{-2}{\left(t\_3 \cdot t\right) \cdot \left(t\_4 - 0.5\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\left(\left(\left|k\right| \cdot t\right) \cdot \left|k\right|\right) \cdot \left(0.5 - t\_4\right)} \cdot \left(\left(\ell \cdot \ell\right) \cdot 2\right)\\
\end{array}
if k < 0.024Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6472.8%
Applied rewrites72.8%
if 0.024 < k < 2e150Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6439.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6439.5%
Applied rewrites39.5%
if 2e150 < k Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
count-2-revN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-outN/A
count-2-revN/A
lower-*.f64N/A
Applied rewrites67.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6470.1%
Applied rewrites70.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (cos (+ (fabs k) (fabs k))))
(t_2 (cos (fabs k)))
(t_3 (* t_2 l))
(t_4 (* (fabs k) (fabs k))))
(if (<= (fabs k) 0.024)
(* t_3 (* (/ l t_4) (/ 2.0 (* (pow (fabs k) 2.0) t))))
(if (<= (fabs k) 2e+150)
(* t_3 (* l (/ -2.0 (* (* t_4 t) (- (* 0.5 t_1) 0.5)))))
(*
(/ t_2 (* (fabs k) (* (fabs k) (* (- 0.5 (* t_1 0.5)) t))))
(* (* l l) 2.0))))))double code(double t, double l, double k) {
double t_1 = cos((fabs(k) + fabs(k)));
double t_2 = cos(fabs(k));
double t_3 = t_2 * l;
double t_4 = fabs(k) * fabs(k);
double tmp;
if (fabs(k) <= 0.024) {
tmp = t_3 * ((l / t_4) * (2.0 / (pow(fabs(k), 2.0) * t)));
} else if (fabs(k) <= 2e+150) {
tmp = t_3 * (l * (-2.0 / ((t_4 * t) * ((0.5 * t_1) - 0.5))));
} else {
tmp = (t_2 / (fabs(k) * (fabs(k) * ((0.5 - (t_1 * 0.5)) * t)))) * ((l * l) * 2.0);
}
return tmp;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = cos((abs(k) + abs(k)))
t_2 = cos(abs(k))
t_3 = t_2 * l
t_4 = abs(k) * abs(k)
if (abs(k) <= 0.024d0) then
tmp = t_3 * ((l / t_4) * (2.0d0 / ((abs(k) ** 2.0d0) * t)))
else if (abs(k) <= 2d+150) then
tmp = t_3 * (l * ((-2.0d0) / ((t_4 * t) * ((0.5d0 * t_1) - 0.5d0))))
else
tmp = (t_2 / (abs(k) * (abs(k) * ((0.5d0 - (t_1 * 0.5d0)) * t)))) * ((l * l) * 2.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos((Math.abs(k) + Math.abs(k)));
double t_2 = Math.cos(Math.abs(k));
double t_3 = t_2 * l;
double t_4 = Math.abs(k) * Math.abs(k);
double tmp;
if (Math.abs(k) <= 0.024) {
tmp = t_3 * ((l / t_4) * (2.0 / (Math.pow(Math.abs(k), 2.0) * t)));
} else if (Math.abs(k) <= 2e+150) {
tmp = t_3 * (l * (-2.0 / ((t_4 * t) * ((0.5 * t_1) - 0.5))));
} else {
tmp = (t_2 / (Math.abs(k) * (Math.abs(k) * ((0.5 - (t_1 * 0.5)) * t)))) * ((l * l) * 2.0);
}
return tmp;
}
def code(t, l, k): t_1 = math.cos((math.fabs(k) + math.fabs(k))) t_2 = math.cos(math.fabs(k)) t_3 = t_2 * l t_4 = math.fabs(k) * math.fabs(k) tmp = 0 if math.fabs(k) <= 0.024: tmp = t_3 * ((l / t_4) * (2.0 / (math.pow(math.fabs(k), 2.0) * t))) elif math.fabs(k) <= 2e+150: tmp = t_3 * (l * (-2.0 / ((t_4 * t) * ((0.5 * t_1) - 0.5)))) else: tmp = (t_2 / (math.fabs(k) * (math.fabs(k) * ((0.5 - (t_1 * 0.5)) * t)))) * ((l * l) * 2.0) return tmp
function code(t, l, k) t_1 = cos(Float64(abs(k) + abs(k))) t_2 = cos(abs(k)) t_3 = Float64(t_2 * l) t_4 = Float64(abs(k) * abs(k)) tmp = 0.0 if (abs(k) <= 0.024) tmp = Float64(t_3 * Float64(Float64(l / t_4) * Float64(2.0 / Float64((abs(k) ^ 2.0) * t)))); elseif (abs(k) <= 2e+150) tmp = Float64(t_3 * Float64(l * Float64(-2.0 / Float64(Float64(t_4 * t) * Float64(Float64(0.5 * t_1) - 0.5))))); else tmp = Float64(Float64(t_2 / Float64(abs(k) * Float64(abs(k) * Float64(Float64(0.5 - Float64(t_1 * 0.5)) * t)))) * Float64(Float64(l * l) * 2.0)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos((abs(k) + abs(k))); t_2 = cos(abs(k)); t_3 = t_2 * l; t_4 = abs(k) * abs(k); tmp = 0.0; if (abs(k) <= 0.024) tmp = t_3 * ((l / t_4) * (2.0 / ((abs(k) ^ 2.0) * t))); elseif (abs(k) <= 2e+150) tmp = t_3 * (l * (-2.0 / ((t_4 * t) * ((0.5 * t_1) - 0.5)))); else tmp = (t_2 / (abs(k) * (abs(k) * ((0.5 - (t_1 * 0.5)) * t)))) * ((l * l) * 2.0); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * l), $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[k], $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 0.024], N[(t$95$3 * N[(N[(l / t$95$4), $MachinePrecision] * N[(2.0 / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[k], $MachinePrecision], 2e+150], N[(t$95$3 * N[(l * N[(-2.0 / N[(N[(t$95$4 * t), $MachinePrecision] * N[(N[(0.5 * t$95$1), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 / N[(N[Abs[k], $MachinePrecision] * N[(N[Abs[k], $MachinePrecision] * N[(N[(0.5 - N[(t$95$1 * 0.5), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := \cos \left(\left|k\right| + \left|k\right|\right)\\
t_2 := \cos \left(\left|k\right|\right)\\
t_3 := t\_2 \cdot \ell\\
t_4 := \left|k\right| \cdot \left|k\right|\\
\mathbf{if}\;\left|k\right| \leq 0.024:\\
\;\;\;\;t\_3 \cdot \left(\frac{\ell}{t\_4} \cdot \frac{2}{{\left(\left|k\right|\right)}^{2} \cdot t}\right)\\
\mathbf{elif}\;\left|k\right| \leq 2 \cdot 10^{+150}:\\
\;\;\;\;t\_3 \cdot \left(\ell \cdot \frac{-2}{\left(t\_4 \cdot t\right) \cdot \left(0.5 \cdot t\_1 - 0.5\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_2}{\left|k\right| \cdot \left(\left|k\right| \cdot \left(\left(0.5 - t\_1 \cdot 0.5\right) \cdot t\right)\right)} \cdot \left(\left(\ell \cdot \ell\right) \cdot 2\right)\\
\end{array}
if k < 0.024Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6472.8%
Applied rewrites72.8%
if 0.024 < k < 2e150Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6439.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6439.5%
Applied rewrites39.5%
if 2e150 < k Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
count-2-revN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-outN/A
count-2-revN/A
lower-*.f64N/A
Applied rewrites67.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6470.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.1%
Applied rewrites70.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (cos (fabs k)) l)) (t_2 (* (fabs k) (fabs k))))
(if (<= (fabs k) 0.024)
(* t_1 (* (/ l t_2) (/ 2.0 (* (pow (fabs k) 2.0) t))))
(*
t_1
(*
l
(/
-2.0
(* (* t_2 t) (- (* 0.5 (cos (+ (fabs k) (fabs k)))) 0.5))))))))double code(double t, double l, double k) {
double t_1 = cos(fabs(k)) * l;
double t_2 = fabs(k) * fabs(k);
double tmp;
if (fabs(k) <= 0.024) {
tmp = t_1 * ((l / t_2) * (2.0 / (pow(fabs(k), 2.0) * t)));
} else {
tmp = t_1 * (l * (-2.0 / ((t_2 * t) * ((0.5 * cos((fabs(k) + fabs(k)))) - 0.5))));
}
return tmp;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = cos(abs(k)) * l
t_2 = abs(k) * abs(k)
if (abs(k) <= 0.024d0) then
tmp = t_1 * ((l / t_2) * (2.0d0 / ((abs(k) ** 2.0d0) * t)))
else
tmp = t_1 * (l * ((-2.0d0) / ((t_2 * t) * ((0.5d0 * cos((abs(k) + abs(k)))) - 0.5d0))))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(Math.abs(k)) * l;
double t_2 = Math.abs(k) * Math.abs(k);
double tmp;
if (Math.abs(k) <= 0.024) {
tmp = t_1 * ((l / t_2) * (2.0 / (Math.pow(Math.abs(k), 2.0) * t)));
} else {
tmp = t_1 * (l * (-2.0 / ((t_2 * t) * ((0.5 * Math.cos((Math.abs(k) + Math.abs(k)))) - 0.5))));
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(math.fabs(k)) * l t_2 = math.fabs(k) * math.fabs(k) tmp = 0 if math.fabs(k) <= 0.024: tmp = t_1 * ((l / t_2) * (2.0 / (math.pow(math.fabs(k), 2.0) * t))) else: tmp = t_1 * (l * (-2.0 / ((t_2 * t) * ((0.5 * math.cos((math.fabs(k) + math.fabs(k)))) - 0.5)))) return tmp
function code(t, l, k) t_1 = Float64(cos(abs(k)) * l) t_2 = Float64(abs(k) * abs(k)) tmp = 0.0 if (abs(k) <= 0.024) tmp = Float64(t_1 * Float64(Float64(l / t_2) * Float64(2.0 / Float64((abs(k) ^ 2.0) * t)))); else tmp = Float64(t_1 * Float64(l * Float64(-2.0 / Float64(Float64(t_2 * t) * Float64(Float64(0.5 * cos(Float64(abs(k) + abs(k)))) - 0.5))))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(abs(k)) * l; t_2 = abs(k) * abs(k); tmp = 0.0; if (abs(k) <= 0.024) tmp = t_1 * ((l / t_2) * (2.0 / ((abs(k) ^ 2.0) * t))); else tmp = t_1 * (l * (-2.0 / ((t_2 * t) * ((0.5 * cos((abs(k) + abs(k)))) - 0.5)))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[k], $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 0.024], N[(t$95$1 * N[(N[(l / t$95$2), $MachinePrecision] * N[(2.0 / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(l * N[(-2.0 / N[(N[(t$95$2 * t), $MachinePrecision] * N[(N[(0.5 * N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \cos \left(\left|k\right|\right) \cdot \ell\\
t_2 := \left|k\right| \cdot \left|k\right|\\
\mathbf{if}\;\left|k\right| \leq 0.024:\\
\;\;\;\;t\_1 \cdot \left(\frac{\ell}{t\_2} \cdot \frac{2}{{\left(\left|k\right|\right)}^{2} \cdot t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\ell \cdot \frac{-2}{\left(t\_2 \cdot t\right) \cdot \left(0.5 \cdot \cos \left(\left|k\right| + \left|k\right|\right) - 0.5\right)}\right)\\
\end{array}
if k < 0.024Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6472.8%
Applied rewrites72.8%
if 0.024 < k Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6439.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6439.5%
Applied rewrites39.5%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (cos (fabs k))) (t_2 (* (fabs k) (fabs k))))
(if (<= (fabs k) 0.024)
(* (* t_1 l) (* (/ l t_2) (/ 2.0 (* (pow (fabs k) 2.0) t))))
(*
(*
(/
(+ l l)
(* (* (- 0.5 (* 0.5 (cos (+ (fabs k) (fabs k))))) t) t_2))
l)
t_1))))double code(double t, double l, double k) {
double t_1 = cos(fabs(k));
double t_2 = fabs(k) * fabs(k);
double tmp;
if (fabs(k) <= 0.024) {
tmp = (t_1 * l) * ((l / t_2) * (2.0 / (pow(fabs(k), 2.0) * t)));
} else {
tmp = (((l + l) / (((0.5 - (0.5 * cos((fabs(k) + fabs(k))))) * t) * t_2)) * l) * t_1;
}
return tmp;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = cos(abs(k))
t_2 = abs(k) * abs(k)
if (abs(k) <= 0.024d0) then
tmp = (t_1 * l) * ((l / t_2) * (2.0d0 / ((abs(k) ** 2.0d0) * t)))
else
tmp = (((l + l) / (((0.5d0 - (0.5d0 * cos((abs(k) + abs(k))))) * t) * t_2)) * l) * t_1
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(Math.abs(k));
double t_2 = Math.abs(k) * Math.abs(k);
double tmp;
if (Math.abs(k) <= 0.024) {
tmp = (t_1 * l) * ((l / t_2) * (2.0 / (Math.pow(Math.abs(k), 2.0) * t)));
} else {
tmp = (((l + l) / (((0.5 - (0.5 * Math.cos((Math.abs(k) + Math.abs(k))))) * t) * t_2)) * l) * t_1;
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(math.fabs(k)) t_2 = math.fabs(k) * math.fabs(k) tmp = 0 if math.fabs(k) <= 0.024: tmp = (t_1 * l) * ((l / t_2) * (2.0 / (math.pow(math.fabs(k), 2.0) * t))) else: tmp = (((l + l) / (((0.5 - (0.5 * math.cos((math.fabs(k) + math.fabs(k))))) * t) * t_2)) * l) * t_1 return tmp
function code(t, l, k) t_1 = cos(abs(k)) t_2 = Float64(abs(k) * abs(k)) tmp = 0.0 if (abs(k) <= 0.024) tmp = Float64(Float64(t_1 * l) * Float64(Float64(l / t_2) * Float64(2.0 / Float64((abs(k) ^ 2.0) * t)))); else tmp = Float64(Float64(Float64(Float64(l + l) / Float64(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(abs(k) + abs(k))))) * t) * t_2)) * l) * t_1); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(abs(k)); t_2 = abs(k) * abs(k); tmp = 0.0; if (abs(k) <= 0.024) tmp = (t_1 * l) * ((l / t_2) * (2.0 / ((abs(k) ^ 2.0) * t))); else tmp = (((l + l) / (((0.5 - (0.5 * cos((abs(k) + abs(k))))) * t) * t_2)) * l) * t_1; end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[k], $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 0.024], N[(N[(t$95$1 * l), $MachinePrecision] * N[(N[(l / t$95$2), $MachinePrecision] * N[(2.0 / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(l + l), $MachinePrecision] / N[(N[(N[(0.5 - N[(0.5 * N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \cos \left(\left|k\right|\right)\\
t_2 := \left|k\right| \cdot \left|k\right|\\
\mathbf{if}\;\left|k\right| \leq 0.024:\\
\;\;\;\;\left(t\_1 \cdot \ell\right) \cdot \left(\frac{\ell}{t\_2} \cdot \frac{2}{{\left(\left|k\right|\right)}^{2} \cdot t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\ell + \ell}{\left(\left(0.5 - 0.5 \cdot \cos \left(\left|k\right| + \left|k\right|\right)\right) \cdot t\right) \cdot t\_2} \cdot \ell\right) \cdot t\_1\\
\end{array}
if k < 0.024Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6472.8%
Applied rewrites72.8%
if 0.024 < k Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift--.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-+.f64N/A
count-2N/A
sqr-sin-a-revN/A
lift-sin.f64N/A
lift-sin.f64N/A
pow2N/A
lower-pow.f6483.6%
Applied rewrites83.6%
Applied rewrites75.2%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (cos (fabs k))) (t_2 (* (fabs k) (fabs k))))
(if (<= (fabs k) 0.024)
(* (* t_1 l) (* (/ l t_2) (/ 2.0 (* (pow (fabs k) 2.0) t))))
(*
(*
(/
t_1
(* (* t_2 t) (- 0.5 (* (cos (+ (fabs k) (fabs k))) 0.5))))
l)
(+ l l)))))double code(double t, double l, double k) {
double t_1 = cos(fabs(k));
double t_2 = fabs(k) * fabs(k);
double tmp;
if (fabs(k) <= 0.024) {
tmp = (t_1 * l) * ((l / t_2) * (2.0 / (pow(fabs(k), 2.0) * t)));
} else {
tmp = ((t_1 / ((t_2 * t) * (0.5 - (cos((fabs(k) + fabs(k))) * 0.5)))) * l) * (l + l);
}
return tmp;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = cos(abs(k))
t_2 = abs(k) * abs(k)
if (abs(k) <= 0.024d0) then
tmp = (t_1 * l) * ((l / t_2) * (2.0d0 / ((abs(k) ** 2.0d0) * t)))
else
tmp = ((t_1 / ((t_2 * t) * (0.5d0 - (cos((abs(k) + abs(k))) * 0.5d0)))) * l) * (l + l)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(Math.abs(k));
double t_2 = Math.abs(k) * Math.abs(k);
double tmp;
if (Math.abs(k) <= 0.024) {
tmp = (t_1 * l) * ((l / t_2) * (2.0 / (Math.pow(Math.abs(k), 2.0) * t)));
} else {
tmp = ((t_1 / ((t_2 * t) * (0.5 - (Math.cos((Math.abs(k) + Math.abs(k))) * 0.5)))) * l) * (l + l);
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(math.fabs(k)) t_2 = math.fabs(k) * math.fabs(k) tmp = 0 if math.fabs(k) <= 0.024: tmp = (t_1 * l) * ((l / t_2) * (2.0 / (math.pow(math.fabs(k), 2.0) * t))) else: tmp = ((t_1 / ((t_2 * t) * (0.5 - (math.cos((math.fabs(k) + math.fabs(k))) * 0.5)))) * l) * (l + l) return tmp
function code(t, l, k) t_1 = cos(abs(k)) t_2 = Float64(abs(k) * abs(k)) tmp = 0.0 if (abs(k) <= 0.024) tmp = Float64(Float64(t_1 * l) * Float64(Float64(l / t_2) * Float64(2.0 / Float64((abs(k) ^ 2.0) * t)))); else tmp = Float64(Float64(Float64(t_1 / Float64(Float64(t_2 * t) * Float64(0.5 - Float64(cos(Float64(abs(k) + abs(k))) * 0.5)))) * l) * Float64(l + l)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(abs(k)); t_2 = abs(k) * abs(k); tmp = 0.0; if (abs(k) <= 0.024) tmp = (t_1 * l) * ((l / t_2) * (2.0 / ((abs(k) ^ 2.0) * t))); else tmp = ((t_1 / ((t_2 * t) * (0.5 - (cos((abs(k) + abs(k))) * 0.5)))) * l) * (l + l); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[k], $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 0.024], N[(N[(t$95$1 * l), $MachinePrecision] * N[(N[(l / t$95$2), $MachinePrecision] * N[(2.0 / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 / N[(N[(t$95$2 * t), $MachinePrecision] * N[(0.5 - N[(N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * N[(l + l), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \cos \left(\left|k\right|\right)\\
t_2 := \left|k\right| \cdot \left|k\right|\\
\mathbf{if}\;\left|k\right| \leq 0.024:\\
\;\;\;\;\left(t\_1 \cdot \ell\right) \cdot \left(\frac{\ell}{t\_2} \cdot \frac{2}{{\left(\left|k\right|\right)}^{2} \cdot t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{t\_1}{\left(t\_2 \cdot t\right) \cdot \left(0.5 - \cos \left(\left|k\right| + \left|k\right|\right) \cdot 0.5\right)} \cdot \ell\right) \cdot \left(\ell + \ell\right)\\
\end{array}
if k < 0.024Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6472.8%
Applied rewrites72.8%
if 0.024 < k Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
count-2-revN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-outN/A
count-2-revN/A
lower-*.f64N/A
Applied rewrites67.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6475.1%
Applied rewrites75.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (cos (fabs k))) (t_2 (* (fabs k) (fabs k))))
(if (<= (fabs k) 5.8e-7)
(* (* t_1 l) (* (/ l t_2) (/ 2.0 (* (pow (fabs k) 2.0) t))))
(*
t_1
(/
(* (+ l l) l)
(* (* t_2 t) (- 0.5 (* (cos (+ (fabs k) (fabs k))) 0.5))))))))double code(double t, double l, double k) {
double t_1 = cos(fabs(k));
double t_2 = fabs(k) * fabs(k);
double tmp;
if (fabs(k) <= 5.8e-7) {
tmp = (t_1 * l) * ((l / t_2) * (2.0 / (pow(fabs(k), 2.0) * t)));
} else {
tmp = t_1 * (((l + l) * l) / ((t_2 * t) * (0.5 - (cos((fabs(k) + fabs(k))) * 0.5))));
}
return tmp;
}
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
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = cos(abs(k))
t_2 = abs(k) * abs(k)
if (abs(k) <= 5.8d-7) then
tmp = (t_1 * l) * ((l / t_2) * (2.0d0 / ((abs(k) ** 2.0d0) * t)))
else
tmp = t_1 * (((l + l) * l) / ((t_2 * t) * (0.5d0 - (cos((abs(k) + abs(k))) * 0.5d0))))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(Math.abs(k));
double t_2 = Math.abs(k) * Math.abs(k);
double tmp;
if (Math.abs(k) <= 5.8e-7) {
tmp = (t_1 * l) * ((l / t_2) * (2.0 / (Math.pow(Math.abs(k), 2.0) * t)));
} else {
tmp = t_1 * (((l + l) * l) / ((t_2 * t) * (0.5 - (Math.cos((Math.abs(k) + Math.abs(k))) * 0.5))));
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(math.fabs(k)) t_2 = math.fabs(k) * math.fabs(k) tmp = 0 if math.fabs(k) <= 5.8e-7: tmp = (t_1 * l) * ((l / t_2) * (2.0 / (math.pow(math.fabs(k), 2.0) * t))) else: tmp = t_1 * (((l + l) * l) / ((t_2 * t) * (0.5 - (math.cos((math.fabs(k) + math.fabs(k))) * 0.5)))) return tmp
function code(t, l, k) t_1 = cos(abs(k)) t_2 = Float64(abs(k) * abs(k)) tmp = 0.0 if (abs(k) <= 5.8e-7) tmp = Float64(Float64(t_1 * l) * Float64(Float64(l / t_2) * Float64(2.0 / Float64((abs(k) ^ 2.0) * t)))); else tmp = Float64(t_1 * Float64(Float64(Float64(l + l) * l) / Float64(Float64(t_2 * t) * Float64(0.5 - Float64(cos(Float64(abs(k) + abs(k))) * 0.5))))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(abs(k)); t_2 = abs(k) * abs(k); tmp = 0.0; if (abs(k) <= 5.8e-7) tmp = (t_1 * l) * ((l / t_2) * (2.0 / ((abs(k) ^ 2.0) * t))); else tmp = t_1 * (((l + l) * l) / ((t_2 * t) * (0.5 - (cos((abs(k) + abs(k))) * 0.5)))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[k], $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 5.8e-7], N[(N[(t$95$1 * l), $MachinePrecision] * N[(N[(l / t$95$2), $MachinePrecision] * N[(2.0 / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(N[(l + l), $MachinePrecision] * l), $MachinePrecision] / N[(N[(t$95$2 * t), $MachinePrecision] * N[(0.5 - N[(N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \cos \left(\left|k\right|\right)\\
t_2 := \left|k\right| \cdot \left|k\right|\\
\mathbf{if}\;\left|k\right| \leq 5.8 \cdot 10^{-7}:\\
\;\;\;\;\left(t\_1 \cdot \ell\right) \cdot \left(\frac{\ell}{t\_2} \cdot \frac{2}{{\left(\left|k\right|\right)}^{2} \cdot t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{\left(\ell + \ell\right) \cdot \ell}{\left(t\_2 \cdot t\right) \cdot \left(0.5 - \cos \left(\left|k\right| + \left|k\right|\right) \cdot 0.5\right)}\\
\end{array}
if k < 5.7999999999999995e-7Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6472.8%
Applied rewrites72.8%
if 5.7999999999999995e-7 < k Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
count-2-revN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-outN/A
count-2-revN/A
lower-*.f64N/A
Applied rewrites67.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6467.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6467.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.6%
Applied rewrites67.6%
(FPCore (t l k) :precision binary64 (* (* (cos k) l) (* (/ l (* k k)) (/ 2.0 (* (pow k 2.0) t)))))
double code(double t, double l, double k) {
return (cos(k) * l) * ((l / (k * k)) * (2.0 / (pow(k, 2.0) * t)));
}
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 = (cos(k) * l) * ((l / (k * k)) * (2.0d0 / ((k ** 2.0d0) * t)))
end function
public static double code(double t, double l, double k) {
return (Math.cos(k) * l) * ((l / (k * k)) * (2.0 / (Math.pow(k, 2.0) * t)));
}
def code(t, l, k): return (math.cos(k) * l) * ((l / (k * k)) * (2.0 / (math.pow(k, 2.0) * t)))
function code(t, l, k) return Float64(Float64(cos(k) * l) * Float64(Float64(l / Float64(k * k)) * Float64(2.0 / Float64((k ^ 2.0) * t)))) end
function tmp = code(t, l, k) tmp = (cos(k) * l) * ((l / (k * k)) * (2.0 / ((k ^ 2.0) * t))); end
code[t_, l_, k_] := N[(N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision] * N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(2.0 / N[(N[Power[k, 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\cos k \cdot \ell\right) \cdot \left(\frac{\ell}{k \cdot k} \cdot \frac{2}{{k}^{2} \cdot t}\right)
Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6472.8%
Applied rewrites72.8%
(FPCore (t l k) :precision binary64 (if (<= (fabs l) 6.2e+184) (* (+ (fabs l) (fabs l)) (/ (fabs l) (* (pow k 4.0) t))) (/ (* (* (cos k) (* (fabs l) (/ (fabs l) (* k k)))) 2.0) (* (- 0.5 0.5) t))))
double code(double t, double l, double k) {
double tmp;
if (fabs(l) <= 6.2e+184) {
tmp = (fabs(l) + fabs(l)) * (fabs(l) / (pow(k, 4.0) * t));
} else {
tmp = ((cos(k) * (fabs(l) * (fabs(l) / (k * k)))) * 2.0) / ((0.5 - 0.5) * t);
}
return tmp;
}
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
real(8) :: tmp
if (abs(l) <= 6.2d+184) then
tmp = (abs(l) + abs(l)) * (abs(l) / ((k ** 4.0d0) * t))
else
tmp = ((cos(k) * (abs(l) * (abs(l) / (k * k)))) * 2.0d0) / ((0.5d0 - 0.5d0) * t)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (Math.abs(l) <= 6.2e+184) {
tmp = (Math.abs(l) + Math.abs(l)) * (Math.abs(l) / (Math.pow(k, 4.0) * t));
} else {
tmp = ((Math.cos(k) * (Math.abs(l) * (Math.abs(l) / (k * k)))) * 2.0) / ((0.5 - 0.5) * t);
}
return tmp;
}
def code(t, l, k): tmp = 0 if math.fabs(l) <= 6.2e+184: tmp = (math.fabs(l) + math.fabs(l)) * (math.fabs(l) / (math.pow(k, 4.0) * t)) else: tmp = ((math.cos(k) * (math.fabs(l) * (math.fabs(l) / (k * k)))) * 2.0) / ((0.5 - 0.5) * t) return tmp
function code(t, l, k) tmp = 0.0 if (abs(l) <= 6.2e+184) tmp = Float64(Float64(abs(l) + abs(l)) * Float64(abs(l) / Float64((k ^ 4.0) * t))); else tmp = Float64(Float64(Float64(cos(k) * Float64(abs(l) * Float64(abs(l) / Float64(k * k)))) * 2.0) / Float64(Float64(0.5 - 0.5) * t)); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (abs(l) <= 6.2e+184) tmp = (abs(l) + abs(l)) * (abs(l) / ((k ^ 4.0) * t)); else tmp = ((cos(k) * (abs(l) * (abs(l) / (k * k)))) * 2.0) / ((0.5 - 0.5) * t); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[Abs[l], $MachinePrecision], 6.2e+184], N[(N[(N[Abs[l], $MachinePrecision] + N[Abs[l], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[l], $MachinePrecision] / N[(N[Power[k, 4.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Cos[k], $MachinePrecision] * N[(N[Abs[l], $MachinePrecision] * N[(N[Abs[l], $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] / N[(N[(0.5 - 0.5), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|\ell\right| \leq 6.2 \cdot 10^{+184}:\\
\;\;\;\;\left(\left|\ell\right| + \left|\ell\right|\right) \cdot \frac{\left|\ell\right|}{{k}^{4} \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\cos k \cdot \left(\left|\ell\right| \cdot \frac{\left|\ell\right|}{k \cdot k}\right)\right) \cdot 2}{\left(0.5 - 0.5\right) \cdot t}\\
\end{array}
if l < 6.1999999999999997e184Initial program 35.6%
Taylor expanded in k around 0
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f6461.8%
Applied rewrites61.8%
lift-/.f64N/A
mult-flipN/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-pow.f64N/A
pow-flipN/A
lower-pow.f64N/A
metadata-eval68.0%
Applied rewrites68.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6468.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.0%
Applied rewrites68.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6468.1%
Applied rewrites68.1%
if 6.1999999999999997e184 < l Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
Taylor expanded in k around 0
Applied rewrites40.5%
(FPCore (t l k) :precision binary64 (if (<= (fabs l) 6.2e+184) (* (+ (fabs l) (fabs l)) (/ (fabs l) (* (pow k 4.0) t))) (* (/ (cos k) (* (* (* k k) t) (- 0.5 0.5))) (* (* (fabs l) (fabs l)) 2.0))))
double code(double t, double l, double k) {
double tmp;
if (fabs(l) <= 6.2e+184) {
tmp = (fabs(l) + fabs(l)) * (fabs(l) / (pow(k, 4.0) * t));
} else {
tmp = (cos(k) / (((k * k) * t) * (0.5 - 0.5))) * ((fabs(l) * fabs(l)) * 2.0);
}
return tmp;
}
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
real(8) :: tmp
if (abs(l) <= 6.2d+184) then
tmp = (abs(l) + abs(l)) * (abs(l) / ((k ** 4.0d0) * t))
else
tmp = (cos(k) / (((k * k) * t) * (0.5d0 - 0.5d0))) * ((abs(l) * abs(l)) * 2.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (Math.abs(l) <= 6.2e+184) {
tmp = (Math.abs(l) + Math.abs(l)) * (Math.abs(l) / (Math.pow(k, 4.0) * t));
} else {
tmp = (Math.cos(k) / (((k * k) * t) * (0.5 - 0.5))) * ((Math.abs(l) * Math.abs(l)) * 2.0);
}
return tmp;
}
def code(t, l, k): tmp = 0 if math.fabs(l) <= 6.2e+184: tmp = (math.fabs(l) + math.fabs(l)) * (math.fabs(l) / (math.pow(k, 4.0) * t)) else: tmp = (math.cos(k) / (((k * k) * t) * (0.5 - 0.5))) * ((math.fabs(l) * math.fabs(l)) * 2.0) return tmp
function code(t, l, k) tmp = 0.0 if (abs(l) <= 6.2e+184) tmp = Float64(Float64(abs(l) + abs(l)) * Float64(abs(l) / Float64((k ^ 4.0) * t))); else tmp = Float64(Float64(cos(k) / Float64(Float64(Float64(k * k) * t) * Float64(0.5 - 0.5))) * Float64(Float64(abs(l) * abs(l)) * 2.0)); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (abs(l) <= 6.2e+184) tmp = (abs(l) + abs(l)) * (abs(l) / ((k ^ 4.0) * t)); else tmp = (cos(k) / (((k * k) * t) * (0.5 - 0.5))) * ((abs(l) * abs(l)) * 2.0); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[Abs[l], $MachinePrecision], 6.2e+184], N[(N[(N[Abs[l], $MachinePrecision] + N[Abs[l], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[l], $MachinePrecision] / N[(N[Power[k, 4.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[k], $MachinePrecision] / N[(N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision] * N[(0.5 - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Abs[l], $MachinePrecision] * N[Abs[l], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|\ell\right| \leq 6.2 \cdot 10^{+184}:\\
\;\;\;\;\left(\left|\ell\right| + \left|\ell\right|\right) \cdot \frac{\left|\ell\right|}{{k}^{4} \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos k}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(0.5 - 0.5\right)} \cdot \left(\left(\left|\ell\right| \cdot \left|\ell\right|\right) \cdot 2\right)\\
\end{array}
if l < 6.1999999999999997e184Initial program 35.6%
Taylor expanded in k around 0
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f6461.8%
Applied rewrites61.8%
lift-/.f64N/A
mult-flipN/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-pow.f64N/A
pow-flipN/A
lower-pow.f64N/A
metadata-eval68.0%
Applied rewrites68.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6468.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.0%
Applied rewrites68.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6468.1%
Applied rewrites68.1%
if 6.1999999999999997e184 < l Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
count-2-revN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
distribute-rgt-outN/A
count-2-revN/A
lower-*.f64N/A
Applied rewrites67.6%
Taylor expanded in k around 0
Applied rewrites35.7%
(FPCore (t l k) :precision binary64 (* (* (cos k) l) (* 2.0 (/ l (* (pow k 4.0) t)))))
double code(double t, double l, double k) {
return (cos(k) * l) * (2.0 * (l / (pow(k, 4.0) * t)));
}
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 = (cos(k) * l) * (2.0d0 * (l / ((k ** 4.0d0) * t)))
end function
public static double code(double t, double l, double k) {
return (Math.cos(k) * l) * (2.0 * (l / (Math.pow(k, 4.0) * t)));
}
def code(t, l, k): return (math.cos(k) * l) * (2.0 * (l / (math.pow(k, 4.0) * t)))
function code(t, l, k) return Float64(Float64(cos(k) * l) * Float64(2.0 * Float64(l / Float64((k ^ 4.0) * t)))) end
function tmp = code(t, l, k) tmp = (cos(k) * l) * (2.0 * (l / ((k ^ 4.0) * t))); end
code[t_, l_, k_] := N[(N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision] * N[(2.0 * N[(l / N[(N[Power[k, 4.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\cos k \cdot \ell\right) \cdot \left(2 \cdot \frac{\ell}{{k}^{4} \cdot t}\right)
Initial program 35.6%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.5%
Applied rewrites73.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
metadata-evalN/A
Applied rewrites41.2%
Taylor expanded in k around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6469.1%
Applied rewrites69.1%
(FPCore (t l k) :precision binary64 (* (+ l l) (/ l (* (pow k 4.0) t))))
double code(double t, double l, double k) {
return (l + l) * (l / (pow(k, 4.0) * t));
}
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 = (l + l) * (l / ((k ** 4.0d0) * t))
end function
public static double code(double t, double l, double k) {
return (l + l) * (l / (Math.pow(k, 4.0) * t));
}
def code(t, l, k): return (l + l) * (l / (math.pow(k, 4.0) * t))
function code(t, l, k) return Float64(Float64(l + l) * Float64(l / Float64((k ^ 4.0) * t))) end
function tmp = code(t, l, k) tmp = (l + l) * (l / ((k ^ 4.0) * t)); end
code[t_, l_, k_] := N[(N[(l + l), $MachinePrecision] * N[(l / N[(N[Power[k, 4.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\ell + \ell\right) \cdot \frac{\ell}{{k}^{4} \cdot t}
Initial program 35.6%
Taylor expanded in k around 0
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f6461.8%
Applied rewrites61.8%
lift-/.f64N/A
mult-flipN/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-pow.f64N/A
pow-flipN/A
lower-pow.f64N/A
metadata-eval68.0%
Applied rewrites68.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6468.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.0%
Applied rewrites68.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6468.1%
Applied rewrites68.1%
herbie shell --seed 2025258
(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))))