
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 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}
l_m = (fabs.f64 l)
(FPCore (t l_m k)
:precision binary64
(let* ((t_1 (pow (sin k) 2.0)))
(if (<= l_m 3.3e+114)
(/ 2.0 (/ (* t_1 (* (* k t) (/ k l_m))) (* (cos k) l_m)))
(/ 2.0 (* (* (* k (/ t l_m)) (/ k l_m)) (/ t_1 (cos k)))))))l_m = fabs(l);
double code(double t, double l_m, double k) {
double t_1 = pow(sin(k), 2.0);
double tmp;
if (l_m <= 3.3e+114) {
tmp = 2.0 / ((t_1 * ((k * t) * (k / l_m))) / (cos(k) * l_m));
} else {
tmp = 2.0 / (((k * (t / l_m)) * (k / l_m)) * (t_1 / cos(k)));
}
return tmp;
}
l_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = sin(k) ** 2.0d0
if (l_m <= 3.3d+114) then
tmp = 2.0d0 / ((t_1 * ((k * t) * (k / l_m))) / (cos(k) * l_m))
else
tmp = 2.0d0 / (((k * (t / l_m)) * (k / l_m)) * (t_1 / cos(k)))
end if
code = tmp
end function
l_m = Math.abs(l);
public static double code(double t, double l_m, double k) {
double t_1 = Math.pow(Math.sin(k), 2.0);
double tmp;
if (l_m <= 3.3e+114) {
tmp = 2.0 / ((t_1 * ((k * t) * (k / l_m))) / (Math.cos(k) * l_m));
} else {
tmp = 2.0 / (((k * (t / l_m)) * (k / l_m)) * (t_1 / Math.cos(k)));
}
return tmp;
}
l_m = math.fabs(l) def code(t, l_m, k): t_1 = math.pow(math.sin(k), 2.0) tmp = 0 if l_m <= 3.3e+114: tmp = 2.0 / ((t_1 * ((k * t) * (k / l_m))) / (math.cos(k) * l_m)) else: tmp = 2.0 / (((k * (t / l_m)) * (k / l_m)) * (t_1 / math.cos(k))) return tmp
l_m = abs(l) function code(t, l_m, k) t_1 = sin(k) ^ 2.0 tmp = 0.0 if (l_m <= 3.3e+114) tmp = Float64(2.0 / Float64(Float64(t_1 * Float64(Float64(k * t) * Float64(k / l_m))) / Float64(cos(k) * l_m))); else tmp = Float64(2.0 / Float64(Float64(Float64(k * Float64(t / l_m)) * Float64(k / l_m)) * Float64(t_1 / cos(k)))); end return tmp end
l_m = abs(l); function tmp_2 = code(t, l_m, k) t_1 = sin(k) ^ 2.0; tmp = 0.0; if (l_m <= 3.3e+114) tmp = 2.0 / ((t_1 * ((k * t) * (k / l_m))) / (cos(k) * l_m)); else tmp = 2.0 / (((k * (t / l_m)) * (k / l_m)) * (t_1 / cos(k))); end tmp_2 = tmp; end
l_m = N[Abs[l], $MachinePrecision]
code[t_, l$95$m_, k_] := Block[{t$95$1 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l$95$m, 3.3e+114], N[(2.0 / N[(N[(t$95$1 * N[(N[(k * t), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k * N[(t / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
t_1 := {\sin k}^{2}\\
\mathbf{if}\;l\_m \leq 3.3 \cdot 10^{+114}:\\
\;\;\;\;\frac{2}{\frac{t\_1 \cdot \left(\left(k \cdot t\right) \cdot \frac{k}{l\_m}\right)}{\cos k \cdot l\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(k \cdot \frac{t}{l\_m}\right) \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_1}{\cos k}}\\
\end{array}
\end{array}
if l < 3.3000000000000001e114Initial program 33.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6482.3
Applied rewrites82.3%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites88.7%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites94.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
*-commutativeN/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites93.3%
if 3.3000000000000001e114 < l Initial program 25.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6459.3
Applied rewrites59.3%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites94.1%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites89.5%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.8
Applied rewrites94.8%
l_m = (fabs.f64 l)
(FPCore (t l_m k)
:precision binary64
(let* ((t_1 (pow (sin k) 2.0)))
(if (<= l_m 4.8e+52)
(/ 2.0 (/ (* t_1 (* (* k t) (/ k l_m))) (* (cos k) l_m)))
(/ 2.0 (* (ratio-of-squares k l_m) (* t (/ t_1 (cos k))))))))\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
t_1 := {\sin k}^{2}\\
\mathbf{if}\;l\_m \leq 4.8 \cdot 10^{+52}:\\
\;\;\;\;\frac{2}{\frac{t\_1 \cdot \left(\left(k \cdot t\right) \cdot \frac{k}{l\_m}\right)}{\cos k \cdot l\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\mathsf{ratio\_of\_squares}\left(k, l\_m\right) \cdot \left(t \cdot \frac{t\_1}{\cos k}\right)}\\
\end{array}
\end{array}
if l < 4.8e52Initial program 33.2%
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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6481.5
Applied rewrites81.5%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites87.9%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites93.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
*-commutativeN/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites92.9%
if 4.8e52 < l Initial program 27.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6466.0
Applied rewrites66.0%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites95.2%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
*-commutativeN/A
lift-cos.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-cos.f6495.2
Applied rewrites95.2%
l_m = (fabs.f64 l)
(FPCore (t l_m k)
:precision binary64
(let* ((t_1 (* (pow (sin k) 2.0) t)))
(if (<= k 1.12e+96)
(/ 2.0 (/ (* (/ (* k k) l_m) t_1) (* l_m (cos k))))
(* (* (ratio-of-squares l_m k) (/ (cos k) t_1)) 2.0))))\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
t_1 := {\sin k}^{2} \cdot t\\
\mathbf{if}\;k \leq 1.12 \cdot 10^{+96}:\\
\;\;\;\;\frac{2}{\frac{\frac{k \cdot k}{l\_m} \cdot t\_1}{l\_m \cdot \cos k}}\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{ratio\_of\_squares}\left(l\_m, k\right) \cdot \frac{\cos k}{t\_1}\right) \cdot 2\\
\end{array}
\end{array}
if k < 1.1199999999999999e96Initial program 32.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6482.9
Applied rewrites82.9%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites90.0%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lower-*.f64N/A
lift-cos.f6490.4
Applied rewrites90.4%
if 1.1199999999999999e96 < k Initial program 26.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6449.9
Applied rewrites49.9%
Taylor expanded in t around 0
*-commutativeN/A
unpow2N/A
times-fracN/A
lift-ratio-of-squares.f64N/A
+-commutativeN/A
lift-ratio-of-squares.f64N/A
associate-*l*N/A
metadata-evalN/A
pow-prod-upN/A
Applied rewrites90.7%
l_m = (fabs.f64 l)
(FPCore (t l_m k)
:precision binary64
(let* ((t_1 (* (/ (* k t) l_m) (/ k l_m))))
(if (<= k 0.0025)
(/ 2.0 (* t_1 (* (+ (* 0.16666666666666666 (* k k)) 1.0) (* k k))))
(/ 2.0 (* t_1 (/ (- 0.5 (* 0.5 (cos (* 2.0 k)))) (cos k)))))))l_m = fabs(l);
double code(double t, double l_m, double k) {
double t_1 = ((k * t) / l_m) * (k / l_m);
double tmp;
if (k <= 0.0025) {
tmp = 2.0 / (t_1 * (((0.16666666666666666 * (k * k)) + 1.0) * (k * k)));
} else {
tmp = 2.0 / (t_1 * ((0.5 - (0.5 * cos((2.0 * k)))) / cos(k)));
}
return tmp;
}
l_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = ((k * t) / l_m) * (k / l_m)
if (k <= 0.0025d0) then
tmp = 2.0d0 / (t_1 * (((0.16666666666666666d0 * (k * k)) + 1.0d0) * (k * k)))
else
tmp = 2.0d0 / (t_1 * ((0.5d0 - (0.5d0 * cos((2.0d0 * k)))) / cos(k)))
end if
code = tmp
end function
l_m = Math.abs(l);
public static double code(double t, double l_m, double k) {
double t_1 = ((k * t) / l_m) * (k / l_m);
double tmp;
if (k <= 0.0025) {
tmp = 2.0 / (t_1 * (((0.16666666666666666 * (k * k)) + 1.0) * (k * k)));
} else {
tmp = 2.0 / (t_1 * ((0.5 - (0.5 * Math.cos((2.0 * k)))) / Math.cos(k)));
}
return tmp;
}
l_m = math.fabs(l) def code(t, l_m, k): t_1 = ((k * t) / l_m) * (k / l_m) tmp = 0 if k <= 0.0025: tmp = 2.0 / (t_1 * (((0.16666666666666666 * (k * k)) + 1.0) * (k * k))) else: tmp = 2.0 / (t_1 * ((0.5 - (0.5 * math.cos((2.0 * k)))) / math.cos(k))) return tmp
l_m = abs(l) function code(t, l_m, k) t_1 = Float64(Float64(Float64(k * t) / l_m) * Float64(k / l_m)) tmp = 0.0 if (k <= 0.0025) tmp = Float64(2.0 / Float64(t_1 * Float64(Float64(Float64(0.16666666666666666 * Float64(k * k)) + 1.0) * Float64(k * k)))); else tmp = Float64(2.0 / Float64(t_1 * Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * k)))) / cos(k)))); end return tmp end
l_m = abs(l); function tmp_2 = code(t, l_m, k) t_1 = ((k * t) / l_m) * (k / l_m); tmp = 0.0; if (k <= 0.0025) tmp = 2.0 / (t_1 * (((0.16666666666666666 * (k * k)) + 1.0) * (k * k))); else tmp = 2.0 / (t_1 * ((0.5 - (0.5 * cos((2.0 * k)))) / cos(k))); end tmp_2 = tmp; end
l_m = N[Abs[l], $MachinePrecision]
code[t_, l$95$m_, k_] := Block[{t$95$1 = N[(N[(N[(k * t), $MachinePrecision] / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 0.0025], N[(2.0 / N[(t$95$1 * N[(N[(N[(0.16666666666666666 * N[(k * k), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$1 * N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * k), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
t_1 := \frac{k \cdot t}{l\_m} \cdot \frac{k}{l\_m}\\
\mathbf{if}\;k \leq 0.0025:\\
\;\;\;\;\frac{2}{t\_1 \cdot \left(\left(0.16666666666666666 \cdot \left(k \cdot k\right) + 1\right) \cdot \left(k \cdot k\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \frac{0.5 - 0.5 \cdot \cos \left(2 \cdot k\right)}{\cos k}}\\
\end{array}
\end{array}
if k < 0.00250000000000000005Initial program 33.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6483.6
Applied rewrites83.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites90.5%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites93.9%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lower-*.f6481.4
Applied rewrites81.4%
if 0.00250000000000000005 < k Initial program 25.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites88.3%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites91.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-*.f6490.3
Applied rewrites90.3%
l_m = (fabs.f64 l)
(FPCore (t l_m k)
:precision binary64
(if (<= k 0.00044)
(/
2.0
(*
(* (/ (* k t) l_m) (/ k l_m))
(* (+ (* 0.16666666666666666 (* k k)) 1.0) (* k k))))
(if (<= k 1.02e+148)
(/ 2.0 (* (* k k) (* (/ t (cos k)) (ratio-of-squares (sin k) l_m))))
(/ 2.0 (* (ratio-of-squares k l_m) (/ (* (pow (sin k) 2.0) t) 1.0))))))\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00044:\\
\;\;\;\;\frac{2}{\left(\frac{k \cdot t}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \left(\left(0.16666666666666666 \cdot \left(k \cdot k\right) + 1\right) \cdot \left(k \cdot k\right)\right)}\\
\mathbf{elif}\;k \leq 1.02 \cdot 10^{+148}:\\
\;\;\;\;\frac{2}{\left(k \cdot k\right) \cdot \left(\frac{t}{\cos k} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, l\_m\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\mathsf{ratio\_of\_squares}\left(k, l\_m\right) \cdot \frac{{\sin k}^{2} \cdot t}{1}}\\
\end{array}
\end{array}
if k < 4.40000000000000016e-4Initial program 33.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6483.6
Applied rewrites83.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites90.5%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites93.9%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lower-*.f6481.4
Applied rewrites81.4%
if 4.40000000000000016e-4 < k < 1.02e148Initial program 21.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6469.0
Applied rewrites69.0%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites89.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites76.2%
if 1.02e148 < k Initial program 28.4%
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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6450.7
Applied rewrites50.7%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites87.4%
Taylor expanded in k around 0
Applied rewrites58.0%
l_m = (fabs.f64 l)
(FPCore (t l_m k)
:precision binary64
(if (<= k 2.1)
(/
2.0
(*
(* (/ (* k t) l_m) (/ k l_m))
(* (+ (* 0.16666666666666666 (* k k)) 1.0) (* k k))))
(/
2.0
(*
(ratio-of-squares k l_m)
(/ (* (- 0.5 (* 0.5 (cos (+ k k)))) t) (cos k))))))\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.1:\\
\;\;\;\;\frac{2}{\left(\frac{k \cdot t}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \left(\left(0.16666666666666666 \cdot \left(k \cdot k\right) + 1\right) \cdot \left(k \cdot k\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\mathsf{ratio\_of\_squares}\left(k, l\_m\right) \cdot \frac{\left(0.5 - 0.5 \cdot \cos \left(k + k\right)\right) \cdot t}{\cos k}}\\
\end{array}
\end{array}
if k < 2.10000000000000009Initial program 33.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6483.6
Applied rewrites83.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites90.5%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites93.9%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lower-*.f6481.4
Applied rewrites81.4%
if 2.10000000000000009 < k Initial program 25.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6458.6
Applied rewrites58.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites88.3%
lift-pow.f64N/A
lift-sin.f64N/A
pow2N/A
sqr-sin-aN/A
lower--.f64N/A
lower-*.f64N/A
cos-2N/A
cos-sumN/A
lower-cos.f64N/A
lower-+.f6487.6
Applied rewrites87.6%
l_m = (fabs.f64 l)
(FPCore (t l_m k)
:precision binary64
(if (<= k 0.00032)
(/
2.0
(*
(* (/ (* k t) l_m) (/ k l_m))
(* (+ (* 0.16666666666666666 (* k k)) 1.0) (* k k))))
(if (<= k 1.02e+148)
(* (* (/ (cos k) (* (* k k) t)) (ratio-of-squares l_m (sin k))) 2.0)
(/ 2.0 (* (ratio-of-squares k l_m) (/ (* (pow (sin k) 2.0) t) 1.0))))))\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00032:\\
\;\;\;\;\frac{2}{\left(\frac{k \cdot t}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \left(\left(0.16666666666666666 \cdot \left(k \cdot k\right) + 1\right) \cdot \left(k \cdot k\right)\right)}\\
\mathbf{elif}\;k \leq 1.02 \cdot 10^{+148}:\\
\;\;\;\;\left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \sin k\right)\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\mathsf{ratio\_of\_squares}\left(k, l\_m\right) \cdot \frac{{\sin k}^{2} \cdot t}{1}}\\
\end{array}
\end{array}
if k < 3.20000000000000026e-4Initial program 33.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6483.6
Applied rewrites83.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites90.5%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites93.9%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lower-*.f6481.4
Applied rewrites81.4%
if 3.20000000000000026e-4 < k < 1.02e148Initial program 21.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.8%
if 1.02e148 < k Initial program 28.4%
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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6450.7
Applied rewrites50.7%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites87.4%
Taylor expanded in k around 0
Applied rewrites58.0%
l_m = (fabs.f64 l)
(FPCore (t l_m k)
:precision binary64
(if (<= k 0.00032)
(/
2.0
(*
(* (/ (* k t) l_m) (/ k l_m))
(* (+ (* 0.16666666666666666 (* k k)) 1.0) (* k k))))
(if (<= k 1.02e+148)
(* (* (/ (cos k) (* (* k k) t)) (ratio-of-squares l_m (sin k))) 2.0)
(/
2.0
(*
(ratio-of-squares k l_m)
(/ (* (- 0.5 (* 0.5 (cos (* 2.0 k)))) t) 1.0))))))\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00032:\\
\;\;\;\;\frac{2}{\left(\frac{k \cdot t}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \left(\left(0.16666666666666666 \cdot \left(k \cdot k\right) + 1\right) \cdot \left(k \cdot k\right)\right)}\\
\mathbf{elif}\;k \leq 1.02 \cdot 10^{+148}:\\
\;\;\;\;\left(\frac{\cos k}{\left(k \cdot k\right) \cdot t} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \sin k\right)\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\mathsf{ratio\_of\_squares}\left(k, l\_m\right) \cdot \frac{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot k\right)\right) \cdot t}{1}}\\
\end{array}
\end{array}
if k < 3.20000000000000026e-4Initial program 33.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6483.6
Applied rewrites83.6%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites90.5%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites93.9%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lower-*.f6481.4
Applied rewrites81.4%
if 3.20000000000000026e-4 < k < 1.02e148Initial program 21.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.8%
if 1.02e148 < k Initial program 28.4%
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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6450.7
Applied rewrites50.7%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites87.4%
Taylor expanded in k around 0
Applied rewrites58.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-*.f6458.0
Applied rewrites58.0%
l_m = (fabs.f64 l) (FPCore (t l_m k) :precision binary64 (/ 2.0 (* (/ (* k (* k t)) (cos k)) (ratio-of-squares (sin k) l_m))))
\begin{array}{l}
l_m = \left|\ell\right|
\\
\frac{2}{\frac{k \cdot \left(k \cdot t\right)}{\cos k} \cdot \mathsf{ratio\_of\_squares}\left(\sin k, l\_m\right)}
\end{array}
Initial program 31.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6477.3
Applied rewrites77.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6481.3
Applied rewrites81.3%
l_m = (fabs.f64 l) (FPCore (t l_m k) :precision binary64 (/ 2.0 (* (* k (/ (* k t) (cos k))) (ratio-of-squares (sin k) l_m))))
\begin{array}{l}
l_m = \left|\ell\right|
\\
\frac{2}{\left(k \cdot \frac{k \cdot t}{\cos k}\right) \cdot \mathsf{ratio\_of\_squares}\left(\sin k, l\_m\right)}
\end{array}
Initial program 31.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6477.3
Applied rewrites77.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6481.3
Applied rewrites81.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-cos.f6481.3
Applied rewrites81.3%
l_m = (fabs.f64 l)
(FPCore (t l_m k)
:precision binary64
(if (<= k 1.32e+16)
(/
2.0
(*
(* (/ (* k t) l_m) (/ k l_m))
(* (+ (* 0.16666666666666666 (* k k)) 1.0) (* k k))))
(* (* (/ l_m k) (/ (/ l_m k) t)) -0.3333333333333333)))l_m = fabs(l);
double code(double t, double l_m, double k) {
double tmp;
if (k <= 1.32e+16) {
tmp = 2.0 / ((((k * t) / l_m) * (k / l_m)) * (((0.16666666666666666 * (k * k)) + 1.0) * (k * k)));
} else {
tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333;
}
return tmp;
}
l_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 1.32d+16) then
tmp = 2.0d0 / ((((k * t) / l_m) * (k / l_m)) * (((0.16666666666666666d0 * (k * k)) + 1.0d0) * (k * k)))
else
tmp = ((l_m / k) * ((l_m / k) / t)) * (-0.3333333333333333d0)
end if
code = tmp
end function
l_m = Math.abs(l);
public static double code(double t, double l_m, double k) {
double tmp;
if (k <= 1.32e+16) {
tmp = 2.0 / ((((k * t) / l_m) * (k / l_m)) * (((0.16666666666666666 * (k * k)) + 1.0) * (k * k)));
} else {
tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333;
}
return tmp;
}
l_m = math.fabs(l) def code(t, l_m, k): tmp = 0 if k <= 1.32e+16: tmp = 2.0 / ((((k * t) / l_m) * (k / l_m)) * (((0.16666666666666666 * (k * k)) + 1.0) * (k * k))) else: tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333 return tmp
l_m = abs(l) function code(t, l_m, k) tmp = 0.0 if (k <= 1.32e+16) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k * t) / l_m) * Float64(k / l_m)) * Float64(Float64(Float64(0.16666666666666666 * Float64(k * k)) + 1.0) * Float64(k * k)))); else tmp = Float64(Float64(Float64(l_m / k) * Float64(Float64(l_m / k) / t)) * -0.3333333333333333); end return tmp end
l_m = abs(l); function tmp_2 = code(t, l_m, k) tmp = 0.0; if (k <= 1.32e+16) tmp = 2.0 / ((((k * t) / l_m) * (k / l_m)) * (((0.16666666666666666 * (k * k)) + 1.0) * (k * k))); else tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333; end tmp_2 = tmp; end
l_m = N[Abs[l], $MachinePrecision] code[t_, l$95$m_, k_] := If[LessEqual[k, 1.32e+16], N[(2.0 / N[(N[(N[(N[(k * t), $MachinePrecision] / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.16666666666666666 * N[(k * k), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l$95$m / k), $MachinePrecision] * N[(N[(l$95$m / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.32 \cdot 10^{+16}:\\
\;\;\;\;\frac{2}{\left(\frac{k \cdot t}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \left(\left(0.16666666666666666 \cdot \left(k \cdot k\right) + 1\right) \cdot \left(k \cdot k\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{l\_m}{k} \cdot \frac{\frac{l\_m}{k}}{t}\right) \cdot -0.3333333333333333\\
\end{array}
\end{array}
if k < 1.32e16Initial program 33.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6484.0
Applied rewrites84.0%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites90.6%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites94.0%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lower-*.f6480.8
Applied rewrites80.8%
if 1.32e16 < k Initial program 25.5%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites25.4%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
pow2N/A
lower-ratio-of-squares.f6448.6
Applied rewrites48.6%
lift-ratio-of-squares.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6448.6
Applied rewrites48.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6449.1
Applied rewrites49.1%
l_m = (fabs.f64 l) (FPCore (t l_m k) :precision binary64 (if (<= k 1.32e+16) (/ 2.0 (* (* (/ (* k t) l_m) (/ k l_m)) (* k k))) (* (* (/ l_m k) (/ (/ l_m k) t)) -0.3333333333333333)))
l_m = fabs(l);
double code(double t, double l_m, double k) {
double tmp;
if (k <= 1.32e+16) {
tmp = 2.0 / ((((k * t) / l_m) * (k / l_m)) * (k * k));
} else {
tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333;
}
return tmp;
}
l_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 1.32d+16) then
tmp = 2.0d0 / ((((k * t) / l_m) * (k / l_m)) * (k * k))
else
tmp = ((l_m / k) * ((l_m / k) / t)) * (-0.3333333333333333d0)
end if
code = tmp
end function
l_m = Math.abs(l);
public static double code(double t, double l_m, double k) {
double tmp;
if (k <= 1.32e+16) {
tmp = 2.0 / ((((k * t) / l_m) * (k / l_m)) * (k * k));
} else {
tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333;
}
return tmp;
}
l_m = math.fabs(l) def code(t, l_m, k): tmp = 0 if k <= 1.32e+16: tmp = 2.0 / ((((k * t) / l_m) * (k / l_m)) * (k * k)) else: tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333 return tmp
l_m = abs(l) function code(t, l_m, k) tmp = 0.0 if (k <= 1.32e+16) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k * t) / l_m) * Float64(k / l_m)) * Float64(k * k))); else tmp = Float64(Float64(Float64(l_m / k) * Float64(Float64(l_m / k) / t)) * -0.3333333333333333); end return tmp end
l_m = abs(l); function tmp_2 = code(t, l_m, k) tmp = 0.0; if (k <= 1.32e+16) tmp = 2.0 / ((((k * t) / l_m) * (k / l_m)) * (k * k)); else tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333; end tmp_2 = tmp; end
l_m = N[Abs[l], $MachinePrecision] code[t_, l$95$m_, k_] := If[LessEqual[k, 1.32e+16], N[(2.0 / N[(N[(N[(N[(k * t), $MachinePrecision] / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l$95$m / k), $MachinePrecision] * N[(N[(l$95$m / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.32 \cdot 10^{+16}:\\
\;\;\;\;\frac{2}{\left(\frac{k \cdot t}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \left(k \cdot k\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{l\_m}{k} \cdot \frac{\frac{l\_m}{k}}{t}\right) \cdot -0.3333333333333333\\
\end{array}
\end{array}
if k < 1.32e16Initial program 33.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6484.0
Applied rewrites84.0%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites90.6%
lift-*.f64N/A
lift-ratio-of-squares.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
pow2N/A
pow2N/A
frac-timesN/A
*-commutativeN/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites94.0%
Taylor expanded in k around 0
pow2N/A
lower-*.f6480.7
Applied rewrites80.7%
if 1.32e16 < k Initial program 25.5%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites25.4%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
pow2N/A
lower-ratio-of-squares.f6448.6
Applied rewrites48.6%
lift-ratio-of-squares.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6448.6
Applied rewrites48.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6449.1
Applied rewrites49.1%
l_m = (fabs.f64 l)
(FPCore (t l_m k)
:precision binary64
(let* ((t_1 (/ l_m (* k k))))
(if (<= k 1.32e+16)
(* (/ 2.0 t) (* t_1 t_1))
(* (* (/ l_m k) (/ (/ l_m k) t)) -0.3333333333333333))))l_m = fabs(l);
double code(double t, double l_m, double k) {
double t_1 = l_m / (k * k);
double tmp;
if (k <= 1.32e+16) {
tmp = (2.0 / t) * (t_1 * t_1);
} else {
tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333;
}
return tmp;
}
l_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = l_m / (k * k)
if (k <= 1.32d+16) then
tmp = (2.0d0 / t) * (t_1 * t_1)
else
tmp = ((l_m / k) * ((l_m / k) / t)) * (-0.3333333333333333d0)
end if
code = tmp
end function
l_m = Math.abs(l);
public static double code(double t, double l_m, double k) {
double t_1 = l_m / (k * k);
double tmp;
if (k <= 1.32e+16) {
tmp = (2.0 / t) * (t_1 * t_1);
} else {
tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333;
}
return tmp;
}
l_m = math.fabs(l) def code(t, l_m, k): t_1 = l_m / (k * k) tmp = 0 if k <= 1.32e+16: tmp = (2.0 / t) * (t_1 * t_1) else: tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333 return tmp
l_m = abs(l) function code(t, l_m, k) t_1 = Float64(l_m / Float64(k * k)) tmp = 0.0 if (k <= 1.32e+16) tmp = Float64(Float64(2.0 / t) * Float64(t_1 * t_1)); else tmp = Float64(Float64(Float64(l_m / k) * Float64(Float64(l_m / k) / t)) * -0.3333333333333333); end return tmp end
l_m = abs(l); function tmp_2 = code(t, l_m, k) t_1 = l_m / (k * k); tmp = 0.0; if (k <= 1.32e+16) tmp = (2.0 / t) * (t_1 * t_1); else tmp = ((l_m / k) * ((l_m / k) / t)) * -0.3333333333333333; end tmp_2 = tmp; end
l_m = N[Abs[l], $MachinePrecision]
code[t_, l$95$m_, k_] := Block[{t$95$1 = N[(l$95$m / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1.32e+16], N[(N[(2.0 / t), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l$95$m / k), $MachinePrecision] * N[(N[(l$95$m / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
t_1 := \frac{l\_m}{k \cdot k}\\
\mathbf{if}\;k \leq 1.32 \cdot 10^{+16}:\\
\;\;\;\;\frac{2}{t} \cdot \left(t\_1 \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{l\_m}{k} \cdot \frac{\frac{l\_m}{k}}{t}\right) \cdot -0.3333333333333333\\
\end{array}
\end{array}
if k < 1.32e16Initial program 33.6%
Taylor expanded in k around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
metadata-evalN/A
pow-prod-upN/A
lower-ratio-of-squares.f64N/A
unpow2N/A
lower-*.f6445.8
Applied rewrites45.8%
lift-*.f64N/A
pow2N/A
lower-ratio-of-squares.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6478.5
Applied rewrites78.5%
if 1.32e16 < k Initial program 25.5%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites25.4%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
pow2N/A
lower-ratio-of-squares.f6448.6
Applied rewrites48.6%
lift-ratio-of-squares.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6448.6
Applied rewrites48.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6449.1
Applied rewrites49.1%
l_m = (fabs.f64 l) (FPCore (t l_m k) :precision binary64 (if (<= k 1.32e+16) (/ 2.0 (* (ratio-of-squares k l_m) (* (* k k) t))) (* (* (/ l_m k) (/ (/ l_m k) t)) -0.3333333333333333)))
\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.32 \cdot 10^{+16}:\\
\;\;\;\;\frac{2}{\mathsf{ratio\_of\_squares}\left(k, l\_m\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{l\_m}{k} \cdot \frac{\frac{l\_m}{k}}{t}\right) \cdot -0.3333333333333333\\
\end{array}
\end{array}
if k < 1.32e16Initial program 33.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6484.0
Applied rewrites84.0%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites90.6%
Taylor expanded in k around 0
lower-*.f64N/A
pow2N/A
lift-*.f6478.1
Applied rewrites78.1%
if 1.32e16 < k Initial program 25.5%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites25.4%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
pow2N/A
lower-ratio-of-squares.f6448.6
Applied rewrites48.6%
lift-ratio-of-squares.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6448.6
Applied rewrites48.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6449.1
Applied rewrites49.1%
l_m = (fabs.f64 l) (FPCore (t l_m k) :precision binary64 (if (<= k 1.32e+16) (/ 2.0 (* (ratio-of-squares k l_m) (* (* k k) t))) (* (/ (ratio-of-squares l_m k) t) -0.3333333333333333)))
\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.32 \cdot 10^{+16}:\\
\;\;\;\;\frac{2}{\mathsf{ratio\_of\_squares}\left(k, l\_m\right) \cdot \left(\left(k \cdot k\right) \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right)}{t} \cdot -0.3333333333333333\\
\end{array}
\end{array}
if k < 1.32e16Initial program 33.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
unpow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lift-sin.f6484.0
Applied rewrites84.0%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
lift-ratio-of-squares.f64N/A
pow2N/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
pow2N/A
pow2N/A
lower-ratio-of-squares.f64N/A
lower-/.f64N/A
Applied rewrites90.6%
Taylor expanded in k around 0
lower-*.f64N/A
pow2N/A
lift-*.f6478.1
Applied rewrites78.1%
if 1.32e16 < k Initial program 25.5%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites25.4%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
pow2N/A
lower-ratio-of-squares.f6448.6
Applied rewrites48.6%
l_m = (fabs.f64 l) (FPCore (t l_m k) :precision binary64 (if (<= k 1.32e+16) (* (/ (ratio-of-squares l_m (* k k)) t) 2.0) (* (/ (ratio-of-squares l_m k) t) -0.3333333333333333)))
\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.32 \cdot 10^{+16}:\\
\;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, \left(k \cdot k\right)\right)}{t} \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right)}{t} \cdot -0.3333333333333333\\
\end{array}
\end{array}
if k < 1.32e16Initial program 33.6%
Taylor expanded in k around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
metadata-evalN/A
pow-prod-upN/A
lower-ratio-of-squares.f64N/A
unpow2N/A
lower-*.f6445.8
Applied rewrites45.8%
Applied rewrites45.8%
if 1.32e16 < k Initial program 25.5%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites25.4%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
pow2N/A
lower-ratio-of-squares.f6448.6
Applied rewrites48.6%
l_m = (fabs.f64 l) (FPCore (t l_m k) :precision binary64 (if (<= k 1.32e+16) (* (/ 2.0 t) (ratio-of-squares l_m (* k k))) (* (/ (ratio-of-squares l_m k) t) -0.3333333333333333)))
\begin{array}{l}
l_m = \left|\ell\right|
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.32 \cdot 10^{+16}:\\
\;\;\;\;\frac{2}{t} \cdot \mathsf{ratio\_of\_squares}\left(l\_m, \left(k \cdot k\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right)}{t} \cdot -0.3333333333333333\\
\end{array}
\end{array}
if k < 1.32e16Initial program 33.6%
Taylor expanded in k around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
metadata-evalN/A
pow-prod-upN/A
lower-ratio-of-squares.f64N/A
unpow2N/A
lower-*.f6445.8
Applied rewrites45.8%
if 1.32e16 < k Initial program 25.5%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites25.4%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
pow2N/A
lower-ratio-of-squares.f6448.6
Applied rewrites48.6%
l_m = (fabs.f64 l) (FPCore (t l_m k) :precision binary64 (* (/ (ratio-of-squares l_m k) t) -0.3333333333333333))
\begin{array}{l}
l_m = \left|\ell\right|
\\
\frac{\mathsf{ratio\_of\_squares}\left(l\_m, k\right)}{t} \cdot -0.3333333333333333
\end{array}
Initial program 31.7%
Taylor expanded in k around 0
lower-/.f64N/A
Applied rewrites46.7%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
pow2N/A
lower-ratio-of-squares.f6428.8
Applied rewrites28.8%
herbie shell --seed 2025065
(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))))