
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\end{array}
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (pow (sin k) 2.0) (/ t (cos k))) (/ k l)) (/ k l))))
double code(double t, double l, double k) {
return 2.0 / (((pow(sin(k), 2.0) * (t / cos(k))) * (k / l)) * (k / l));
}
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 / ((((sin(k) ** 2.0d0) * (t / cos(k))) * (k / l)) * (k / l))
end function
public static double code(double t, double l, double k) {
return 2.0 / (((Math.pow(Math.sin(k), 2.0) * (t / Math.cos(k))) * (k / l)) * (k / l));
}
def code(t, l, k): return 2.0 / (((math.pow(math.sin(k), 2.0) * (t / math.cos(k))) * (k / l)) * (k / l))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64((sin(k) ^ 2.0) * Float64(t / cos(k))) * Float64(k / l)) * Float64(k / l))) end
function tmp = code(t, l, k) tmp = 2.0 / ((((sin(k) ^ 2.0) * (t / cos(k))) * (k / l)) * (k / l)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left({\sin k}^{2} \cdot \frac{t}{\cos k}\right) \cdot \frac{k}{\ell}\right) \cdot \frac{k}{\ell}}
\end{array}
Initial program 34.8%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6474.6
Applied rewrites74.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6496.2
Applied rewrites96.2%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (cos k) l)) (t_2 (* (pow (sin k) 2.0) t)))
(if (<= t 2.6e-53)
(/ 2.0 (/ (* (/ (* t_2 k) l) k) t_1))
(/ 2.0 (* (* k (/ t_2 t_1)) (/ k l))))))
double code(double t, double l, double k) {
double t_1 = cos(k) * l;
double t_2 = pow(sin(k), 2.0) * t;
double tmp;
if (t <= 2.6e-53) {
tmp = 2.0 / ((((t_2 * k) / l) * k) / t_1);
} else {
tmp = 2.0 / ((k * (t_2 / t_1)) * (k / 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(k) * l
t_2 = (sin(k) ** 2.0d0) * t
if (t <= 2.6d-53) then
tmp = 2.0d0 / ((((t_2 * k) / l) * k) / t_1)
else
tmp = 2.0d0 / ((k * (t_2 / t_1)) * (k / l))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(k) * l;
double t_2 = Math.pow(Math.sin(k), 2.0) * t;
double tmp;
if (t <= 2.6e-53) {
tmp = 2.0 / ((((t_2 * k) / l) * k) / t_1);
} else {
tmp = 2.0 / ((k * (t_2 / t_1)) * (k / l));
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(k) * l t_2 = math.pow(math.sin(k), 2.0) * t tmp = 0 if t <= 2.6e-53: tmp = 2.0 / ((((t_2 * k) / l) * k) / t_1) else: tmp = 2.0 / ((k * (t_2 / t_1)) * (k / l)) return tmp
function code(t, l, k) t_1 = Float64(cos(k) * l) t_2 = Float64((sin(k) ^ 2.0) * t) tmp = 0.0 if (t <= 2.6e-53) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(t_2 * k) / l) * k) / t_1)); else tmp = Float64(2.0 / Float64(Float64(k * Float64(t_2 / t_1)) * Float64(k / l))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(k) * l; t_2 = (sin(k) ^ 2.0) * t; tmp = 0.0; if (t <= 2.6e-53) tmp = 2.0 / ((((t_2 * k) / l) * k) / t_1); else tmp = 2.0 / ((k * (t_2 / t_1)) * (k / l)); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, 2.6e-53], N[(2.0 / N[(N[(N[(N[(t$95$2 * k), $MachinePrecision] / l), $MachinePrecision] * k), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(k * N[(t$95$2 / t$95$1), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos k \cdot \ell\\
t_2 := {\sin k}^{2} \cdot t\\
\mathbf{if}\;t \leq 2.6 \cdot 10^{-53}:\\
\;\;\;\;\frac{2}{\frac{\frac{t\_2 \cdot k}{\ell} \cdot k}{t\_1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(k \cdot \frac{t\_2}{t\_1}\right) \cdot \frac{k}{\ell}}\\
\end{array}
\end{array}
if t < 2.59999999999999996e-53Initial program 35.5%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6474.1
Applied rewrites74.1%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites89.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6495.9
Applied rewrites95.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
Applied rewrites91.4%
if 2.59999999999999996e-53 < t Initial program 33.1%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6475.7
Applied rewrites75.7%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites93.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6496.9
Applied rewrites96.9%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f6497.0
Applied rewrites97.0%
(FPCore (t l k)
:precision binary64
(if (<= k 4400000000000.0)
(/ 2.0 (* (* k (/ (* (pow (sin k) 2.0) t) (* (cos k) l))) (/ k l)))
(/
2.0
(*
(* (* (- 0.5 (* 0.5 (cos (* 2.0 k)))) (/ t (cos k))) (/ k l))
(/ k l)))))
double code(double t, double l, double k) {
double tmp;
if (k <= 4400000000000.0) {
tmp = 2.0 / ((k * ((pow(sin(k), 2.0) * t) / (cos(k) * l))) * (k / l));
} else {
tmp = 2.0 / ((((0.5 - (0.5 * cos((2.0 * k)))) * (t / cos(k))) * (k / l)) * (k / 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) :: tmp
if (k <= 4400000000000.0d0) then
tmp = 2.0d0 / ((k * (((sin(k) ** 2.0d0) * t) / (cos(k) * l))) * (k / l))
else
tmp = 2.0d0 / ((((0.5d0 - (0.5d0 * cos((2.0d0 * k)))) * (t / cos(k))) * (k / l)) * (k / l))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 4400000000000.0) {
tmp = 2.0 / ((k * ((Math.pow(Math.sin(k), 2.0) * t) / (Math.cos(k) * l))) * (k / l));
} else {
tmp = 2.0 / ((((0.5 - (0.5 * Math.cos((2.0 * k)))) * (t / Math.cos(k))) * (k / l)) * (k / l));
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 4400000000000.0: tmp = 2.0 / ((k * ((math.pow(math.sin(k), 2.0) * t) / (math.cos(k) * l))) * (k / l)) else: tmp = 2.0 / ((((0.5 - (0.5 * math.cos((2.0 * k)))) * (t / math.cos(k))) * (k / l)) * (k / l)) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 4400000000000.0) tmp = Float64(2.0 / Float64(Float64(k * Float64(Float64((sin(k) ^ 2.0) * t) / Float64(cos(k) * l))) * Float64(k / l))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * k)))) * Float64(t / cos(k))) * Float64(k / l)) * Float64(k / l))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 4400000000000.0) tmp = 2.0 / ((k * (((sin(k) ^ 2.0) * t) / (cos(k) * l))) * (k / l)); else tmp = 2.0 / ((((0.5 - (0.5 * cos((2.0 * k)))) * (t / cos(k))) * (k / l)) * (k / l)); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 4400000000000.0], N[(2.0 / N[(N[(k * N[(N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4400000000000:\\
\;\;\;\;\frac{2}{\left(k \cdot \frac{{\sin k}^{2} \cdot t}{\cos k \cdot \ell}\right) \cdot \frac{k}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot k\right)\right) \cdot \frac{t}{\cos k}\right) \cdot \frac{k}{\ell}\right) \cdot \frac{k}{\ell}}\\
\end{array}
\end{array}
if k < 4.4e12Initial program 36.3%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6475.9
Applied rewrites75.9%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6495.3
Applied rewrites95.3%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f6493.6
Applied rewrites93.6%
if 4.4e12 < k Initial program 30.3%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6470.8
Applied rewrites70.8%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6499.0
Applied rewrites99.0%
lift-pow.f64N/A
lift-sin.f64N/A
unpow2N/A
sqr-sin-aN/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6498.6
Applied rewrites98.6%
(FPCore (t l k)
:precision binary64
(if (<= k 60000.0)
(/
2.0
(*
(* (* (fma (* t 0.16666666666666666) (* k k) t) (* k k)) (/ k l))
(/ k l)))
(if (<= k 1.1e+122)
(/
2.0
(*
(/ (* (* k k) t) (cos k))
(/ (- 0.5 (* 0.5 (cos (* 2.0 k)))) (* l l))))
(/ 2.0 (* (* (* (pow (sin k) 2.0) t) (/ k l)) (/ k l))))))
double code(double t, double l, double k) {
double tmp;
if (k <= 60000.0) {
tmp = 2.0 / (((fma((t * 0.16666666666666666), (k * k), t) * (k * k)) * (k / l)) * (k / l));
} else if (k <= 1.1e+122) {
tmp = 2.0 / ((((k * k) * t) / cos(k)) * ((0.5 - (0.5 * cos((2.0 * k)))) / (l * l)));
} else {
tmp = 2.0 / (((pow(sin(k), 2.0) * t) * (k / l)) * (k / l));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (k <= 60000.0) tmp = Float64(2.0 / Float64(Float64(Float64(fma(Float64(t * 0.16666666666666666), Float64(k * k), t) * Float64(k * k)) * Float64(k / l)) * Float64(k / l))); elseif (k <= 1.1e+122) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k * k) * t) / cos(k)) * Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * k)))) / Float64(l * l)))); else tmp = Float64(2.0 / Float64(Float64(Float64((sin(k) ^ 2.0) * t) * Float64(k / l)) * Float64(k / l))); end return tmp end
code[t_, l_, k_] := If[LessEqual[k, 60000.0], N[(2.0 / N[(N[(N[(N[(N[(t * 0.16666666666666666), $MachinePrecision] * N[(k * k), $MachinePrecision] + t), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1.1e+122], N[(2.0 / N[(N[(N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 60000:\\
\;\;\;\;\frac{2}{\left(\left(\mathsf{fma}\left(t \cdot 0.16666666666666666, k \cdot k, t\right) \cdot \left(k \cdot k\right)\right) \cdot \frac{k}{\ell}\right) \cdot \frac{k}{\ell}}\\
\mathbf{elif}\;k \leq 1.1 \cdot 10^{+122}:\\
\;\;\;\;\frac{2}{\frac{\left(k \cdot k\right) \cdot t}{\cos k} \cdot \frac{0.5 - 0.5 \cdot \cos \left(2 \cdot k\right)}{\ell \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left({\sin k}^{2} \cdot t\right) \cdot \frac{k}{\ell}\right) \cdot \frac{k}{\ell}}\\
\end{array}
\end{array}
if k < 6e4Initial program 36.5%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6475.7
Applied rewrites75.7%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6495.2
Applied rewrites95.2%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lower-*.f6479.8
Applied rewrites79.8%
if 6e4 < k < 1.1e122Initial program 20.9%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6481.6
Applied rewrites81.6%
lift-pow.f64N/A
lift-sin.f64N/A
unpow2N/A
sqr-sin-aN/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6481.3
Applied rewrites81.3%
if 1.1e122 < k Initial program 36.0%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6464.6
Applied rewrites64.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites92.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6499.1
Applied rewrites99.1%
Taylor expanded in k around 0
Applied rewrites65.5%
(FPCore (t l k)
:precision binary64
(if (<= k 0.0025)
(/
2.0
(*
(* (* (fma (* t 0.16666666666666666) (* k k) t) (* k k)) (/ k l))
(/ k l)))
(/
2.0
(*
(* (* (- 0.5 (* 0.5 (cos (* 2.0 k)))) (/ t (cos k))) (/ k l))
(/ k l)))))
double code(double t, double l, double k) {
double tmp;
if (k <= 0.0025) {
tmp = 2.0 / (((fma((t * 0.16666666666666666), (k * k), t) * (k * k)) * (k / l)) * (k / l));
} else {
tmp = 2.0 / ((((0.5 - (0.5 * cos((2.0 * k)))) * (t / cos(k))) * (k / l)) * (k / l));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (k <= 0.0025) tmp = Float64(2.0 / Float64(Float64(Float64(fma(Float64(t * 0.16666666666666666), Float64(k * k), t) * Float64(k * k)) * Float64(k / l)) * Float64(k / l))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * k)))) * Float64(t / cos(k))) * Float64(k / l)) * Float64(k / l))); end return tmp end
code[t_, l_, k_] := If[LessEqual[k, 0.0025], N[(2.0 / N[(N[(N[(N[(N[(t * 0.16666666666666666), $MachinePrecision] * N[(k * k), $MachinePrecision] + t), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.0025:\\
\;\;\;\;\frac{2}{\left(\left(\mathsf{fma}\left(t \cdot 0.16666666666666666, k \cdot k, t\right) \cdot \left(k \cdot k\right)\right) \cdot \frac{k}{\ell}\right) \cdot \frac{k}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot k\right)\right) \cdot \frac{t}{\cos k}\right) \cdot \frac{k}{\ell}\right) \cdot \frac{k}{\ell}}\\
\end{array}
\end{array}
if k < 0.00250000000000000005Initial program 36.6%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6475.6
Applied rewrites75.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.7%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6495.2
Applied rewrites95.2%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lower-*.f6480.0
Applied rewrites80.0%
if 0.00250000000000000005 < k Initial program 29.7%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6471.7
Applied rewrites71.7%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6498.9
Applied rewrites98.9%
lift-pow.f64N/A
lift-sin.f64N/A
unpow2N/A
sqr-sin-aN/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6498.6
Applied rewrites98.6%
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (pow (sin k) 2.0) t) (/ k l)) (/ k l))))
double code(double t, double l, double k) {
return 2.0 / (((pow(sin(k), 2.0) * t) * (k / l)) * (k / l));
}
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 / ((((sin(k) ** 2.0d0) * t) * (k / l)) * (k / l))
end function
public static double code(double t, double l, double k) {
return 2.0 / (((Math.pow(Math.sin(k), 2.0) * t) * (k / l)) * (k / l));
}
def code(t, l, k): return 2.0 / (((math.pow(math.sin(k), 2.0) * t) * (k / l)) * (k / l))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64((sin(k) ^ 2.0) * t) * Float64(k / l)) * Float64(k / l))) end
function tmp = code(t, l, k) tmp = 2.0 / ((((sin(k) ^ 2.0) * t) * (k / l)) * (k / l)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left({\sin k}^{2} \cdot t\right) \cdot \frac{k}{\ell}\right) \cdot \frac{k}{\ell}}
\end{array}
Initial program 34.8%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6474.6
Applied rewrites74.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6496.2
Applied rewrites96.2%
Taylor expanded in k around 0
Applied rewrites75.6%
(FPCore (t l k)
:precision binary64
(if (<= l 8.2e+203)
(/
2.0
(*
(* (* (fma (* t 0.16666666666666666) (* k k) t) (* k k)) (/ k l))
(/ k l)))
(/ 2.0 (* (/ (* (* k k) t) (cos k)) (/ (* k k) (* l l))))))
double code(double t, double l, double k) {
double tmp;
if (l <= 8.2e+203) {
tmp = 2.0 / (((fma((t * 0.16666666666666666), (k * k), t) * (k * k)) * (k / l)) * (k / l));
} else {
tmp = 2.0 / ((((k * k) * t) / cos(k)) * ((k * k) / (l * l)));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (l <= 8.2e+203) tmp = Float64(2.0 / Float64(Float64(Float64(fma(Float64(t * 0.16666666666666666), Float64(k * k), t) * Float64(k * k)) * Float64(k / l)) * Float64(k / l))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k * k) * t) / cos(k)) * Float64(Float64(k * k) / Float64(l * l)))); end return tmp end
code[t_, l_, k_] := If[LessEqual[l, 8.2e+203], N[(2.0 / N[(N[(N[(N[(N[(t * 0.16666666666666666), $MachinePrecision] * N[(k * k), $MachinePrecision] + t), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision] * N[(N[(k * k), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 8.2 \cdot 10^{+203}:\\
\;\;\;\;\frac{2}{\left(\left(\mathsf{fma}\left(t \cdot 0.16666666666666666, k \cdot k, t\right) \cdot \left(k \cdot k\right)\right) \cdot \frac{k}{\ell}\right) \cdot \frac{k}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\left(k \cdot k\right) \cdot t}{\cos k} \cdot \frac{k \cdot k}{\ell \cdot \ell}}\\
\end{array}
\end{array}
if l < 8.20000000000000033e203Initial program 34.8%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6475.4
Applied rewrites75.4%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.3%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6495.9
Applied rewrites95.9%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
distribute-rgt-out--N/A
metadata-evalN/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lower-*.f6474.1
Applied rewrites74.1%
if 8.20000000000000033e203 < l Initial program 35.5%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6465.9
Applied rewrites65.9%
Taylor expanded in k around 0
pow2N/A
lift-*.f6465.9
Applied rewrites65.9%
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (* k k) t) (/ k l)) (/ k l))))
double code(double t, double l, double k) {
return 2.0 / ((((k * k) * t) * (k / l)) * (k / l));
}
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 / ((((k * k) * t) * (k / l)) * (k / l))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((k * k) * t) * (k / l)) * (k / l));
}
def code(t, l, k): return 2.0 / ((((k * k) * t) * (k / l)) * (k / l))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64(k * k) * t) * Float64(k / l)) * Float64(k / l))) end
function tmp = code(t, l, k) tmp = 2.0 / ((((k * k) * t) * (k / l)) * (k / l)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\left(k \cdot k\right) \cdot t\right) \cdot \frac{k}{\ell}\right) \cdot \frac{k}{\ell}}
\end{array}
Initial program 34.8%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6474.6
Applied rewrites74.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-cos.f6496.2
Applied rewrites96.2%
Taylor expanded in k around 0
lower-*.f64N/A
pow2N/A
lower-*.f6473.1
Applied rewrites73.1%
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* k k) t) (* (/ k l) (/ k l)))))
double code(double t, double l, double k) {
return 2.0 / (((k * k) * t) * ((k / l) * (k / l)));
}
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 / (((k * k) * t) * ((k / l) * (k / l)))
end function
public static double code(double t, double l, double k) {
return 2.0 / (((k * k) * t) * ((k / l) * (k / l)));
}
def code(t, l, k): return 2.0 / (((k * k) * t) * ((k / l) * (k / l)))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(k * k) * t) * Float64(Float64(k / l) * Float64(k / l)))) end
function tmp = code(t, l, k) tmp = 2.0 / (((k * k) * t) * ((k / l) * (k / l))); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision] * N[(N[(k / l), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(k \cdot k\right) \cdot t\right) \cdot \left(\frac{k}{\ell} \cdot \frac{k}{\ell}\right)}
\end{array}
Initial program 34.8%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6474.6
Applied rewrites74.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites90.6%
Taylor expanded in k around 0
pow2N/A
lift-*.f64N/A
lift-*.f6471.7
Applied rewrites71.7%
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* k (* k t)) (/ (* k k) (* l l)))))
double code(double t, double l, double k) {
return 2.0 / ((k * (k * t)) * ((k * k) / (l * l)));
}
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 / ((k * (k * t)) * ((k * k) / (l * l)))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((k * (k * t)) * ((k * k) / (l * l)));
}
def code(t, l, k): return 2.0 / ((k * (k * t)) * ((k * k) / (l * l)))
function code(t, l, k) return Float64(2.0 / Float64(Float64(k * Float64(k * t)) * Float64(Float64(k * k) / Float64(l * l)))) end
function tmp = code(t, l, k) tmp = 2.0 / ((k * (k * t)) * ((k * k) / (l * l))); end
code[t_, l_, k_] := N[(2.0 / N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] * N[(N[(k * k), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(k \cdot \left(k \cdot t\right)\right) \cdot \frac{k \cdot k}{\ell \cdot \ell}}
\end{array}
Initial program 34.8%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6474.6
Applied rewrites74.6%
Taylor expanded in k around 0
pow2N/A
lift-*.f64N/A
lift-*.f6465.9
Applied rewrites65.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6466.3
Applied rewrites66.3%
Taylor expanded in k around 0
pow2N/A
lower-*.f6465.2
Applied rewrites65.2%
(FPCore (t l k) :precision binary64 (/ (* (/ 2.0 (* (* k k) (* k k))) (* l l)) t))
double code(double t, double l, double k) {
return ((2.0 / ((k * k) * (k * k))) * (l * l)) / 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 = ((2.0d0 / ((k * k) * (k * k))) * (l * l)) / t
end function
public static double code(double t, double l, double k) {
return ((2.0 / ((k * k) * (k * k))) * (l * l)) / t;
}
def code(t, l, k): return ((2.0 / ((k * k) * (k * k))) * (l * l)) / t
function code(t, l, k) return Float64(Float64(Float64(2.0 / Float64(Float64(k * k) * Float64(k * k))) * Float64(l * l)) / t) end
function tmp = code(t, l, k) tmp = ((2.0 / ((k * k) * (k * k))) * (l * l)) / t; end
code[t_, l_, k_] := N[(N[(N[(2.0 / N[(N[(k * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot \left(\ell \cdot \ell\right)}{t}
\end{array}
Initial program 34.8%
Taylor expanded in k around 0
associate-*r/N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6460.9
Applied rewrites60.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
pow2N/A
lift-*.f6462.1
Applied rewrites62.1%
lift-pow.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6462.1
Applied rewrites62.1%
(FPCore (t l k) :precision binary64 (* (/ 2.0 (* (* k k) (* k k))) (/ (* l l) t)))
double code(double t, double l, double k) {
return (2.0 / ((k * k) * (k * k))) * ((l * l) / 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 = (2.0d0 / ((k * k) * (k * k))) * ((l * l) / t)
end function
public static double code(double t, double l, double k) {
return (2.0 / ((k * k) * (k * k))) * ((l * l) / t);
}
def code(t, l, k): return (2.0 / ((k * k) * (k * k))) * ((l * l) / t)
function code(t, l, k) return Float64(Float64(2.0 / Float64(Float64(k * k) * Float64(k * k))) * Float64(Float64(l * l) / t)) end
function tmp = code(t, l, k) tmp = (2.0 / ((k * k) * (k * k))) * ((l * l) / t); end
code[t_, l_, k_] := N[(N[(2.0 / N[(N[(k * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot \frac{\ell \cdot \ell}{t}
\end{array}
Initial program 34.8%
Taylor expanded in k around 0
associate-*r/N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6460.9
Applied rewrites60.9%
lift-pow.f64N/A
metadata-evalN/A
pow-prod-upN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6460.9
Applied rewrites60.9%
(FPCore (t l k) :precision binary64 (* -0.11666666666666667 (/ (* l l) t)))
double code(double t, double l, double k) {
return -0.11666666666666667 * ((l * l) / 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 = (-0.11666666666666667d0) * ((l * l) / t)
end function
public static double code(double t, double l, double k) {
return -0.11666666666666667 * ((l * l) / t);
}
def code(t, l, k): return -0.11666666666666667 * ((l * l) / t)
function code(t, l, k) return Float64(-0.11666666666666667 * Float64(Float64(l * l) / t)) end
function tmp = code(t, l, k) tmp = -0.11666666666666667 * ((l * l) / t); end
code[t_, l_, k_] := N[(-0.11666666666666667 * N[(N[(l * l), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.11666666666666667 \cdot \frac{\ell \cdot \ell}{t}
\end{array}
Initial program 34.8%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites27.8%
Taylor expanded in k around inf
lower-*.f64N/A
pow2N/A
lift-/.f64N/A
lift-*.f6419.9
Applied rewrites19.9%
(FPCore (t l k) :precision binary64 (* -0.11666666666666667 (* l (/ l t))))
double code(double t, double l, double k) {
return -0.11666666666666667 * (l * (l / 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 = (-0.11666666666666667d0) * (l * (l / t))
end function
public static double code(double t, double l, double k) {
return -0.11666666666666667 * (l * (l / t));
}
def code(t, l, k): return -0.11666666666666667 * (l * (l / t))
function code(t, l, k) return Float64(-0.11666666666666667 * Float64(l * Float64(l / t))) end
function tmp = code(t, l, k) tmp = -0.11666666666666667 * (l * (l / t)); end
code[t_, l_, k_] := N[(-0.11666666666666667 * N[(l * N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.11666666666666667 \cdot \left(\ell \cdot \frac{\ell}{t}\right)
\end{array}
Initial program 34.8%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites27.8%
Taylor expanded in k around inf
lower-*.f64N/A
pow2N/A
lift-/.f64N/A
lift-*.f6419.9
Applied rewrites19.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6417.7
Applied rewrites17.7%
herbie shell --seed 2025089
(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))))