
(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 21 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}
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(let* ((t_2 (pow (sin k) 2.0)))
(*
t_s
(if (<= t_m 2e+37)
(/ (* (* (/ (* (cos k) l) k) (/ l (* k t_m))) 2.0) t_2)
(/ 2.0 (* (* (/ t_2 l) (/ t_m (cos k))) (* (/ k l) k)))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double t_2 = pow(sin(k), 2.0);
double tmp;
if (t_m <= 2e+37) {
tmp = ((((cos(k) * l) / k) * (l / (k * t_m))) * 2.0) / t_2;
} else {
tmp = 2.0 / (((t_2 / l) * (t_m / cos(k))) * ((k / l) * k));
}
return t_s * tmp;
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = sin(k) ** 2.0d0
if (t_m <= 2d+37) then
tmp = ((((cos(k) * l) / k) * (l / (k * t_m))) * 2.0d0) / t_2
else
tmp = 2.0d0 / (((t_2 / l) * (t_m / cos(k))) * ((k / l) * k))
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
double t_2 = Math.pow(Math.sin(k), 2.0);
double tmp;
if (t_m <= 2e+37) {
tmp = ((((Math.cos(k) * l) / k) * (l / (k * t_m))) * 2.0) / t_2;
} else {
tmp = 2.0 / (((t_2 / l) * (t_m / Math.cos(k))) * ((k / l) * k));
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): t_2 = math.pow(math.sin(k), 2.0) tmp = 0 if t_m <= 2e+37: tmp = ((((math.cos(k) * l) / k) * (l / (k * t_m))) * 2.0) / t_2 else: tmp = 2.0 / (((t_2 / l) * (t_m / math.cos(k))) * ((k / l) * k)) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) t_2 = sin(k) ^ 2.0 tmp = 0.0 if (t_m <= 2e+37) tmp = Float64(Float64(Float64(Float64(Float64(cos(k) * l) / k) * Float64(l / Float64(k * t_m))) * 2.0) / t_2); else tmp = Float64(2.0 / Float64(Float64(Float64(t_2 / l) * Float64(t_m / cos(k))) * Float64(Float64(k / l) * k))); end return Float64(t_s * tmp) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l, k) t_2 = sin(k) ^ 2.0; tmp = 0.0; if (t_m <= 2e+37) tmp = ((((cos(k) * l) / k) * (l / (k * t_m))) * 2.0) / t_2; else tmp = 2.0 / (((t_2 / l) * (t_m / cos(k))) * ((k / l) * k)); end tmp_2 = t_s * tmp; end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 2e+37], N[(N[(N[(N[(N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision] / k), $MachinePrecision] * N[(l / N[(k * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] / t$95$2), $MachinePrecision], N[(2.0 / N[(N[(N[(t$95$2 / l), $MachinePrecision] * N[(t$95$m / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(k / l), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := {\sin k}^{2}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 2 \cdot 10^{+37}:\\
\;\;\;\;\frac{\left(\frac{\cos k \cdot \ell}{k} \cdot \frac{\ell}{k \cdot t\_m}\right) \cdot 2}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{t\_2}{\ell} \cdot \frac{t\_m}{\cos k}\right) \cdot \left(\frac{k}{\ell} \cdot k\right)}\\
\end{array}
\end{array}
\end{array}
if t < 1.99999999999999991e37Initial program 36.3%
Taylor expanded in t around 0
Applied rewrites72.3%
Applied rewrites71.5%
Applied rewrites94.9%
if 1.99999999999999991e37 < t Initial program 23.9%
Taylor expanded in t around 0
Applied rewrites82.6%
Applied rewrites87.0%
Applied rewrites88.6%
Applied rewrites98.1%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(let* ((t_2 (* (cos k) l)) (t_3 (pow (sin k) 2.0)))
(*
t_s
(if (<= k 9.5e-12)
(/ 2.0 (* (* (* (/ t_m (cos k)) k) (/ k l)) (* k (/ k l))))
(if (<= k 5e+135)
(* (/ t_2 (* k k)) (/ (* l 2.0) (* t_3 t_m)))
(/ (* (* (/ t_2 k) (/ l (* k t_m))) 2.0) t_3))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double t_2 = cos(k) * l;
double t_3 = pow(sin(k), 2.0);
double tmp;
if (k <= 9.5e-12) {
tmp = 2.0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l)));
} else if (k <= 5e+135) {
tmp = (t_2 / (k * k)) * ((l * 2.0) / (t_3 * t_m));
} else {
tmp = (((t_2 / k) * (l / (k * t_m))) * 2.0) / t_3;
}
return t_s * tmp;
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_2 = cos(k) * l
t_3 = sin(k) ** 2.0d0
if (k <= 9.5d-12) then
tmp = 2.0d0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l)))
else if (k <= 5d+135) then
tmp = (t_2 / (k * k)) * ((l * 2.0d0) / (t_3 * t_m))
else
tmp = (((t_2 / k) * (l / (k * t_m))) * 2.0d0) / t_3
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
double t_2 = Math.cos(k) * l;
double t_3 = Math.pow(Math.sin(k), 2.0);
double tmp;
if (k <= 9.5e-12) {
tmp = 2.0 / ((((t_m / Math.cos(k)) * k) * (k / l)) * (k * (k / l)));
} else if (k <= 5e+135) {
tmp = (t_2 / (k * k)) * ((l * 2.0) / (t_3 * t_m));
} else {
tmp = (((t_2 / k) * (l / (k * t_m))) * 2.0) / t_3;
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): t_2 = math.cos(k) * l t_3 = math.pow(math.sin(k), 2.0) tmp = 0 if k <= 9.5e-12: tmp = 2.0 / ((((t_m / math.cos(k)) * k) * (k / l)) * (k * (k / l))) elif k <= 5e+135: tmp = (t_2 / (k * k)) * ((l * 2.0) / (t_3 * t_m)) else: tmp = (((t_2 / k) * (l / (k * t_m))) * 2.0) / t_3 return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) t_2 = Float64(cos(k) * l) t_3 = sin(k) ^ 2.0 tmp = 0.0 if (k <= 9.5e-12) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(t_m / cos(k)) * k) * Float64(k / l)) * Float64(k * Float64(k / l)))); elseif (k <= 5e+135) tmp = Float64(Float64(t_2 / Float64(k * k)) * Float64(Float64(l * 2.0) / Float64(t_3 * t_m))); else tmp = Float64(Float64(Float64(Float64(t_2 / k) * Float64(l / Float64(k * t_m))) * 2.0) / t_3); end return Float64(t_s * tmp) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l, k) t_2 = cos(k) * l; t_3 = sin(k) ^ 2.0; tmp = 0.0; if (k <= 9.5e-12) tmp = 2.0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l))); elseif (k <= 5e+135) tmp = (t_2 / (k * k)) * ((l * 2.0) / (t_3 * t_m)); else tmp = (((t_2 / k) * (l / (k * t_m))) * 2.0) / t_3; end tmp_2 = t_s * tmp; end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, N[(t$95$s * If[LessEqual[k, 9.5e-12], N[(2.0 / N[(N[(N[(N[(t$95$m / N[Cos[k], $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 5e+135], N[(N[(t$95$2 / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(N[(l * 2.0), $MachinePrecision] / N[(t$95$3 * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t$95$2 / k), $MachinePrecision] * N[(l / N[(k * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] / t$95$3), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \cos k \cdot \ell\\
t_3 := {\sin k}^{2}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 9.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{t\_m}{\cos k} \cdot k\right) \cdot \frac{k}{\ell}\right) \cdot \left(k \cdot \frac{k}{\ell}\right)}\\
\mathbf{elif}\;k \leq 5 \cdot 10^{+135}:\\
\;\;\;\;\frac{t\_2}{k \cdot k} \cdot \frac{\ell \cdot 2}{t\_3 \cdot t\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{t\_2}{k} \cdot \frac{\ell}{k \cdot t\_m}\right) \cdot 2}{t\_3}\\
\end{array}
\end{array}
\end{array}
if k < 9.4999999999999995e-12Initial program 37.7%
Taylor expanded in t around 0
Applied rewrites79.0%
Applied rewrites87.7%
Applied rewrites92.7%
Taylor expanded in k around 0
Applied rewrites81.4%
if 9.4999999999999995e-12 < k < 5.00000000000000029e135Initial program 30.9%
Taylor expanded in t around 0
Applied rewrites85.2%
Applied rewrites85.3%
Applied rewrites99.6%
if 5.00000000000000029e135 < k Initial program 13.3%
Taylor expanded in t around 0
Applied rewrites46.0%
Applied rewrites46.0%
Applied rewrites87.2%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(let* ((t_2 (* (cos k) l)) (t_3 (pow (sin k) 2.0)))
(*
t_s
(if (<= k 9.5e-12)
(/ 2.0 (* (* (* (/ t_m (cos k)) k) (/ k l)) (* k (/ k l))))
(if (<= k 4.4e+135)
(* (/ t_2 (* k k)) (/ (* l 2.0) (* t_3 t_m)))
(* (/ 2.0 t_3) (* (/ t_2 k) (/ l (* k t_m)))))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double t_2 = cos(k) * l;
double t_3 = pow(sin(k), 2.0);
double tmp;
if (k <= 9.5e-12) {
tmp = 2.0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l)));
} else if (k <= 4.4e+135) {
tmp = (t_2 / (k * k)) * ((l * 2.0) / (t_3 * t_m));
} else {
tmp = (2.0 / t_3) * ((t_2 / k) * (l / (k * t_m)));
}
return t_s * tmp;
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_2 = cos(k) * l
t_3 = sin(k) ** 2.0d0
if (k <= 9.5d-12) then
tmp = 2.0d0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l)))
else if (k <= 4.4d+135) then
tmp = (t_2 / (k * k)) * ((l * 2.0d0) / (t_3 * t_m))
else
tmp = (2.0d0 / t_3) * ((t_2 / k) * (l / (k * t_m)))
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
double t_2 = Math.cos(k) * l;
double t_3 = Math.pow(Math.sin(k), 2.0);
double tmp;
if (k <= 9.5e-12) {
tmp = 2.0 / ((((t_m / Math.cos(k)) * k) * (k / l)) * (k * (k / l)));
} else if (k <= 4.4e+135) {
tmp = (t_2 / (k * k)) * ((l * 2.0) / (t_3 * t_m));
} else {
tmp = (2.0 / t_3) * ((t_2 / k) * (l / (k * t_m)));
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): t_2 = math.cos(k) * l t_3 = math.pow(math.sin(k), 2.0) tmp = 0 if k <= 9.5e-12: tmp = 2.0 / ((((t_m / math.cos(k)) * k) * (k / l)) * (k * (k / l))) elif k <= 4.4e+135: tmp = (t_2 / (k * k)) * ((l * 2.0) / (t_3 * t_m)) else: tmp = (2.0 / t_3) * ((t_2 / k) * (l / (k * t_m))) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) t_2 = Float64(cos(k) * l) t_3 = sin(k) ^ 2.0 tmp = 0.0 if (k <= 9.5e-12) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(t_m / cos(k)) * k) * Float64(k / l)) * Float64(k * Float64(k / l)))); elseif (k <= 4.4e+135) tmp = Float64(Float64(t_2 / Float64(k * k)) * Float64(Float64(l * 2.0) / Float64(t_3 * t_m))); else tmp = Float64(Float64(2.0 / t_3) * Float64(Float64(t_2 / k) * Float64(l / Float64(k * t_m)))); end return Float64(t_s * tmp) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l, k) t_2 = cos(k) * l; t_3 = sin(k) ^ 2.0; tmp = 0.0; if (k <= 9.5e-12) tmp = 2.0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l))); elseif (k <= 4.4e+135) tmp = (t_2 / (k * k)) * ((l * 2.0) / (t_3 * t_m)); else tmp = (2.0 / t_3) * ((t_2 / k) * (l / (k * t_m))); end tmp_2 = t_s * tmp; end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, N[(t$95$s * If[LessEqual[k, 9.5e-12], N[(2.0 / N[(N[(N[(N[(t$95$m / N[Cos[k], $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 4.4e+135], N[(N[(t$95$2 / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(N[(l * 2.0), $MachinePrecision] / N[(t$95$3 * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / t$95$3), $MachinePrecision] * N[(N[(t$95$2 / k), $MachinePrecision] * N[(l / N[(k * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \cos k \cdot \ell\\
t_3 := {\sin k}^{2}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 9.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{t\_m}{\cos k} \cdot k\right) \cdot \frac{k}{\ell}\right) \cdot \left(k \cdot \frac{k}{\ell}\right)}\\
\mathbf{elif}\;k \leq 4.4 \cdot 10^{+135}:\\
\;\;\;\;\frac{t\_2}{k \cdot k} \cdot \frac{\ell \cdot 2}{t\_3 \cdot t\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_3} \cdot \left(\frac{t\_2}{k} \cdot \frac{\ell}{k \cdot t\_m}\right)\\
\end{array}
\end{array}
\end{array}
if k < 9.4999999999999995e-12Initial program 37.7%
Taylor expanded in t around 0
Applied rewrites79.0%
Applied rewrites87.7%
Applied rewrites92.7%
Taylor expanded in k around 0
Applied rewrites81.4%
if 9.4999999999999995e-12 < k < 4.3999999999999999e135Initial program 30.9%
Taylor expanded in t around 0
Applied rewrites85.2%
Applied rewrites85.3%
Applied rewrites99.6%
if 4.3999999999999999e135 < k Initial program 13.3%
Taylor expanded in t around 0
Applied rewrites46.0%
Applied rewrites46.0%
Applied rewrites87.2%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(let* ((t_2 (* (* (/ t_m (cos k)) k) (/ k l))))
(*
t_s
(if (<= k 9.5e-12)
(/ 2.0 (* t_2 (* k (/ k l))))
(if (<= k 4.3e+135)
(* (/ (* (cos k) l) (* k k)) (/ (* l 2.0) (* (pow (sin k) 2.0) t_m)))
(/ 2.0 (* t_2 (/ (- 0.5 (* 0.5 (cos (* k 2.0)))) l))))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double t_2 = ((t_m / cos(k)) * k) * (k / l);
double tmp;
if (k <= 9.5e-12) {
tmp = 2.0 / (t_2 * (k * (k / l)));
} else if (k <= 4.3e+135) {
tmp = ((cos(k) * l) / (k * k)) * ((l * 2.0) / (pow(sin(k), 2.0) * t_m));
} else {
tmp = 2.0 / (t_2 * ((0.5 - (0.5 * cos((k * 2.0)))) / l));
}
return t_s * tmp;
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = ((t_m / cos(k)) * k) * (k / l)
if (k <= 9.5d-12) then
tmp = 2.0d0 / (t_2 * (k * (k / l)))
else if (k <= 4.3d+135) then
tmp = ((cos(k) * l) / (k * k)) * ((l * 2.0d0) / ((sin(k) ** 2.0d0) * t_m))
else
tmp = 2.0d0 / (t_2 * ((0.5d0 - (0.5d0 * cos((k * 2.0d0)))) / l))
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
double t_2 = ((t_m / Math.cos(k)) * k) * (k / l);
double tmp;
if (k <= 9.5e-12) {
tmp = 2.0 / (t_2 * (k * (k / l)));
} else if (k <= 4.3e+135) {
tmp = ((Math.cos(k) * l) / (k * k)) * ((l * 2.0) / (Math.pow(Math.sin(k), 2.0) * t_m));
} else {
tmp = 2.0 / (t_2 * ((0.5 - (0.5 * Math.cos((k * 2.0)))) / l));
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): t_2 = ((t_m / math.cos(k)) * k) * (k / l) tmp = 0 if k <= 9.5e-12: tmp = 2.0 / (t_2 * (k * (k / l))) elif k <= 4.3e+135: tmp = ((math.cos(k) * l) / (k * k)) * ((l * 2.0) / (math.pow(math.sin(k), 2.0) * t_m)) else: tmp = 2.0 / (t_2 * ((0.5 - (0.5 * math.cos((k * 2.0)))) / l)) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) t_2 = Float64(Float64(Float64(t_m / cos(k)) * k) * Float64(k / l)) tmp = 0.0 if (k <= 9.5e-12) tmp = Float64(2.0 / Float64(t_2 * Float64(k * Float64(k / l)))); elseif (k <= 4.3e+135) tmp = Float64(Float64(Float64(cos(k) * l) / Float64(k * k)) * Float64(Float64(l * 2.0) / Float64((sin(k) ^ 2.0) * t_m))); else tmp = Float64(2.0 / Float64(t_2 * Float64(Float64(0.5 - Float64(0.5 * cos(Float64(k * 2.0)))) / l))); end return Float64(t_s * tmp) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l, k) t_2 = ((t_m / cos(k)) * k) * (k / l); tmp = 0.0; if (k <= 9.5e-12) tmp = 2.0 / (t_2 * (k * (k / l))); elseif (k <= 4.3e+135) tmp = ((cos(k) * l) / (k * k)) * ((l * 2.0) / ((sin(k) ^ 2.0) * t_m)); else tmp = 2.0 / (t_2 * ((0.5 - (0.5 * cos((k * 2.0)))) / l)); end tmp_2 = t_s * tmp; end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[(N[(N[(t$95$m / N[Cos[k], $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[k, 9.5e-12], N[(2.0 / N[(t$95$2 * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 4.3e+135], N[(N[(N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(N[(l * 2.0), $MachinePrecision] / N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$2 * N[(N[(0.5 - N[(0.5 * N[Cos[N[(k * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \left(\frac{t\_m}{\cos k} \cdot k\right) \cdot \frac{k}{\ell}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 9.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{2}{t\_2 \cdot \left(k \cdot \frac{k}{\ell}\right)}\\
\mathbf{elif}\;k \leq 4.3 \cdot 10^{+135}:\\
\;\;\;\;\frac{\cos k \cdot \ell}{k \cdot k} \cdot \frac{\ell \cdot 2}{{\sin k}^{2} \cdot t\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_2 \cdot \frac{0.5 - 0.5 \cdot \cos \left(k \cdot 2\right)}{\ell}}\\
\end{array}
\end{array}
\end{array}
if k < 9.4999999999999995e-12Initial program 37.7%
Taylor expanded in t around 0
Applied rewrites79.0%
Applied rewrites87.7%
Applied rewrites92.7%
Taylor expanded in k around 0
Applied rewrites81.4%
if 9.4999999999999995e-12 < k < 4.29999999999999972e135Initial program 30.9%
Taylor expanded in t around 0
Applied rewrites85.2%
Applied rewrites85.3%
Applied rewrites99.6%
if 4.29999999999999972e135 < k Initial program 13.3%
Taylor expanded in t around 0
Applied rewrites46.0%
Applied rewrites49.4%
Applied rewrites87.0%
Applied rewrites86.8%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(let* ((t_2 (* (* (/ t_m (cos k)) k) (/ k l))))
(*
t_s
(if (<= k 2.7e-8)
(/ 2.0 (* t_2 (* k (/ k l))))
(/ 2.0 (* t_2 (/ (- 0.5 (* 0.5 (cos (* k 2.0)))) l)))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double t_2 = ((t_m / cos(k)) * k) * (k / l);
double tmp;
if (k <= 2.7e-8) {
tmp = 2.0 / (t_2 * (k * (k / l)));
} else {
tmp = 2.0 / (t_2 * ((0.5 - (0.5 * cos((k * 2.0)))) / l));
}
return t_s * tmp;
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = ((t_m / cos(k)) * k) * (k / l)
if (k <= 2.7d-8) then
tmp = 2.0d0 / (t_2 * (k * (k / l)))
else
tmp = 2.0d0 / (t_2 * ((0.5d0 - (0.5d0 * cos((k * 2.0d0)))) / l))
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
double t_2 = ((t_m / Math.cos(k)) * k) * (k / l);
double tmp;
if (k <= 2.7e-8) {
tmp = 2.0 / (t_2 * (k * (k / l)));
} else {
tmp = 2.0 / (t_2 * ((0.5 - (0.5 * Math.cos((k * 2.0)))) / l));
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): t_2 = ((t_m / math.cos(k)) * k) * (k / l) tmp = 0 if k <= 2.7e-8: tmp = 2.0 / (t_2 * (k * (k / l))) else: tmp = 2.0 / (t_2 * ((0.5 - (0.5 * math.cos((k * 2.0)))) / l)) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) t_2 = Float64(Float64(Float64(t_m / cos(k)) * k) * Float64(k / l)) tmp = 0.0 if (k <= 2.7e-8) tmp = Float64(2.0 / Float64(t_2 * Float64(k * Float64(k / l)))); else tmp = Float64(2.0 / Float64(t_2 * Float64(Float64(0.5 - Float64(0.5 * cos(Float64(k * 2.0)))) / l))); end return Float64(t_s * tmp) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l, k) t_2 = ((t_m / cos(k)) * k) * (k / l); tmp = 0.0; if (k <= 2.7e-8) tmp = 2.0 / (t_2 * (k * (k / l))); else tmp = 2.0 / (t_2 * ((0.5 - (0.5 * cos((k * 2.0)))) / l)); end tmp_2 = t_s * tmp; end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[(N[(N[(t$95$m / N[Cos[k], $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[k, 2.7e-8], N[(2.0 / N[(t$95$2 * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$2 * N[(N[(0.5 - N[(0.5 * N[Cos[N[(k * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \left(\frac{t\_m}{\cos k} \cdot k\right) \cdot \frac{k}{\ell}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 2.7 \cdot 10^{-8}:\\
\;\;\;\;\frac{2}{t\_2 \cdot \left(k \cdot \frac{k}{\ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_2 \cdot \frac{0.5 - 0.5 \cdot \cos \left(k \cdot 2\right)}{\ell}}\\
\end{array}
\end{array}
\end{array}
if k < 2.70000000000000002e-8Initial program 37.7%
Taylor expanded in t around 0
Applied rewrites79.0%
Applied rewrites87.7%
Applied rewrites92.7%
Taylor expanded in k around 0
Applied rewrites81.4%
if 2.70000000000000002e-8 < k Initial program 20.5%
Taylor expanded in t around 0
Applied rewrites62.0%
Applied rewrites65.5%
Applied rewrites90.6%
Applied rewrites90.0%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(*
t_s
(if (<= k 2.7e-8)
(/ 2.0 (* (* (* (/ t_m (cos k)) k) (/ k l)) (* k (/ k l))))
(/
(* (* (* (cos k) l) l) 2.0)
(* (* (* k k) t_m) (- 0.5 (* 0.5 (cos (* k 2.0)))))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double tmp;
if (k <= 2.7e-8) {
tmp = 2.0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l)));
} else {
tmp = (((cos(k) * l) * l) * 2.0) / (((k * k) * t_m) * (0.5 - (0.5 * cos((k * 2.0)))));
}
return t_s * tmp;
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 2.7d-8) then
tmp = 2.0d0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l)))
else
tmp = (((cos(k) * l) * l) * 2.0d0) / (((k * k) * t_m) * (0.5d0 - (0.5d0 * cos((k * 2.0d0)))))
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
double tmp;
if (k <= 2.7e-8) {
tmp = 2.0 / ((((t_m / Math.cos(k)) * k) * (k / l)) * (k * (k / l)));
} else {
tmp = (((Math.cos(k) * l) * l) * 2.0) / (((k * k) * t_m) * (0.5 - (0.5 * Math.cos((k * 2.0)))));
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): tmp = 0 if k <= 2.7e-8: tmp = 2.0 / ((((t_m / math.cos(k)) * k) * (k / l)) * (k * (k / l))) else: tmp = (((math.cos(k) * l) * l) * 2.0) / (((k * k) * t_m) * (0.5 - (0.5 * math.cos((k * 2.0))))) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) tmp = 0.0 if (k <= 2.7e-8) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(t_m / cos(k)) * k) * Float64(k / l)) * Float64(k * Float64(k / l)))); else tmp = Float64(Float64(Float64(Float64(cos(k) * l) * l) * 2.0) / Float64(Float64(Float64(k * k) * t_m) * Float64(0.5 - Float64(0.5 * cos(Float64(k * 2.0)))))); end return Float64(t_s * tmp) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l, k) tmp = 0.0; if (k <= 2.7e-8) tmp = 2.0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l))); else tmp = (((cos(k) * l) * l) * 2.0) / (((k * k) * t_m) * (0.5 - (0.5 * cos((k * 2.0))))); end tmp_2 = t_s * tmp; end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * If[LessEqual[k, 2.7e-8], N[(2.0 / N[(N[(N[(N[(t$95$m / N[Cos[k], $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] * 2.0), $MachinePrecision] / N[(N[(N[(k * k), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(0.5 - N[(0.5 * N[Cos[N[(k * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 2.7 \cdot 10^{-8}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{t\_m}{\cos k} \cdot k\right) \cdot \frac{k}{\ell}\right) \cdot \left(k \cdot \frac{k}{\ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\cos k \cdot \ell\right) \cdot \ell\right) \cdot 2}{\left(\left(k \cdot k\right) \cdot t\_m\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(k \cdot 2\right)\right)}\\
\end{array}
\end{array}
if k < 2.70000000000000002e-8Initial program 37.7%
Taylor expanded in t around 0
Applied rewrites79.0%
Applied rewrites87.7%
Applied rewrites92.7%
Taylor expanded in k around 0
Applied rewrites81.4%
if 2.70000000000000002e-8 < k Initial program 20.5%
Taylor expanded in t around 0
Applied rewrites61.9%
Applied rewrites62.0%
Applied rewrites61.4%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(let* ((t_2 (* (* k k) t_m)))
(*
t_s
(if (<= l 2.2e+181)
(/ 2.0 (* t_2 (/ (* k (/ k l)) l)))
(/ 2.0 (* (/ t_2 (cos k)) (/ (* k k) (* l l))))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double t_2 = (k * k) * t_m;
double tmp;
if (l <= 2.2e+181) {
tmp = 2.0 / (t_2 * ((k * (k / l)) / l));
} else {
tmp = 2.0 / ((t_2 / cos(k)) * ((k * k) / (l * l)));
}
return t_s * tmp;
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = (k * k) * t_m
if (l <= 2.2d+181) then
tmp = 2.0d0 / (t_2 * ((k * (k / l)) / l))
else
tmp = 2.0d0 / ((t_2 / cos(k)) * ((k * k) / (l * l)))
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
double t_2 = (k * k) * t_m;
double tmp;
if (l <= 2.2e+181) {
tmp = 2.0 / (t_2 * ((k * (k / l)) / l));
} else {
tmp = 2.0 / ((t_2 / Math.cos(k)) * ((k * k) / (l * l)));
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): t_2 = (k * k) * t_m tmp = 0 if l <= 2.2e+181: tmp = 2.0 / (t_2 * ((k * (k / l)) / l)) else: tmp = 2.0 / ((t_2 / math.cos(k)) * ((k * k) / (l * l))) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) t_2 = Float64(Float64(k * k) * t_m) tmp = 0.0 if (l <= 2.2e+181) tmp = Float64(2.0 / Float64(t_2 * Float64(Float64(k * Float64(k / l)) / l))); else tmp = Float64(2.0 / Float64(Float64(t_2 / cos(k)) * Float64(Float64(k * k) / Float64(l * l)))); end return Float64(t_s * tmp) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l, k) t_2 = (k * k) * t_m; tmp = 0.0; if (l <= 2.2e+181) tmp = 2.0 / (t_2 * ((k * (k / l)) / l)); else tmp = 2.0 / ((t_2 / cos(k)) * ((k * k) / (l * l))); end tmp_2 = t_s * tmp; end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[(N[(k * k), $MachinePrecision] * t$95$m), $MachinePrecision]}, N[(t$95$s * If[LessEqual[l, 2.2e+181], N[(2.0 / N[(t$95$2 * N[(N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t$95$2 / N[Cos[k], $MachinePrecision]), $MachinePrecision] * N[(N[(k * k), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \left(k \cdot k\right) \cdot t\_m\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\ell \leq 2.2 \cdot 10^{+181}:\\
\;\;\;\;\frac{2}{t\_2 \cdot \frac{k \cdot \frac{k}{\ell}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t\_2}{\cos k} \cdot \frac{k \cdot k}{\ell \cdot \ell}}\\
\end{array}
\end{array}
\end{array}
if l < 2.2000000000000001e181Initial program 33.2%
Taylor expanded in t around 0
Applied rewrites76.4%
Taylor expanded in k around 0
Applied rewrites68.6%
Taylor expanded in k around 0
Applied rewrites69.0%
Taylor expanded in k around 0
Applied rewrites72.7%
if 2.2000000000000001e181 < l Initial program 34.7%
Taylor expanded in t around 0
Applied rewrites63.1%
Taylor expanded in k around 0
Applied rewrites63.1%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l k) :precision binary64 (* t_s (/ 2.0 (* (* (* (/ t_m (cos k)) k) (/ k l)) (* k (/ k l))))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
return t_s * (2.0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l))));
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
code = t_s * (2.0d0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l))))
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
return t_s * (2.0 / ((((t_m / Math.cos(k)) * k) * (k / l)) * (k * (k / l))));
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): return t_s * (2.0 / ((((t_m / math.cos(k)) * k) * (k / l)) * (k * (k / l))))
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) return Float64(t_s * Float64(2.0 / Float64(Float64(Float64(Float64(t_m / cos(k)) * k) * Float64(k / l)) * Float64(k * Float64(k / l))))) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l, k) tmp = t_s * (2.0 / ((((t_m / cos(k)) * k) * (k / l)) * (k * (k / l)))); end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * N[(2.0 / N[(N[(N[(N[(t$95$m / N[Cos[k], $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision] * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \frac{2}{\left(\left(\frac{t\_m}{\cos k} \cdot k\right) \cdot \frac{k}{\ell}\right) \cdot \left(k \cdot \frac{k}{\ell}\right)}
\end{array}
Initial program 33.4%
Taylor expanded in t around 0
Applied rewrites74.7%
Applied rewrites82.2%
Applied rewrites92.2%
Taylor expanded in k around 0
Applied rewrites73.7%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(let* ((t_2 (* (* k k) t_m)))
(*
t_s
(if (<= l 2.2e+181)
(/ 2.0 (* t_2 (/ (* k (/ k l)) l)))
(* (/ 2.0 t_2) (/ (* (* (cos k) l) l) (* k k)))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double t_2 = (k * k) * t_m;
double tmp;
if (l <= 2.2e+181) {
tmp = 2.0 / (t_2 * ((k * (k / l)) / l));
} else {
tmp = (2.0 / t_2) * (((cos(k) * l) * l) / (k * k));
}
return t_s * tmp;
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = (k * k) * t_m
if (l <= 2.2d+181) then
tmp = 2.0d0 / (t_2 * ((k * (k / l)) / l))
else
tmp = (2.0d0 / t_2) * (((cos(k) * l) * l) / (k * k))
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
double t_2 = (k * k) * t_m;
double tmp;
if (l <= 2.2e+181) {
tmp = 2.0 / (t_2 * ((k * (k / l)) / l));
} else {
tmp = (2.0 / t_2) * (((Math.cos(k) * l) * l) / (k * k));
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): t_2 = (k * k) * t_m tmp = 0 if l <= 2.2e+181: tmp = 2.0 / (t_2 * ((k * (k / l)) / l)) else: tmp = (2.0 / t_2) * (((math.cos(k) * l) * l) / (k * k)) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) t_2 = Float64(Float64(k * k) * t_m) tmp = 0.0 if (l <= 2.2e+181) tmp = Float64(2.0 / Float64(t_2 * Float64(Float64(k * Float64(k / l)) / l))); else tmp = Float64(Float64(2.0 / t_2) * Float64(Float64(Float64(cos(k) * l) * l) / Float64(k * k))); end return Float64(t_s * tmp) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l, k) t_2 = (k * k) * t_m; tmp = 0.0; if (l <= 2.2e+181) tmp = 2.0 / (t_2 * ((k * (k / l)) / l)); else tmp = (2.0 / t_2) * (((cos(k) * l) * l) / (k * k)); end tmp_2 = t_s * tmp; end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[(N[(k * k), $MachinePrecision] * t$95$m), $MachinePrecision]}, N[(t$95$s * If[LessEqual[l, 2.2e+181], N[(2.0 / N[(t$95$2 * N[(N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / t$95$2), $MachinePrecision] * N[(N[(N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \left(k \cdot k\right) \cdot t\_m\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\ell \leq 2.2 \cdot 10^{+181}:\\
\;\;\;\;\frac{2}{t\_2 \cdot \frac{k \cdot \frac{k}{\ell}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_2} \cdot \frac{\left(\cos k \cdot \ell\right) \cdot \ell}{k \cdot k}\\
\end{array}
\end{array}
\end{array}
if l < 2.2000000000000001e181Initial program 33.2%
Taylor expanded in t around 0
Applied rewrites76.4%
Taylor expanded in k around 0
Applied rewrites68.6%
Taylor expanded in k around 0
Applied rewrites69.0%
Taylor expanded in k around 0
Applied rewrites72.7%
if 2.2000000000000001e181 < l Initial program 34.7%
Taylor expanded in t around 0
Applied rewrites63.1%
Taylor expanded in k around 0
Applied rewrites63.1%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(*
t_s
(if (<= l 6.4e+183)
(/ 2.0 (* (* (* k k) t_m) (/ (* k (/ k l)) l)))
(*
(fma -0.3333333333333333 (* k k) 2.0)
(* (/ l (pow k 4.0)) (/ l t_m))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double tmp;
if (l <= 6.4e+183) {
tmp = 2.0 / (((k * k) * t_m) * ((k * (k / l)) / l));
} else {
tmp = fma(-0.3333333333333333, (k * k), 2.0) * ((l / pow(k, 4.0)) * (l / t_m));
}
return t_s * tmp;
}
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) tmp = 0.0 if (l <= 6.4e+183) tmp = Float64(2.0 / Float64(Float64(Float64(k * k) * t_m) * Float64(Float64(k * Float64(k / l)) / l))); else tmp = Float64(fma(-0.3333333333333333, Float64(k * k), 2.0) * Float64(Float64(l / (k ^ 4.0)) * Float64(l / t_m))); end return Float64(t_s * tmp) end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * If[LessEqual[l, 6.4e+183], N[(2.0 / N[(N[(N[(k * k), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.3333333333333333 * N[(k * k), $MachinePrecision] + 2.0), $MachinePrecision] * N[(N[(l / N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision] * N[(l / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\ell \leq 6.4 \cdot 10^{+183}:\\
\;\;\;\;\frac{2}{\left(\left(k \cdot k\right) \cdot t\_m\right) \cdot \frac{k \cdot \frac{k}{\ell}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.3333333333333333, k \cdot k, 2\right) \cdot \left(\frac{\ell}{{k}^{4}} \cdot \frac{\ell}{t\_m}\right)\\
\end{array}
\end{array}
if l < 6.4000000000000004e183Initial program 33.2%
Taylor expanded in t around 0
Applied rewrites76.4%
Taylor expanded in k around 0
Applied rewrites68.6%
Taylor expanded in k around 0
Applied rewrites69.0%
Taylor expanded in k around 0
Applied rewrites72.7%
if 6.4000000000000004e183 < l Initial program 34.7%
Taylor expanded in t around 0
Applied rewrites63.1%
Taylor expanded in k around 0
Applied rewrites56.6%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(let* ((t_2 (* (* k k) t_m)))
(*
t_s
(if (<= l 4e+184)
(/ 2.0 (* t_2 (/ (* k (/ k l)) l)))
(/
2.0
(*
t_2
(/ (* (fma (* k k) -0.3333333333333333 1.0) (* k k)) (* l l))))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double t_2 = (k * k) * t_m;
double tmp;
if (l <= 4e+184) {
tmp = 2.0 / (t_2 * ((k * (k / l)) / l));
} else {
tmp = 2.0 / (t_2 * ((fma((k * k), -0.3333333333333333, 1.0) * (k * k)) / (l * l)));
}
return t_s * tmp;
}
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) t_2 = Float64(Float64(k * k) * t_m) tmp = 0.0 if (l <= 4e+184) tmp = Float64(2.0 / Float64(t_2 * Float64(Float64(k * Float64(k / l)) / l))); else tmp = Float64(2.0 / Float64(t_2 * Float64(Float64(fma(Float64(k * k), -0.3333333333333333, 1.0) * Float64(k * k)) / Float64(l * l)))); end return Float64(t_s * tmp) end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[(N[(k * k), $MachinePrecision] * t$95$m), $MachinePrecision]}, N[(t$95$s * If[LessEqual[l, 4e+184], N[(2.0 / N[(t$95$2 * N[(N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$2 * N[(N[(N[(N[(k * k), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \left(k \cdot k\right) \cdot t\_m\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\ell \leq 4 \cdot 10^{+184}:\\
\;\;\;\;\frac{2}{t\_2 \cdot \frac{k \cdot \frac{k}{\ell}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_2 \cdot \frac{\mathsf{fma}\left(k \cdot k, -0.3333333333333333, 1\right) \cdot \left(k \cdot k\right)}{\ell \cdot \ell}}\\
\end{array}
\end{array}
\end{array}
if l < 4.00000000000000007e184Initial program 33.2%
Taylor expanded in t around 0
Applied rewrites76.4%
Taylor expanded in k around 0
Applied rewrites68.6%
Taylor expanded in k around 0
Applied rewrites69.0%
Taylor expanded in k around 0
Applied rewrites72.7%
if 4.00000000000000007e184 < l Initial program 34.7%
Taylor expanded in t around 0
Applied rewrites63.1%
Taylor expanded in k around 0
Applied rewrites47.4%
Taylor expanded in k around 0
Applied rewrites56.3%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(let* ((t_2 (* (* k k) t_m)))
(*
t_s
(if (<= k 4.9e+14)
(/ 2.0 (* t_2 (/ (* k (/ k l)) l)))
(/
2.0
(* t_2 (/ (* (* (* k k) -0.3333333333333333) (* k k)) (* l l))))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double t_2 = (k * k) * t_m;
double tmp;
if (k <= 4.9e+14) {
tmp = 2.0 / (t_2 * ((k * (k / l)) / l));
} else {
tmp = 2.0 / (t_2 * ((((k * k) * -0.3333333333333333) * (k * k)) / (l * l)));
}
return t_s * tmp;
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = (k * k) * t_m
if (k <= 4.9d+14) then
tmp = 2.0d0 / (t_2 * ((k * (k / l)) / l))
else
tmp = 2.0d0 / (t_2 * ((((k * k) * (-0.3333333333333333d0)) * (k * k)) / (l * l)))
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
double t_2 = (k * k) * t_m;
double tmp;
if (k <= 4.9e+14) {
tmp = 2.0 / (t_2 * ((k * (k / l)) / l));
} else {
tmp = 2.0 / (t_2 * ((((k * k) * -0.3333333333333333) * (k * k)) / (l * l)));
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): t_2 = (k * k) * t_m tmp = 0 if k <= 4.9e+14: tmp = 2.0 / (t_2 * ((k * (k / l)) / l)) else: tmp = 2.0 / (t_2 * ((((k * k) * -0.3333333333333333) * (k * k)) / (l * l))) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) t_2 = Float64(Float64(k * k) * t_m) tmp = 0.0 if (k <= 4.9e+14) tmp = Float64(2.0 / Float64(t_2 * Float64(Float64(k * Float64(k / l)) / l))); else tmp = Float64(2.0 / Float64(t_2 * Float64(Float64(Float64(Float64(k * k) * -0.3333333333333333) * Float64(k * k)) / Float64(l * l)))); end return Float64(t_s * tmp) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l, k) t_2 = (k * k) * t_m; tmp = 0.0; if (k <= 4.9e+14) tmp = 2.0 / (t_2 * ((k * (k / l)) / l)); else tmp = 2.0 / (t_2 * ((((k * k) * -0.3333333333333333) * (k * k)) / (l * l))); end tmp_2 = t_s * tmp; end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := Block[{t$95$2 = N[(N[(k * k), $MachinePrecision] * t$95$m), $MachinePrecision]}, N[(t$95$s * If[LessEqual[k, 4.9e+14], N[(2.0 / N[(t$95$2 * N[(N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$2 * N[(N[(N[(N[(k * k), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \left(k \cdot k\right) \cdot t\_m\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 4.9 \cdot 10^{+14}:\\
\;\;\;\;\frac{2}{t\_2 \cdot \frac{k \cdot \frac{k}{\ell}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_2 \cdot \frac{\left(\left(k \cdot k\right) \cdot -0.3333333333333333\right) \cdot \left(k \cdot k\right)}{\ell \cdot \ell}}\\
\end{array}
\end{array}
\end{array}
if k < 4.9e14Initial program 37.6%
Taylor expanded in t around 0
Applied rewrites79.3%
Taylor expanded in k around 0
Applied rewrites71.8%
Taylor expanded in k around 0
Applied rewrites72.3%
Taylor expanded in k around 0
Applied rewrites76.5%
if 4.9e14 < k Initial program 19.9%
Taylor expanded in t around 0
Applied rewrites60.1%
Taylor expanded in k around 0
Applied rewrites47.4%
Taylor expanded in k around 0
Applied rewrites51.9%
Taylor expanded in k around inf
Applied rewrites51.9%
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l k)
:precision binary64
(*
t_s
(if (<= l 1.55e-162)
(* (/ l (* (* k k) (* k k))) (/ (* l 2.0) t_m))
(/ 2.0 (* (* (* k k) t_m) (/ (* k k) (* l l)))))))t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
double tmp;
if (l <= 1.55e-162) {
tmp = (l / ((k * k) * (k * k))) * ((l * 2.0) / t_m);
} else {
tmp = 2.0 / (((k * k) * t_m) * ((k * k) / (l * l)));
}
return t_s * tmp;
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if (l <= 1.55d-162) then
tmp = (l / ((k * k) * (k * k))) * ((l * 2.0d0) / t_m)
else
tmp = 2.0d0 / (((k * k) * t_m) * ((k * k) / (l * l)))
end if
code = t_s * tmp
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
double tmp;
if (l <= 1.55e-162) {
tmp = (l / ((k * k) * (k * k))) * ((l * 2.0) / t_m);
} else {
tmp = 2.0 / (((k * k) * t_m) * ((k * k) / (l * l)));
}
return t_s * tmp;
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): tmp = 0 if l <= 1.55e-162: tmp = (l / ((k * k) * (k * k))) * ((l * 2.0) / t_m) else: tmp = 2.0 / (((k * k) * t_m) * ((k * k) / (l * l))) return t_s * tmp
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) tmp = 0.0 if (l <= 1.55e-162) tmp = Float64(Float64(l / Float64(Float64(k * k) * Float64(k * k))) * Float64(Float64(l * 2.0) / t_m)); else tmp = Float64(2.0 / Float64(Float64(Float64(k * k) * t_m) * Float64(Float64(k * k) / Float64(l * l)))); end return Float64(t_s * tmp) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l, k) tmp = 0.0; if (l <= 1.55e-162) tmp = (l / ((k * k) * (k * k))) * ((l * 2.0) / t_m); else tmp = 2.0 / (((k * k) * t_m) * ((k * k) / (l * l))); end tmp_2 = t_s * tmp; end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * If[LessEqual[l, 1.55e-162], N[(N[(l / N[(N[(k * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * 2.0), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k * k), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(N[(k * k), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\ell \leq 1.55 \cdot 10^{-162}:\\
\;\;\;\;\frac{\ell}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot \frac{\ell \cdot 2}{t\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(k \cdot k\right) \cdot t\_m\right) \cdot \frac{k \cdot k}{\ell \cdot \ell}}\\
\end{array}
\end{array}
if l < 1.5499999999999999e-162Initial program 34.5%
Taylor expanded in k around 0
Applied rewrites66.0%
Applied rewrites71.3%
Applied rewrites71.3%
if 1.5499999999999999e-162 < l Initial program 32.1%
Taylor expanded in t around 0
Applied rewrites72.6%
Taylor expanded in k around 0
Applied rewrites62.2%
Taylor expanded in k around 0
Applied rewrites61.8%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l k) :precision binary64 (* t_s (/ 2.0 (* (* (* k k) t_m) (/ (* k (/ k l)) l)))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
return t_s * (2.0 / (((k * k) * t_m) * ((k * (k / l)) / l)));
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
code = t_s * (2.0d0 / (((k * k) * t_m) * ((k * (k / l)) / l)))
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
return t_s * (2.0 / (((k * k) * t_m) * ((k * (k / l)) / l)));
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): return t_s * (2.0 / (((k * k) * t_m) * ((k * (k / l)) / l)))
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) return Float64(t_s * Float64(2.0 / Float64(Float64(Float64(k * k) * t_m) * Float64(Float64(k * Float64(k / l)) / l)))) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l, k) tmp = t_s * (2.0 / (((k * k) * t_m) * ((k * (k / l)) / l))); end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * N[(2.0 / N[(N[(N[(k * k), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \frac{2}{\left(\left(k \cdot k\right) \cdot t\_m\right) \cdot \frac{k \cdot \frac{k}{\ell}}{\ell}}
\end{array}
Initial program 33.4%
Taylor expanded in t around 0
Applied rewrites74.7%
Taylor expanded in k around 0
Applied rewrites66.0%
Taylor expanded in k around 0
Applied rewrites67.4%
Taylor expanded in k around 0
Applied rewrites69.7%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l k) :precision binary64 (* t_s (* (/ 2.0 (* (* k k) t_m)) (* (/ l k) (/ l k)))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
return t_s * ((2.0 / ((k * k) * t_m)) * ((l / k) * (l / k)));
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
code = t_s * ((2.0d0 / ((k * k) * t_m)) * ((l / k) * (l / k)))
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
return t_s * ((2.0 / ((k * k) * t_m)) * ((l / k) * (l / k)));
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): return t_s * ((2.0 / ((k * k) * t_m)) * ((l / k) * (l / k)))
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) return Float64(t_s * Float64(Float64(2.0 / Float64(Float64(k * k) * t_m)) * Float64(Float64(l / k) * Float64(l / k)))) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l, k) tmp = t_s * ((2.0 / ((k * k) * t_m)) * ((l / k) * (l / k))); end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * N[(N[(2.0 / N[(N[(k * k), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \left(\frac{2}{\left(k \cdot k\right) \cdot t\_m} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)\right)
\end{array}
Initial program 33.4%
Taylor expanded in t around 0
Applied rewrites74.5%
Taylor expanded in k around 0
Applied rewrites69.4%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l k) :precision binary64 (* t_s (* (/ l (* (* (* k k) k) k)) (/ (* l 2.0) t_m))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
return t_s * ((l / (((k * k) * k) * k)) * ((l * 2.0) / t_m));
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
code = t_s * ((l / (((k * k) * k) * k)) * ((l * 2.0d0) / t_m))
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
return t_s * ((l / (((k * k) * k) * k)) * ((l * 2.0) / t_m));
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): return t_s * ((l / (((k * k) * k) * k)) * ((l * 2.0) / t_m))
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) return Float64(t_s * Float64(Float64(l / Float64(Float64(Float64(k * k) * k) * k)) * Float64(Float64(l * 2.0) / t_m))) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l, k) tmp = t_s * ((l / (((k * k) * k) * k)) * ((l * 2.0) / t_m)); end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * N[(N[(l / N[(N[(N[(k * k), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision] * N[(N[(l * 2.0), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \left(\frac{\ell}{\left(\left(k \cdot k\right) \cdot k\right) \cdot k} \cdot \frac{\ell \cdot 2}{t\_m}\right)
\end{array}
Initial program 33.4%
Taylor expanded in k around 0
Applied rewrites59.2%
Applied rewrites62.8%
Applied rewrites62.8%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l k) :precision binary64 (* t_s (* (/ l (* (* k k) (* k k))) (/ (* l 2.0) t_m))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
return t_s * ((l / ((k * k) * (k * k))) * ((l * 2.0) / t_m));
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
code = t_s * ((l / ((k * k) * (k * k))) * ((l * 2.0d0) / t_m))
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
return t_s * ((l / ((k * k) * (k * k))) * ((l * 2.0) / t_m));
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): return t_s * ((l / ((k * k) * (k * k))) * ((l * 2.0) / t_m))
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) return Float64(t_s * Float64(Float64(l / Float64(Float64(k * k) * Float64(k * k))) * Float64(Float64(l * 2.0) / t_m))) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l, k) tmp = t_s * ((l / ((k * k) * (k * k))) * ((l * 2.0) / t_m)); end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * N[(N[(l / N[(N[(k * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * 2.0), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \left(\frac{\ell}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot \frac{\ell \cdot 2}{t\_m}\right)
\end{array}
Initial program 33.4%
Taylor expanded in k around 0
Applied rewrites59.2%
Applied rewrites62.8%
Applied rewrites62.8%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l k) :precision binary64 (* t_s (* (/ 2.0 (* (* (* k k) k) k)) (/ (* l l) t_m))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
return t_s * ((2.0 / (((k * k) * k) * k)) * ((l * l) / t_m));
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
code = t_s * ((2.0d0 / (((k * k) * k) * k)) * ((l * l) / t_m))
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
return t_s * ((2.0 / (((k * k) * k) * k)) * ((l * l) / t_m));
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): return t_s * ((2.0 / (((k * k) * k) * k)) * ((l * l) / t_m))
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) return Float64(t_s * Float64(Float64(2.0 / Float64(Float64(Float64(k * k) * k) * k)) * Float64(Float64(l * l) / t_m))) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l, k) tmp = t_s * ((2.0 / (((k * k) * k) * k)) * ((l * l) / t_m)); end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * N[(N[(2.0 / N[(N[(N[(k * k), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \left(\frac{2}{\left(\left(k \cdot k\right) \cdot k\right) \cdot k} \cdot \frac{\ell \cdot \ell}{t\_m}\right)
\end{array}
Initial program 33.4%
Taylor expanded in k around 0
Applied rewrites59.2%
Applied rewrites59.2%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l k) :precision binary64 (* t_s (* (/ 2.0 (* (* k k) (* k k))) (/ (* l l) t_m))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
return t_s * ((2.0 / ((k * k) * (k * k))) * ((l * l) / t_m));
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
code = t_s * ((2.0d0 / ((k * k) * (k * k))) * ((l * l) / t_m))
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
return t_s * ((2.0 / ((k * k) * (k * k))) * ((l * l) / t_m));
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): return t_s * ((2.0 / ((k * k) * (k * k))) * ((l * l) / t_m))
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) return Float64(t_s * Float64(Float64(2.0 / Float64(Float64(k * k) * Float64(k * k))) * Float64(Float64(l * l) / t_m))) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l, k) tmp = t_s * ((2.0 / ((k * k) * (k * k))) * ((l * l) / t_m)); end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * N[(N[(2.0 / N[(N[(k * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \left(\frac{2}{\left(k \cdot k\right) \cdot \left(k \cdot k\right)} \cdot \frac{\ell \cdot \ell}{t\_m}\right)
\end{array}
Initial program 33.4%
Taylor expanded in k around 0
Applied rewrites59.2%
Applied rewrites59.2%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l k) :precision binary64 (* t_s (* (* -0.0205026455026455 (* (/ (* l l) t_m) k)) k)))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
return t_s * ((-0.0205026455026455 * (((l * l) / t_m) * k)) * k);
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
code = t_s * (((-0.0205026455026455d0) * (((l * l) / t_m) * k)) * k)
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
return t_s * ((-0.0205026455026455 * (((l * l) / t_m) * k)) * k);
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): return t_s * ((-0.0205026455026455 * (((l * l) / t_m) * k)) * k)
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) return Float64(t_s * Float64(Float64(-0.0205026455026455 * Float64(Float64(Float64(l * l) / t_m) * k)) * k)) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l, k) tmp = t_s * ((-0.0205026455026455 * (((l * l) / t_m) * k)) * k); end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * N[(N[(-0.0205026455026455 * N[(N[(N[(l * l), $MachinePrecision] / t$95$m), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \left(\left(-0.0205026455026455 \cdot \left(\frac{\ell \cdot \ell}{t\_m} \cdot k\right)\right) \cdot k\right)
\end{array}
Initial program 33.4%
Taylor expanded in k around 0
Applied rewrites24.8%
Taylor expanded in k around inf
Applied rewrites16.9%
Taylor expanded in t around 0
Applied rewrites16.9%
Applied rewrites24.7%
t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l k) :precision binary64 (* t_s (* l (* (/ l t_m) (* -0.0205026455026455 (* k k))))))
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l, double k) {
return t_s * (l * ((l / t_m) * (-0.0205026455026455 * (k * k))));
}
t\_m = private
t\_s = 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_s, t_m, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l
real(8), intent (in) :: k
code = t_s * (l * ((l / t_m) * ((-0.0205026455026455d0) * (k * k))))
end function
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l, double k) {
return t_s * (l * ((l / t_m) * (-0.0205026455026455 * (k * k))));
}
t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l, k): return t_s * (l * ((l / t_m) * (-0.0205026455026455 * (k * k))))
t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l, k) return Float64(t_s * Float64(l * Float64(Float64(l / t_m) * Float64(-0.0205026455026455 * Float64(k * k))))) end
t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l, k) tmp = t_s * (l * ((l / t_m) * (-0.0205026455026455 * (k * k)))); end
t\_m = N[Abs[t], $MachinePrecision]
t\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, t$95$m_, l_, k_] := N[(t$95$s * N[(l * N[(N[(l / t$95$m), $MachinePrecision] * N[(-0.0205026455026455 * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \left(\ell \cdot \left(\frac{\ell}{t\_m} \cdot \left(-0.0205026455026455 \cdot \left(k \cdot k\right)\right)\right)\right)
\end{array}
Initial program 33.4%
Taylor expanded in k around 0
Applied rewrites24.8%
Taylor expanded in k around inf
Applied rewrites16.9%
Taylor expanded in t around 0
Applied rewrites16.9%
Applied rewrites11.2%
herbie shell --seed 2025018
(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))))