
(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 29 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (+ (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) + 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) + 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) + 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) + 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) + 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) + 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)}
\end{array}
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(let* ((t_2 (* (log l_m) 2.0)) (t_3 (* (log t_m) 3.0)))
(*
t_s
(if (<= t_m 9e-6)
(/ 2.0 (* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k))))
(/
2.0
(*
(*
(* (exp (/ (- (* t_3 t_3) (* t_2 t_2)) (+ t_3 t_2))) (sin k))
(tan k))
(+ (+ 1.0 (* (/ k t_m) (/ k t_m))) 1.0)))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double t_2 = log(l_m) * 2.0;
double t_3 = log(t_m) * 3.0;
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
} else {
tmp = 2.0 / (((exp((((t_3 * t_3) - (t_2 * t_2)) / (t_3 + t_2))) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_2 = log(l_m) * 2.0d0
t_3 = log(t_m) * 3.0d0
if (t_m <= 9d-6) then
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
else
tmp = 2.0d0 / (((exp((((t_3 * t_3) - (t_2 * t_2)) / (t_3 + t_2))) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) * (k / t_m))) + 1.0d0))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double t_2 = Math.log(l_m) * 2.0;
double t_3 = Math.log(t_m) * 3.0;
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
} else {
tmp = 2.0 / (((Math.exp((((t_3 * t_3) - (t_2 * t_2)) / (t_3 + t_2))) * Math.sin(k)) * Math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): t_2 = math.log(l_m) * 2.0 t_3 = math.log(t_m) * 3.0 tmp = 0 if t_m <= 9e-6: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) else: tmp = 2.0 / (((math.exp((((t_3 * t_3) - (t_2 * t_2)) / (t_3 + t_2))) * math.sin(k)) * math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) t_2 = Float64(log(l_m) * 2.0) t_3 = Float64(log(t_m) * 3.0) tmp = 0.0 if (t_m <= 9e-6) tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); else tmp = Float64(2.0 / Float64(Float64(Float64(exp(Float64(Float64(Float64(t_3 * t_3) - Float64(t_2 * t_2)) / Float64(t_3 + t_2))) * sin(k)) * tan(k)) * Float64(Float64(1.0 + Float64(Float64(k / t_m) * Float64(k / t_m))) + 1.0))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) t_2 = log(l_m) * 2.0; t_3 = log(t_m) * 3.0; tmp = 0.0; if (t_m <= 9e-6) tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); else tmp = 2.0 / (((exp((((t_3 * t_3) - (t_2 * t_2)) / (t_3 + t_2))) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := Block[{t$95$2 = N[(N[Log[l$95$m], $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$3 = N[(N[Log[t$95$m], $MachinePrecision] * 3.0), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 9e-6], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Exp[N[(N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k / t$95$m), $MachinePrecision] * N[(k / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \log l\_m \cdot 2\\
t_3 := \log t\_m \cdot 3\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 9 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(e^{\frac{t\_3 \cdot t\_3 - t\_2 \cdot t\_2}{t\_3 + t\_2}} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + \frac{k}{t\_m} \cdot \frac{k}{t\_m}\right) + 1\right)}\\
\end{array}
\end{array}
\end{array}
if t < 9.00000000000000023e-6Initial program 48.7%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.8%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6455.0
Applied rewrites55.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6472.8
Applied rewrites72.8%
if 9.00000000000000023e-6 < t Initial program 67.1%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6442.3
Applied rewrites42.3%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6442.3
Applied rewrites42.3%
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
flip--N/A
lower-/.f64N/A
Applied rewrites42.4%
Final simplification64.3%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(let* ((t_2
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))))
(*
t_s
(if (<= t_2 -5e-184)
(/
(/ 2.0 (* (/ (/ (pow t_m 3.0) l_m) l_m) (* (sin k) (tan k))))
(+ (+ (/ (* k k) (* t_m t_m)) 1.0) 1.0))
(if (<= t_2 0.0)
(/
2.0
(*
(/
(+
(* (pow (* k t_m) 2.0) (+ (* (* k k) 0.3333333333333333) 2.0))
(pow k 4.0))
(* l_m l_m))
t_m))
(if (<= t_2 2e+275)
t_2
(/
2.0
(*
(* (/ k l_m) (/ k l_m))
(/ (* t_m (pow (sin k) 2.0)) (cos k))))))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double t_2 = 2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0));
double tmp;
if (t_2 <= -5e-184) {
tmp = (2.0 / (((pow(t_m, 3.0) / l_m) / l_m) * (sin(k) * tan(k)))) / ((((k * k) / (t_m * t_m)) + 1.0) + 1.0);
} else if (t_2 <= 0.0) {
tmp = 2.0 / ((((pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + pow(k, 4.0)) / (l_m * l_m)) * t_m);
} else if (t_2 <= 2e+275) {
tmp = t_2;
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = 2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))
if (t_2 <= (-5d-184)) then
tmp = (2.0d0 / ((((t_m ** 3.0d0) / l_m) / l_m) * (sin(k) * tan(k)))) / ((((k * k) / (t_m * t_m)) + 1.0d0) + 1.0d0)
else if (t_2 <= 0.0d0) then
tmp = 2.0d0 / ((((((k * t_m) ** 2.0d0) * (((k * k) * 0.3333333333333333d0) + 2.0d0)) + (k ** 4.0d0)) / (l_m * l_m)) * t_m)
else if (t_2 <= 2d+275) then
tmp = t_2
else
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double t_2 = 2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0));
double tmp;
if (t_2 <= -5e-184) {
tmp = (2.0 / (((Math.pow(t_m, 3.0) / l_m) / l_m) * (Math.sin(k) * Math.tan(k)))) / ((((k * k) / (t_m * t_m)) + 1.0) + 1.0);
} else if (t_2 <= 0.0) {
tmp = 2.0 / ((((Math.pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + Math.pow(k, 4.0)) / (l_m * l_m)) * t_m);
} else if (t_2 <= 2e+275) {
tmp = t_2;
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): t_2 = 2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0)) tmp = 0 if t_2 <= -5e-184: tmp = (2.0 / (((math.pow(t_m, 3.0) / l_m) / l_m) * (math.sin(k) * math.tan(k)))) / ((((k * k) / (t_m * t_m)) + 1.0) + 1.0) elif t_2 <= 0.0: tmp = 2.0 / ((((math.pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + math.pow(k, 4.0)) / (l_m * l_m)) * t_m) elif t_2 <= 2e+275: tmp = t_2 else: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) t_2 = Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) tmp = 0.0 if (t_2 <= -5e-184) tmp = Float64(Float64(2.0 / Float64(Float64(Float64((t_m ^ 3.0) / l_m) / l_m) * Float64(sin(k) * tan(k)))) / Float64(Float64(Float64(Float64(k * k) / Float64(t_m * t_m)) + 1.0) + 1.0)); elseif (t_2 <= 0.0) tmp = Float64(2.0 / Float64(Float64(Float64(Float64((Float64(k * t_m) ^ 2.0) * Float64(Float64(Float64(k * k) * 0.3333333333333333) + 2.0)) + (k ^ 4.0)) / Float64(l_m * l_m)) * t_m)); elseif (t_2 <= 2e+275) tmp = t_2; else tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) t_2 = 2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0)); tmp = 0.0; if (t_2 <= -5e-184) tmp = (2.0 / ((((t_m ^ 3.0) / l_m) / l_m) * (sin(k) * tan(k)))) / ((((k * k) / (t_m * t_m)) + 1.0) + 1.0); elseif (t_2 <= 0.0) tmp = 2.0 / ((((((k * t_m) ^ 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + (k ^ 4.0)) / (l_m * l_m)) * t_m); elseif (t_2 <= 2e+275) tmp = t_2; else tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := Block[{t$95$2 = N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$2, -5e-184], N[(N[(2.0 / N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * N[(N[Sin[k], $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(k * k), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(2.0 / N[(N[(N[(N[(N[Power[N[(k * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(N[(k * k), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+275], t$95$2, N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-184}:\\
\;\;\;\;\frac{\frac{2}{\frac{\frac{{t\_m}^{3}}{l\_m}}{l\_m} \cdot \left(\sin k \cdot \tan k\right)}}{\left(\frac{k \cdot k}{t\_m \cdot t\_m} + 1\right) + 1}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{2}{\frac{{\left(k \cdot t\_m\right)}^{2} \cdot \left(\left(k \cdot k\right) \cdot 0.3333333333333333 + 2\right) + {k}^{4}}{l\_m \cdot l\_m} \cdot t\_m}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+275}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\end{array}
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < -5.00000000000000003e-184Initial program 83.4%
Applied rewrites79.5%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f6463.1
Applied rewrites63.1%
if -5.00000000000000003e-184 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 0.0Initial program 77.8%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites83.6%
if 0.0 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 95.8%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6445.0
Applied rewrites45.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6477.0
Applied rewrites77.0%
Final simplification79.3%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(let* ((t_2 (/ (* k k) (* t_m t_m)))
(t_3
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))))
(*
t_s
(if (<= t_3 -5e-184)
(/
(/ 2.0 (* (/ (/ (pow t_m 3.0) l_m) l_m) (* (sin k) (tan k))))
(+ (+ t_2 1.0) 1.0))
(if (<= t_3 0.0)
(/
2.0
(*
(/
(+
(* (pow (* k t_m) 2.0) (+ (* (* k k) 0.3333333333333333) 2.0))
(pow k 4.0))
(* l_m l_m))
t_m))
(if (<= t_3 2e+275)
(/
2.0
(*
(* (* (/ (* (* t_m t_m) t_m) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 t_2) 1.0)))
(/
2.0
(*
(* (/ k l_m) (/ k l_m))
(/ (* t_m (pow (sin k) 2.0)) (cos k))))))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double t_2 = (k * k) / (t_m * t_m);
double t_3 = 2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0));
double tmp;
if (t_3 <= -5e-184) {
tmp = (2.0 / (((pow(t_m, 3.0) / l_m) / l_m) * (sin(k) * tan(k)))) / ((t_2 + 1.0) + 1.0);
} else if (t_3 <= 0.0) {
tmp = 2.0 / ((((pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + pow(k, 4.0)) / (l_m * l_m)) * t_m);
} else if (t_3 <= 2e+275) {
tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + t_2) + 1.0));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_2 = (k * k) / (t_m * t_m)
t_3 = 2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))
if (t_3 <= (-5d-184)) then
tmp = (2.0d0 / ((((t_m ** 3.0d0) / l_m) / l_m) * (sin(k) * tan(k)))) / ((t_2 + 1.0d0) + 1.0d0)
else if (t_3 <= 0.0d0) then
tmp = 2.0d0 / ((((((k * t_m) ** 2.0d0) * (((k * k) * 0.3333333333333333d0) + 2.0d0)) + (k ** 4.0d0)) / (l_m * l_m)) * t_m)
else if (t_3 <= 2d+275) then
tmp = 2.0d0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + t_2) + 1.0d0))
else
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double t_2 = (k * k) / (t_m * t_m);
double t_3 = 2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0));
double tmp;
if (t_3 <= -5e-184) {
tmp = (2.0 / (((Math.pow(t_m, 3.0) / l_m) / l_m) * (Math.sin(k) * Math.tan(k)))) / ((t_2 + 1.0) + 1.0);
} else if (t_3 <= 0.0) {
tmp = 2.0 / ((((Math.pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + Math.pow(k, 4.0)) / (l_m * l_m)) * t_m);
} else if (t_3 <= 2e+275) {
tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + t_2) + 1.0));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): t_2 = (k * k) / (t_m * t_m) t_3 = 2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0)) tmp = 0 if t_3 <= -5e-184: tmp = (2.0 / (((math.pow(t_m, 3.0) / l_m) / l_m) * (math.sin(k) * math.tan(k)))) / ((t_2 + 1.0) + 1.0) elif t_3 <= 0.0: tmp = 2.0 / ((((math.pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + math.pow(k, 4.0)) / (l_m * l_m)) * t_m) elif t_3 <= 2e+275: tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + t_2) + 1.0)) else: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) t_2 = Float64(Float64(k * k) / Float64(t_m * t_m)) t_3 = Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) tmp = 0.0 if (t_3 <= -5e-184) tmp = Float64(Float64(2.0 / Float64(Float64(Float64((t_m ^ 3.0) / l_m) / l_m) * Float64(sin(k) * tan(k)))) / Float64(Float64(t_2 + 1.0) + 1.0)); elseif (t_3 <= 0.0) tmp = Float64(2.0 / Float64(Float64(Float64(Float64((Float64(k * t_m) ^ 2.0) * Float64(Float64(Float64(k * k) * 0.3333333333333333) + 2.0)) + (k ^ 4.0)) / Float64(l_m * l_m)) * t_m)); elseif (t_3 <= 2e+275) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(t_m * t_m) * t_m) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + t_2) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) t_2 = (k * k) / (t_m * t_m); t_3 = 2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0)); tmp = 0.0; if (t_3 <= -5e-184) tmp = (2.0 / ((((t_m ^ 3.0) / l_m) / l_m) * (sin(k) * tan(k)))) / ((t_2 + 1.0) + 1.0); elseif (t_3 <= 0.0) tmp = 2.0 / ((((((k * t_m) ^ 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + (k ^ 4.0)) / (l_m * l_m)) * t_m); elseif (t_3 <= 2e+275) tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + t_2) + 1.0)); else tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := Block[{t$95$2 = N[(N[(k * k), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$3, -5e-184], N[(N[(2.0 / N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * N[(N[Sin[k], $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$2 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(2.0 / N[(N[(N[(N[(N[Power[N[(k * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(N[(k * k), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+275], N[(2.0 / N[(N[(N[(N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * t$95$m), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + t$95$2), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \frac{k \cdot k}{t\_m \cdot t\_m}\\
t_3 := \frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-184}:\\
\;\;\;\;\frac{\frac{2}{\frac{\frac{{t\_m}^{3}}{l\_m}}{l\_m} \cdot \left(\sin k \cdot \tan k\right)}}{\left(t\_2 + 1\right) + 1}\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\frac{2}{\frac{{\left(k \cdot t\_m\right)}^{2} \cdot \left(\left(k \cdot k\right) \cdot 0.3333333333333333 + 2\right) + {k}^{4}}{l\_m \cdot l\_m} \cdot t\_m}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\left(t\_m \cdot t\_m\right) \cdot t\_m}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + t\_2\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\end{array}
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < -5.00000000000000003e-184Initial program 83.4%
Applied rewrites79.5%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f6463.1
Applied rewrites63.1%
if -5.00000000000000003e-184 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 0.0Initial program 77.8%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites83.6%
if 0.0 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 95.8%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
frac-timesN/A
unpow2N/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6495.5
Applied rewrites95.5%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6495.5
Applied rewrites95.5%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6445.0
Applied rewrites45.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6477.0
Applied rewrites77.0%
Final simplification79.3%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(let* ((t_2
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))))
(*
t_s
(if (<= t_2 -5e-184)
(/
2.0
(*
(/ (* (/ (pow t_m 3.0) l_m) (* (tan k) (sin k))) l_m)
(+ (+ 1.0 (* (/ k t_m) (/ k t_m))) 1.0)))
(if (<= t_2 0.0)
(/
2.0
(*
(/
(+
(* (pow (* k t_m) 2.0) (+ (* (* k k) 0.3333333333333333) 2.0))
(pow k 4.0))
(* l_m l_m))
t_m))
(if (<= t_2 2e+275)
(/
2.0
(*
(* (* (/ (* (* t_m t_m) t_m) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (/ (* k k) (* t_m t_m))) 1.0)))
(/
2.0
(*
(* (/ k l_m) (/ k l_m))
(/ (* t_m (pow (sin k) 2.0)) (cos k))))))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double t_2 = 2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0));
double tmp;
if (t_2 <= -5e-184) {
tmp = 2.0 / ((((pow(t_m, 3.0) / l_m) * (tan(k) * sin(k))) / l_m) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else if (t_2 <= 0.0) {
tmp = 2.0 / ((((pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + pow(k, 4.0)) / (l_m * l_m)) * t_m);
} else if (t_2 <= 2e+275) {
tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k * k) / (t_m * t_m))) + 1.0));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = 2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))
if (t_2 <= (-5d-184)) then
tmp = 2.0d0 / (((((t_m ** 3.0d0) / l_m) * (tan(k) * sin(k))) / l_m) * ((1.0d0 + ((k / t_m) * (k / t_m))) + 1.0d0))
else if (t_2 <= 0.0d0) then
tmp = 2.0d0 / ((((((k * t_m) ** 2.0d0) * (((k * k) * 0.3333333333333333d0) + 2.0d0)) + (k ** 4.0d0)) / (l_m * l_m)) * t_m)
else if (t_2 <= 2d+275) then
tmp = 2.0d0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k * k) / (t_m * t_m))) + 1.0d0))
else
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double t_2 = 2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0));
double tmp;
if (t_2 <= -5e-184) {
tmp = 2.0 / ((((Math.pow(t_m, 3.0) / l_m) * (Math.tan(k) * Math.sin(k))) / l_m) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else if (t_2 <= 0.0) {
tmp = 2.0 / ((((Math.pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + Math.pow(k, 4.0)) / (l_m * l_m)) * t_m);
} else if (t_2 <= 2e+275) {
tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + ((k * k) / (t_m * t_m))) + 1.0));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): t_2 = 2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0)) tmp = 0 if t_2 <= -5e-184: tmp = 2.0 / ((((math.pow(t_m, 3.0) / l_m) * (math.tan(k) * math.sin(k))) / l_m) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)) elif t_2 <= 0.0: tmp = 2.0 / ((((math.pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + math.pow(k, 4.0)) / (l_m * l_m)) * t_m) elif t_2 <= 2e+275: tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + ((k * k) / (t_m * t_m))) + 1.0)) else: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) t_2 = Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) tmp = 0.0 if (t_2 <= -5e-184) tmp = Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / l_m) * Float64(tan(k) * sin(k))) / l_m) * Float64(Float64(1.0 + Float64(Float64(k / t_m) * Float64(k / t_m))) + 1.0))); elseif (t_2 <= 0.0) tmp = Float64(2.0 / Float64(Float64(Float64(Float64((Float64(k * t_m) ^ 2.0) * Float64(Float64(Float64(k * k) * 0.3333333333333333) + 2.0)) + (k ^ 4.0)) / Float64(l_m * l_m)) * t_m)); elseif (t_2 <= 2e+275) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(t_m * t_m) * t_m) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + Float64(Float64(k * k) / Float64(t_m * t_m))) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) t_2 = 2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0)); tmp = 0.0; if (t_2 <= -5e-184) tmp = 2.0 / (((((t_m ^ 3.0) / l_m) * (tan(k) * sin(k))) / l_m) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)); elseif (t_2 <= 0.0) tmp = 2.0 / ((((((k * t_m) ^ 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + (k ^ 4.0)) / (l_m * l_m)) * t_m); elseif (t_2 <= 2e+275) tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k * k) / (t_m * t_m))) + 1.0)); else tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := Block[{t$95$2 = N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$2, -5e-184], N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / l$95$m), $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision] * N[(N[(1.0 + N[(N[(k / t$95$m), $MachinePrecision] * N[(k / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(2.0 / N[(N[(N[(N[(N[Power[N[(k * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(N[(k * k), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+275], N[(2.0 / N[(N[(N[(N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * t$95$m), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k * k), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-184}:\\
\;\;\;\;\frac{2}{\frac{\frac{{t\_m}^{3}}{l\_m} \cdot \left(\tan k \cdot \sin k\right)}{l\_m} \cdot \left(\left(1 + \frac{k}{t\_m} \cdot \frac{k}{t\_m}\right) + 1\right)}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{2}{\frac{{\left(k \cdot t\_m\right)}^{2} \cdot \left(\left(k \cdot k\right) \cdot 0.3333333333333333 + 2\right) + {k}^{4}}{l\_m \cdot l\_m} \cdot t\_m}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\left(t\_m \cdot t\_m\right) \cdot t\_m}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + \frac{k \cdot k}{t\_m \cdot t\_m}\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\end{array}
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < -5.00000000000000003e-184Initial program 83.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f647.6
Applied rewrites7.6%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f647.6
Applied rewrites7.6%
lift-*.f64N/A
lift-exp.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-sin.f64N/A
lift-tan.f64N/A
lower-*.f64N/A
associate-*l*N/A
exp-diffN/A
pow-to-expN/A
pow-to-expN/A
pow2N/A
associate-/r*N/A
Applied rewrites79.3%
if -5.00000000000000003e-184 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 0.0Initial program 77.8%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites83.6%
if 0.0 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 95.8%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
frac-timesN/A
unpow2N/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6495.5
Applied rewrites95.5%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6495.5
Applied rewrites95.5%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6445.0
Applied rewrites45.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6477.0
Applied rewrites77.0%
Final simplification80.9%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(let* ((t_2
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))))
(*
t_s
(if (<= t_2 2e-253)
(/ (* l_m l_m) (* (pow (* k t_m) 2.0) t_m))
(if (<= t_2 2e+275)
(/
2.0
(* (* (* (/ (* (* t_m t_m) t_m) (* l_m l_m)) (sin k)) (tan k)) 2.0))
(/ 2.0 (* (* (* (/ k l_m) (/ k l_m)) t_m) (* k k))))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double t_2 = 2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0));
double tmp;
if (t_2 <= 2e-253) {
tmp = (l_m * l_m) / (pow((k * t_m), 2.0) * t_m);
} else if (t_2 <= 2e+275) {
tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * 2.0);
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = 2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))
if (t_2 <= 2d-253) then
tmp = (l_m * l_m) / (((k * t_m) ** 2.0d0) * t_m)
else if (t_2 <= 2d+275) then
tmp = 2.0d0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * 2.0d0)
else
tmp = 2.0d0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double t_2 = 2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0));
double tmp;
if (t_2 <= 2e-253) {
tmp = (l_m * l_m) / (Math.pow((k * t_m), 2.0) * t_m);
} else if (t_2 <= 2e+275) {
tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * 2.0);
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): t_2 = 2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0)) tmp = 0 if t_2 <= 2e-253: tmp = (l_m * l_m) / (math.pow((k * t_m), 2.0) * t_m) elif t_2 <= 2e+275: tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * 2.0) else: tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) t_2 = Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) tmp = 0.0 if (t_2 <= 2e-253) tmp = Float64(Float64(l_m * l_m) / Float64((Float64(k * t_m) ^ 2.0) * t_m)); elseif (t_2 <= 2e+275) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(t_m * t_m) * t_m) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * 2.0)); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * t_m) * Float64(k * k))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) t_2 = 2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0)); tmp = 0.0; if (t_2 <= 2e-253) tmp = (l_m * l_m) / (((k * t_m) ^ 2.0) * t_m); elseif (t_2 <= 2e+275) tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * 2.0); else tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := Block[{t$95$2 = N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$2, 2e-253], N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(N[Power[N[(k * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+275], N[(2.0 / N[(N[(N[(N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * t$95$m), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{-253}:\\
\;\;\;\;\frac{l\_m \cdot l\_m}{{\left(k \cdot t\_m\right)}^{2} \cdot t\_m}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\left(t\_m \cdot t\_m\right) \cdot t\_m}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot t\_m\right) \cdot \left(k \cdot k\right)}\\
\end{array}
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 2.0000000000000001e-253Initial program 79.0%
Taylor expanded in k around 0
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift-pow.f6468.3
Applied rewrites68.3%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6468.3
Applied rewrites68.3%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f6477.7
Applied rewrites77.7%
if 2.0000000000000001e-253 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 95.6%
Taylor expanded in t around inf
Applied rewrites42.6%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6442.7
Applied rewrites42.7%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites36.3%
Taylor expanded in t around 0
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6455.6
Applied rewrites55.6%
Final simplification67.0%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(let* ((t_2 (/ (pow t_m 3.0) (* l_m l_m)))
(t_3
(/
2.0
(*
(* (* t_2 (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))))
(*
t_s
(if (<= t_3 2e-253)
(/ (* l_m l_m) (* (pow (* k t_m) 2.0) t_m))
(if (<= t_3 2e+275)
(/ 2.0 (* (* (* t_2 k) (tan k)) 2.0))
(/ 2.0 (* (* (* (/ k l_m) (/ k l_m)) t_m) (* k k))))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double t_2 = pow(t_m, 3.0) / (l_m * l_m);
double t_3 = 2.0 / (((t_2 * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0));
double tmp;
if (t_3 <= 2e-253) {
tmp = (l_m * l_m) / (pow((k * t_m), 2.0) * t_m);
} else if (t_3 <= 2e+275) {
tmp = 2.0 / (((t_2 * k) * tan(k)) * 2.0);
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_2 = (t_m ** 3.0d0) / (l_m * l_m)
t_3 = 2.0d0 / (((t_2 * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))
if (t_3 <= 2d-253) then
tmp = (l_m * l_m) / (((k * t_m) ** 2.0d0) * t_m)
else if (t_3 <= 2d+275) then
tmp = 2.0d0 / (((t_2 * k) * tan(k)) * 2.0d0)
else
tmp = 2.0d0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double t_2 = Math.pow(t_m, 3.0) / (l_m * l_m);
double t_3 = 2.0 / (((t_2 * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0));
double tmp;
if (t_3 <= 2e-253) {
tmp = (l_m * l_m) / (Math.pow((k * t_m), 2.0) * t_m);
} else if (t_3 <= 2e+275) {
tmp = 2.0 / (((t_2 * k) * Math.tan(k)) * 2.0);
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): t_2 = math.pow(t_m, 3.0) / (l_m * l_m) t_3 = 2.0 / (((t_2 * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0)) tmp = 0 if t_3 <= 2e-253: tmp = (l_m * l_m) / (math.pow((k * t_m), 2.0) * t_m) elif t_3 <= 2e+275: tmp = 2.0 / (((t_2 * k) * math.tan(k)) * 2.0) else: tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) t_2 = Float64((t_m ^ 3.0) / Float64(l_m * l_m)) t_3 = Float64(2.0 / Float64(Float64(Float64(t_2 * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) tmp = 0.0 if (t_3 <= 2e-253) tmp = Float64(Float64(l_m * l_m) / Float64((Float64(k * t_m) ^ 2.0) * t_m)); elseif (t_3 <= 2e+275) tmp = Float64(2.0 / Float64(Float64(Float64(t_2 * k) * tan(k)) * 2.0)); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * t_m) * Float64(k * k))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) t_2 = (t_m ^ 3.0) / (l_m * l_m); t_3 = 2.0 / (((t_2 * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0)); tmp = 0.0; if (t_3 <= 2e-253) tmp = (l_m * l_m) / (((k * t_m) ^ 2.0) * t_m); elseif (t_3 <= 2e+275) tmp = 2.0 / (((t_2 * k) * tan(k)) * 2.0); else tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := Block[{t$95$2 = N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 / N[(N[(N[(t$95$2 * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$3, 2e-253], N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(N[Power[N[(k * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+275], N[(2.0 / N[(N[(N[(t$95$2 * k), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \frac{{t\_m}^{3}}{l\_m \cdot l\_m}\\
t_3 := \frac{2}{\left(\left(t\_2 \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq 2 \cdot 10^{-253}:\\
\;\;\;\;\frac{l\_m \cdot l\_m}{{\left(k \cdot t\_m\right)}^{2} \cdot t\_m}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{2}{\left(\left(t\_2 \cdot k\right) \cdot \tan k\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot t\_m\right) \cdot \left(k \cdot k\right)}\\
\end{array}
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 2.0000000000000001e-253Initial program 79.0%
Taylor expanded in k around 0
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift-pow.f6468.3
Applied rewrites68.3%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6468.3
Applied rewrites68.3%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f6477.7
Applied rewrites77.7%
if 2.0000000000000001e-253 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 95.6%
Taylor expanded in t around inf
Applied rewrites42.6%
Taylor expanded in k around 0
Applied rewrites41.5%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites36.3%
Taylor expanded in t around 0
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6455.6
Applied rewrites55.6%
Final simplification66.9%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= t_m 9e-6)
(/ 2.0 (* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k))))
(/
2.0
(*
(*
(*
(exp
(/
(- (* (pow (log t_m) 2.0) 9.0) (* (pow (log l_m) 2.0) 4.0))
(+ (* (log t_m) 3.0) (* (log l_m) 2.0))))
(sin k))
(tan k))
(+ (+ 1.0 (* (/ k t_m) (/ k t_m))) 1.0))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
} else {
tmp = 2.0 / (((exp((((pow(log(t_m), 2.0) * 9.0) - (pow(log(l_m), 2.0) * 4.0)) / ((log(t_m) * 3.0) + (log(l_m) * 2.0)))) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (t_m <= 9d-6) then
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
else
tmp = 2.0d0 / (((exp(((((log(t_m) ** 2.0d0) * 9.0d0) - ((log(l_m) ** 2.0d0) * 4.0d0)) / ((log(t_m) * 3.0d0) + (log(l_m) * 2.0d0)))) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) * (k / t_m))) + 1.0d0))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
} else {
tmp = 2.0 / (((Math.exp((((Math.pow(Math.log(t_m), 2.0) * 9.0) - (Math.pow(Math.log(l_m), 2.0) * 4.0)) / ((Math.log(t_m) * 3.0) + (Math.log(l_m) * 2.0)))) * Math.sin(k)) * Math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if t_m <= 9e-6: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) else: tmp = 2.0 / (((math.exp((((math.pow(math.log(t_m), 2.0) * 9.0) - (math.pow(math.log(l_m), 2.0) * 4.0)) / ((math.log(t_m) * 3.0) + (math.log(l_m) * 2.0)))) * math.sin(k)) * math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (t_m <= 9e-6) tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); else tmp = Float64(2.0 / Float64(Float64(Float64(exp(Float64(Float64(Float64((log(t_m) ^ 2.0) * 9.0) - Float64((log(l_m) ^ 2.0) * 4.0)) / Float64(Float64(log(t_m) * 3.0) + Float64(log(l_m) * 2.0)))) * sin(k)) * tan(k)) * Float64(Float64(1.0 + Float64(Float64(k / t_m) * Float64(k / t_m))) + 1.0))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (t_m <= 9e-6) tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); else tmp = 2.0 / (((exp(((((log(t_m) ^ 2.0) * 9.0) - ((log(l_m) ^ 2.0) * 4.0)) / ((log(t_m) * 3.0) + (log(l_m) * 2.0)))) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[t$95$m, 9e-6], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Exp[N[(N[(N[(N[Power[N[Log[t$95$m], $MachinePrecision], 2.0], $MachinePrecision] * 9.0), $MachinePrecision] - N[(N[Power[N[Log[l$95$m], $MachinePrecision], 2.0], $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Log[t$95$m], $MachinePrecision] * 3.0), $MachinePrecision] + N[(N[Log[l$95$m], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k / t$95$m), $MachinePrecision] * N[(k / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 9 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(e^{\frac{{\log t\_m}^{2} \cdot 9 - {\log l\_m}^{2} \cdot 4}{\log t\_m \cdot 3 + \log l\_m \cdot 2}} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + \frac{k}{t\_m} \cdot \frac{k}{t\_m}\right) + 1\right)}\\
\end{array}
\end{array}
if t < 9.00000000000000023e-6Initial program 48.7%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.8%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6455.0
Applied rewrites55.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6472.8
Applied rewrites72.8%
if 9.00000000000000023e-6 < t Initial program 67.1%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6442.3
Applied rewrites42.3%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6442.3
Applied rewrites42.3%
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
flip--N/A
lower-/.f64N/A
Applied rewrites42.4%
Applied rewrites42.3%
Final simplification64.3%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(let* ((t_2 (+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))
(*
t_s
(if (<=
(/ 2.0 (* (* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k)) t_2))
2e+275)
(/ 2.0 (* (* (* (/ (/ (pow t_m 3.0) l_m) l_m) (sin k)) (tan k)) t_2))
(/
2.0
(* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k))))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double t_2 = (1.0 + pow((k / t_m), 2.0)) + 1.0;
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * t_2)) <= 2e+275) {
tmp = 2.0 / (((((pow(t_m, 3.0) / l_m) / l_m) * sin(k)) * tan(k)) * t_2);
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = (1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * t_2)) <= 2d+275) then
tmp = 2.0d0 / ((((((t_m ** 3.0d0) / l_m) / l_m) * sin(k)) * tan(k)) * t_2)
else
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double t_2 = (1.0 + Math.pow((k / t_m), 2.0)) + 1.0;
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * t_2)) <= 2e+275) {
tmp = 2.0 / (((((Math.pow(t_m, 3.0) / l_m) / l_m) * Math.sin(k)) * Math.tan(k)) * t_2);
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): t_2 = (1.0 + math.pow((k / t_m), 2.0)) + 1.0 tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * t_2)) <= 2e+275: tmp = 2.0 / (((((math.pow(t_m, 3.0) / l_m) / l_m) * math.sin(k)) * math.tan(k)) * t_2) else: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) t_2 = Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0) tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * t_2)) <= 2e+275) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64((t_m ^ 3.0) / l_m) / l_m) * sin(k)) * tan(k)) * t_2)); else tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) t_2 = (1.0 + ((k / t_m) ^ 2.0)) + 1.0; tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * t_2)) <= 2e+275) tmp = 2.0 / ((((((t_m ^ 3.0) / l_m) / l_m) * sin(k)) * tan(k)) * t_2); else tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := Block[{t$95$2 = N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, N[(t$95$s * If[LessEqual[N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], 2e+275], N[(2.0 / N[(N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot t\_2} \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\frac{{t\_m}^{3}}{l\_m}}{l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\end{array}
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 80.1%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-pow.f6483.4
Applied rewrites83.4%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6445.0
Applied rewrites45.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6477.0
Applied rewrites77.0%
Final simplification80.7%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(let* ((t_2 (pow (/ k t_m) 2.0)))
(*
t_s
(if (<=
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 t_2) 1.0)))
2e+275)
(/
2.0
(* (* (/ (/ (pow t_m 3.0) l_m) l_m) (sin k)) (* (tan k) (+ t_2 2.0))))
(/
2.0
(* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k))))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double t_2 = pow((k / t_m), 2.0);
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + t_2) + 1.0))) <= 2e+275) {
tmp = 2.0 / ((((pow(t_m, 3.0) / l_m) / l_m) * sin(k)) * (tan(k) * (t_2 + 2.0)));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = (k / t_m) ** 2.0d0
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + t_2) + 1.0d0))) <= 2d+275) then
tmp = 2.0d0 / (((((t_m ** 3.0d0) / l_m) / l_m) * sin(k)) * (tan(k) * (t_2 + 2.0d0)))
else
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double t_2 = Math.pow((k / t_m), 2.0);
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + t_2) + 1.0))) <= 2e+275) {
tmp = 2.0 / ((((Math.pow(t_m, 3.0) / l_m) / l_m) * Math.sin(k)) * (Math.tan(k) * (t_2 + 2.0)));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): t_2 = math.pow((k / t_m), 2.0) tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + t_2) + 1.0))) <= 2e+275: tmp = 2.0 / ((((math.pow(t_m, 3.0) / l_m) / l_m) * math.sin(k)) * (math.tan(k) * (t_2 + 2.0))) else: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) t_2 = Float64(k / t_m) ^ 2.0 tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + t_2) + 1.0))) <= 2e+275) tmp = Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / l_m) / l_m) * sin(k)) * Float64(tan(k) * Float64(t_2 + 2.0)))); else tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) t_2 = (k / t_m) ^ 2.0; tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + t_2) + 1.0))) <= 2e+275) tmp = 2.0 / (((((t_m ^ 3.0) / l_m) / l_m) * sin(k)) * (tan(k) * (t_2 + 2.0))); else tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := Block[{t$95$2 = N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]}, N[(t$95$s * If[LessEqual[N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + t$95$2), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+275], N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] * N[(t$95$2 + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := {\left(\frac{k}{t\_m}\right)}^{2}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + t\_2\right) + 1\right)} \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{{t\_m}^{3}}{l\_m}}{l\_m} \cdot \sin k\right) \cdot \left(\tan k \cdot \left(t\_2 + 2\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\end{array}
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 80.1%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6415.6
Applied rewrites15.6%
Applied rewrites83.4%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6445.0
Applied rewrites45.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6477.0
Applied rewrites77.0%
Final simplification80.7%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(let* ((t_2 (+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))
(*
t_s
(if (<=
(/ 2.0 (* (* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k)) t_2))
2e+275)
(/ 2.0 (* (* (* (pow t_m 3.0) (/ (sin k) (* l_m l_m))) (tan k)) t_2))
(/
2.0
(* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k))))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double t_2 = (1.0 + pow((k / t_m), 2.0)) + 1.0;
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * t_2)) <= 2e+275) {
tmp = 2.0 / (((pow(t_m, 3.0) * (sin(k) / (l_m * l_m))) * tan(k)) * t_2);
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: t_2
real(8) :: tmp
t_2 = (1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * t_2)) <= 2d+275) then
tmp = 2.0d0 / ((((t_m ** 3.0d0) * (sin(k) / (l_m * l_m))) * tan(k)) * t_2)
else
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double t_2 = (1.0 + Math.pow((k / t_m), 2.0)) + 1.0;
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * t_2)) <= 2e+275) {
tmp = 2.0 / (((Math.pow(t_m, 3.0) * (Math.sin(k) / (l_m * l_m))) * Math.tan(k)) * t_2);
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): t_2 = (1.0 + math.pow((k / t_m), 2.0)) + 1.0 tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * t_2)) <= 2e+275: tmp = 2.0 / (((math.pow(t_m, 3.0) * (math.sin(k) / (l_m * l_m))) * math.tan(k)) * t_2) else: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) t_2 = Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0) tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * t_2)) <= 2e+275) tmp = Float64(2.0 / Float64(Float64(Float64((t_m ^ 3.0) * Float64(sin(k) / Float64(l_m * l_m))) * tan(k)) * t_2)); else tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) t_2 = (1.0 + ((k / t_m) ^ 2.0)) + 1.0; tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * t_2)) <= 2e+275) tmp = 2.0 / ((((t_m ^ 3.0) * (sin(k) / (l_m * l_m))) * tan(k)) * t_2); else tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := Block[{t$95$2 = N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, N[(t$95$s * If[LessEqual[N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], 2e+275], N[(2.0 / N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] * N[(N[Sin[k], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot t\_2} \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{2}{\left(\left({t\_m}^{3} \cdot \frac{\sin k}{l\_m \cdot l\_m}\right) \cdot \tan k\right) \cdot t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\end{array}
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 80.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
pow2N/A
lift-*.f6482.0
Applied rewrites82.0%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6445.0
Applied rewrites45.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6477.0
Applied rewrites77.0%
Final simplification79.9%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= t_m 9e-6)
(/ 2.0 (* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k))))
(/
2.0
(*
(*
(*
(exp (- (* (log t_m) 3.0) (* (log l_m) 2.0)))
(/ 1.0 (pow (sin k) -1.0)))
(tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
} else {
tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * (1.0 / pow(sin(k), -1.0))) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (t_m <= 9d-6) then
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
else
tmp = 2.0d0 / (((exp(((log(t_m) * 3.0d0) - (log(l_m) * 2.0d0))) * (1.0d0 / (sin(k) ** (-1.0d0)))) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
} else {
tmp = 2.0 / (((Math.exp(((Math.log(t_m) * 3.0) - (Math.log(l_m) * 2.0))) * (1.0 / Math.pow(Math.sin(k), -1.0))) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if t_m <= 9e-6: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) else: tmp = 2.0 / (((math.exp(((math.log(t_m) * 3.0) - (math.log(l_m) * 2.0))) * (1.0 / math.pow(math.sin(k), -1.0))) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (t_m <= 9e-6) tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); else tmp = Float64(2.0 / Float64(Float64(Float64(exp(Float64(Float64(log(t_m) * 3.0) - Float64(log(l_m) * 2.0))) * Float64(1.0 / (sin(k) ^ -1.0))) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (t_m <= 9e-6) tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); else tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * (1.0 / (sin(k) ^ -1.0))) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[t$95$m, 9e-6], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Exp[N[(N[(N[Log[t$95$m], $MachinePrecision] * 3.0), $MachinePrecision] - N[(N[Log[l$95$m], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Power[N[Sin[k], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 9 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(e^{\log t\_m \cdot 3 - \log l\_m \cdot 2} \cdot \frac{1}{{\sin k}^{-1}}\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)}\\
\end{array}
\end{array}
if t < 9.00000000000000023e-6Initial program 48.7%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.8%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6455.0
Applied rewrites55.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6472.8
Applied rewrites72.8%
if 9.00000000000000023e-6 < t Initial program 67.1%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6442.3
Applied rewrites42.3%
lift-sin.f64N/A
unpow1N/A
metadata-evalN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
lift-sin.f6442.3
Applied rewrites42.3%
Final simplification64.3%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<=
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))
2e+275)
(/
2.0
(*
(/
(+
(* (pow (* k t_m) 2.0) (+ (* (* k k) 0.3333333333333333) 2.0))
(pow k 4.0))
(* l_m l_m))
t_m))
(/ 2.0 (* (* (* (/ k l_m) (/ k l_m)) t_m) (* k k))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = 2.0 / ((((pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + pow(k, 4.0)) / (l_m * l_m)) * t_m);
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))) <= 2d+275) then
tmp = 2.0d0 / ((((((k * t_m) ** 2.0d0) * (((k * k) * 0.3333333333333333d0) + 2.0d0)) + (k ** 4.0d0)) / (l_m * l_m)) * t_m)
else
tmp = 2.0d0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = 2.0 / ((((Math.pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + Math.pow(k, 4.0)) / (l_m * l_m)) * t_m);
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275: tmp = 2.0 / ((((math.pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + math.pow(k, 4.0)) / (l_m * l_m)) * t_m) else: tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = Float64(2.0 / Float64(Float64(Float64(Float64((Float64(k * t_m) ^ 2.0) * Float64(Float64(Float64(k * k) * 0.3333333333333333) + 2.0)) + (k ^ 4.0)) / Float64(l_m * l_m)) * t_m)); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * t_m) * Float64(k * k))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = 2.0 / ((((((k * t_m) ^ 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + (k ^ 4.0)) / (l_m * l_m)) * t_m); else tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+275], N[(2.0 / N[(N[(N[(N[(N[Power[N[(k * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(N[(k * k), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)} \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{2}{\frac{{\left(k \cdot t\_m\right)}^{2} \cdot \left(\left(k \cdot k\right) \cdot 0.3333333333333333 + 2\right) + {k}^{4}}{l\_m \cdot l\_m} \cdot t\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot t\_m\right) \cdot \left(k \cdot k\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 80.1%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites65.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.7%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites36.3%
Taylor expanded in t around 0
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6455.6
Applied rewrites55.6%
Final simplification67.7%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= t_m 9e-6)
(/ 2.0 (* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k))))
(/
2.0
(*
(*
(* (exp (- (* (log t_m) 3.0) (* (log l_m) 2.0))) (sin k))
(/ (sin k) (cos k)))
(+ (+ 1.0 (* (/ k t_m) (/ k t_m))) 1.0))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
} else {
tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * sin(k)) * (sin(k) / cos(k))) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (t_m <= 9d-6) then
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
else
tmp = 2.0d0 / (((exp(((log(t_m) * 3.0d0) - (log(l_m) * 2.0d0))) * sin(k)) * (sin(k) / cos(k))) * ((1.0d0 + ((k / t_m) * (k / t_m))) + 1.0d0))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
} else {
tmp = 2.0 / (((Math.exp(((Math.log(t_m) * 3.0) - (Math.log(l_m) * 2.0))) * Math.sin(k)) * (Math.sin(k) / Math.cos(k))) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if t_m <= 9e-6: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) else: tmp = 2.0 / (((math.exp(((math.log(t_m) * 3.0) - (math.log(l_m) * 2.0))) * math.sin(k)) * (math.sin(k) / math.cos(k))) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (t_m <= 9e-6) tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); else tmp = Float64(2.0 / Float64(Float64(Float64(exp(Float64(Float64(log(t_m) * 3.0) - Float64(log(l_m) * 2.0))) * sin(k)) * Float64(sin(k) / cos(k))) * Float64(Float64(1.0 + Float64(Float64(k / t_m) * Float64(k / t_m))) + 1.0))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (t_m <= 9e-6) tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); else tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * sin(k)) * (sin(k) / cos(k))) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[t$95$m, 9e-6], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Exp[N[(N[(N[Log[t$95$m], $MachinePrecision] * 3.0), $MachinePrecision] - N[(N[Log[l$95$m], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[k], $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k / t$95$m), $MachinePrecision] * N[(k / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 9 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(e^{\log t\_m \cdot 3 - \log l\_m \cdot 2} \cdot \sin k\right) \cdot \frac{\sin k}{\cos k}\right) \cdot \left(\left(1 + \frac{k}{t\_m} \cdot \frac{k}{t\_m}\right) + 1\right)}\\
\end{array}
\end{array}
if t < 9.00000000000000023e-6Initial program 48.7%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.8%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6455.0
Applied rewrites55.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6472.8
Applied rewrites72.8%
if 9.00000000000000023e-6 < t Initial program 67.1%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6442.3
Applied rewrites42.3%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6442.3
Applied rewrites42.3%
lift-tan.f64N/A
tan-quotN/A
lower-/.f64N/A
lift-sin.f64N/A
lift-cos.f6442.3
Applied rewrites42.3%
Final simplification64.3%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<=
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))
2e+275)
(/ (* l_m l_m) (* (pow (* k t_m) 2.0) t_m))
(/ 2.0 (* (* (* (/ k l_m) (/ k l_m)) t_m) (* k k))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = (l_m * l_m) / (pow((k * t_m), 2.0) * t_m);
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))) <= 2d+275) then
tmp = (l_m * l_m) / (((k * t_m) ** 2.0d0) * t_m)
else
tmp = 2.0d0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = (l_m * l_m) / (Math.pow((k * t_m), 2.0) * t_m);
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275: tmp = (l_m * l_m) / (math.pow((k * t_m), 2.0) * t_m) else: tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = Float64(Float64(l_m * l_m) / Float64((Float64(k * t_m) ^ 2.0) * t_m)); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * t_m) * Float64(k * k))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = (l_m * l_m) / (((k * t_m) ^ 2.0) * t_m); else tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+275], N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(N[Power[N[(k * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)} \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{l\_m \cdot l\_m}{{\left(k \cdot t\_m\right)}^{2} \cdot t\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot t\_m\right) \cdot \left(k \cdot k\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 80.1%
Taylor expanded in k around 0
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift-pow.f6464.6
Applied rewrites64.6%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6464.5
Applied rewrites64.5%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f6473.4
Applied rewrites73.4%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites36.3%
Taylor expanded in t around 0
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6455.6
Applied rewrites55.6%
Final simplification65.8%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<=
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))
2e+275)
(/ (* l_m l_m) (* k (* (pow t_m 3.0) k)))
(/ 2.0 (* (* (* (/ k l_m) (/ k l_m)) t_m) (* k k))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = (l_m * l_m) / (k * (pow(t_m, 3.0) * k));
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))) <= 2d+275) then
tmp = (l_m * l_m) / (k * ((t_m ** 3.0d0) * k))
else
tmp = 2.0d0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = (l_m * l_m) / (k * (Math.pow(t_m, 3.0) * k));
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275: tmp = (l_m * l_m) / (k * (math.pow(t_m, 3.0) * k)) else: tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = Float64(Float64(l_m * l_m) / Float64(k * Float64((t_m ^ 3.0) * k))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * t_m) * Float64(k * k))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = (l_m * l_m) / (k * ((t_m ^ 3.0) * k)); else tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+275], N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(k * N[(N[Power[t$95$m, 3.0], $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)} \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{l\_m \cdot l\_m}{k \cdot \left({t\_m}^{3} \cdot k\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot t\_m\right) \cdot \left(k \cdot k\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 80.1%
Taylor expanded in k around 0
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift-pow.f6464.6
Applied rewrites64.6%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f6471.5
Applied rewrites71.5%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites36.3%
Taylor expanded in t around 0
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6455.6
Applied rewrites55.6%
Final simplification64.7%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= t_m 9e-6)
(/ 2.0 (* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k))))
(/
2.0
(*
(* (* (exp (- (* (log t_m) 3.0) (* (log l_m) 2.0))) (sin k)) (tan k))
(+ (+ 1.0 (* (/ k t_m) (/ k t_m))) 1.0))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
} else {
tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (t_m <= 9d-6) then
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
else
tmp = 2.0d0 / (((exp(((log(t_m) * 3.0d0) - (log(l_m) * 2.0d0))) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) * (k / t_m))) + 1.0d0))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
} else {
tmp = 2.0 / (((Math.exp(((Math.log(t_m) * 3.0) - (Math.log(l_m) * 2.0))) * Math.sin(k)) * Math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if t_m <= 9e-6: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) else: tmp = 2.0 / (((math.exp(((math.log(t_m) * 3.0) - (math.log(l_m) * 2.0))) * math.sin(k)) * math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (t_m <= 9e-6) tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); else tmp = Float64(2.0 / Float64(Float64(Float64(exp(Float64(Float64(log(t_m) * 3.0) - Float64(log(l_m) * 2.0))) * sin(k)) * tan(k)) * Float64(Float64(1.0 + Float64(Float64(k / t_m) * Float64(k / t_m))) + 1.0))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (t_m <= 9e-6) tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); else tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[t$95$m, 9e-6], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Exp[N[(N[(N[Log[t$95$m], $MachinePrecision] * 3.0), $MachinePrecision] - N[(N[Log[l$95$m], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k / t$95$m), $MachinePrecision] * N[(k / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 9 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(e^{\log t\_m \cdot 3 - \log l\_m \cdot 2} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + \frac{k}{t\_m} \cdot \frac{k}{t\_m}\right) + 1\right)}\\
\end{array}
\end{array}
if t < 9.00000000000000023e-6Initial program 48.7%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.8%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6455.0
Applied rewrites55.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6472.8
Applied rewrites72.8%
if 9.00000000000000023e-6 < t Initial program 67.1%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6442.3
Applied rewrites42.3%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6442.3
Applied rewrites42.3%
Final simplification64.3%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= t_m 9e-6)
(/ 2.0 (* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k))))
(/
2.0
(*
(* (* (exp (- (* (log t_m) 3.0) (* (log l_m) 2.0))) (sin k)) (tan k))
(+ (+ 1.0 (* k (/ k (* t_m t_m)))) 1.0))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
} else {
tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * sin(k)) * tan(k)) * ((1.0 + (k * (k / (t_m * t_m)))) + 1.0));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (t_m <= 9d-6) then
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
else
tmp = 2.0d0 / (((exp(((log(t_m) * 3.0d0) - (log(l_m) * 2.0d0))) * sin(k)) * tan(k)) * ((1.0d0 + (k * (k / (t_m * t_m)))) + 1.0d0))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 9e-6) {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
} else {
tmp = 2.0 / (((Math.exp(((Math.log(t_m) * 3.0) - (Math.log(l_m) * 2.0))) * Math.sin(k)) * Math.tan(k)) * ((1.0 + (k * (k / (t_m * t_m)))) + 1.0));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if t_m <= 9e-6: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) else: tmp = 2.0 / (((math.exp(((math.log(t_m) * 3.0) - (math.log(l_m) * 2.0))) * math.sin(k)) * math.tan(k)) * ((1.0 + (k * (k / (t_m * t_m)))) + 1.0)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (t_m <= 9e-6) tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); else tmp = Float64(2.0 / Float64(Float64(Float64(exp(Float64(Float64(log(t_m) * 3.0) - Float64(log(l_m) * 2.0))) * sin(k)) * tan(k)) * Float64(Float64(1.0 + Float64(k * Float64(k / Float64(t_m * t_m)))) + 1.0))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (t_m <= 9e-6) tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); else tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * sin(k)) * tan(k)) * ((1.0 + (k * (k / (t_m * t_m)))) + 1.0)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[t$95$m, 9e-6], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Exp[N[(N[(N[Log[t$95$m], $MachinePrecision] * 3.0), $MachinePrecision] - N[(N[Log[l$95$m], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(k * N[(k / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 9 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(e^{\log t\_m \cdot 3 - \log l\_m \cdot 2} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + k \cdot \frac{k}{t\_m \cdot t\_m}\right) + 1\right)}\\
\end{array}
\end{array}
if t < 9.00000000000000023e-6Initial program 48.7%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.8%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6455.0
Applied rewrites55.0%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6472.8
Applied rewrites72.8%
if 9.00000000000000023e-6 < t Initial program 67.1%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6442.3
Applied rewrites42.3%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6442.3
Applied rewrites42.3%
Final simplification64.3%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= k 3800.0)
(/
2.0
(*
(* (* (exp (- (* (log t_m) 3.0) (* (log l_m) 2.0))) (sin k)) (tan k))
2.0))
(/
2.0
(* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k)))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 3800.0) {
tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * sin(k)) * tan(k)) * 2.0);
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 3800.0d0) then
tmp = 2.0d0 / (((exp(((log(t_m) * 3.0d0) - (log(l_m) * 2.0d0))) * sin(k)) * tan(k)) * 2.0d0)
else
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 3800.0) {
tmp = 2.0 / (((Math.exp(((Math.log(t_m) * 3.0) - (Math.log(l_m) * 2.0))) * Math.sin(k)) * Math.tan(k)) * 2.0);
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if k <= 3800.0: tmp = 2.0 / (((math.exp(((math.log(t_m) * 3.0) - (math.log(l_m) * 2.0))) * math.sin(k)) * math.tan(k)) * 2.0) else: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (k <= 3800.0) tmp = Float64(2.0 / Float64(Float64(Float64(exp(Float64(Float64(log(t_m) * 3.0) - Float64(log(l_m) * 2.0))) * sin(k)) * tan(k)) * 2.0)); else tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (k <= 3800.0) tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * sin(k)) * tan(k)) * 2.0); else tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[k, 3800.0], N[(2.0 / N[(N[(N[(N[Exp[N[(N[(N[Log[t$95$m], $MachinePrecision] * 3.0), $MachinePrecision] - N[(N[Log[l$95$m], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 3800:\\
\;\;\;\;\frac{2}{\left(\left(e^{\log t\_m \cdot 3 - \log l\_m \cdot 2} \cdot \sin k\right) \cdot \tan k\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\end{array}
\end{array}
if k < 3800Initial program 56.3%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6419.0
Applied rewrites19.0%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6416.5
Applied rewrites16.5%
Taylor expanded in t around inf
Applied rewrites18.5%
if 3800 < k Initial program 44.4%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites56.3%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6456.5
Applied rewrites56.5%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6481.5
Applied rewrites81.5%
Final simplification31.3%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<=
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))
2e+275)
(/
2.0
(*
(*
(/
(+ (* (* t_m t_m) (+ 2.0 (* 0.3333333333333333 (* k k)))) (* k k))
(* l_m l_m))
t_m)
(* k k)))
(/ 2.0 (* (* (* (/ k l_m) (/ k l_m)) t_m) (* k k))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = 2.0 / ((((((t_m * t_m) * (2.0 + (0.3333333333333333 * (k * k)))) + (k * k)) / (l_m * l_m)) * t_m) * (k * k));
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))) <= 2d+275) then
tmp = 2.0d0 / ((((((t_m * t_m) * (2.0d0 + (0.3333333333333333d0 * (k * k)))) + (k * k)) / (l_m * l_m)) * t_m) * (k * k))
else
tmp = 2.0d0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = 2.0 / ((((((t_m * t_m) * (2.0 + (0.3333333333333333 * (k * k)))) + (k * k)) / (l_m * l_m)) * t_m) * (k * k));
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275: tmp = 2.0 / ((((((t_m * t_m) * (2.0 + (0.3333333333333333 * (k * k)))) + (k * k)) / (l_m * l_m)) * t_m) * (k * k)) else: tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(t_m * t_m) * Float64(2.0 + Float64(0.3333333333333333 * Float64(k * k)))) + Float64(k * k)) / Float64(l_m * l_m)) * t_m) * Float64(k * k))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * t_m) * Float64(k * k))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = 2.0 / ((((((t_m * t_m) * (2.0 + (0.3333333333333333 * (k * k)))) + (k * k)) / (l_m * l_m)) * t_m) * (k * k)); else tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+275], N[(2.0 / N[(N[(N[(N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * N[(2.0 + N[(0.3333333333333333 * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)} \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{2}{\left(\frac{\left(t\_m \cdot t\_m\right) \cdot \left(2 + 0.3333333333333333 \cdot \left(k \cdot k\right)\right) + k \cdot k}{l\_m \cdot l\_m} \cdot t\_m\right) \cdot \left(k \cdot k\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot t\_m\right) \cdot \left(k \cdot k\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 80.1%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites65.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites67.5%
Taylor expanded in l around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6467.8
Applied rewrites67.8%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites36.3%
Taylor expanded in t around 0
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6455.6
Applied rewrites55.6%
Final simplification62.6%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<=
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))
2e+275)
(/ 2.0 (* (* (* 2.0 (/ (* t_m t_m) (* l_m l_m))) t_m) (* k k)))
(/ 2.0 (* (* (* (/ k l_m) (/ k l_m)) t_m) (* k k))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = 2.0 / (((2.0 * ((t_m * t_m) / (l_m * l_m))) * t_m) * (k * k));
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))) <= 2d+275) then
tmp = 2.0d0 / (((2.0d0 * ((t_m * t_m) / (l_m * l_m))) * t_m) * (k * k))
else
tmp = 2.0d0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = 2.0 / (((2.0 * ((t_m * t_m) / (l_m * l_m))) * t_m) * (k * k));
} else {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275: tmp = 2.0 / (((2.0 * ((t_m * t_m) / (l_m * l_m))) * t_m) * (k * k)) else: tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = Float64(2.0 / Float64(Float64(Float64(2.0 * Float64(Float64(t_m * t_m) / Float64(l_m * l_m))) * t_m) * Float64(k * k))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * t_m) * Float64(k * k))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = 2.0 / (((2.0 * ((t_m * t_m) / (l_m * l_m))) * t_m) * (k * k)); else tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+275], N[(2.0 / N[(N[(N[(2.0 * N[(N[(t$95$m * t$95$m), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)} \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{2}{\left(\left(2 \cdot \frac{t\_m \cdot t\_m}{l\_m \cdot l\_m}\right) \cdot t\_m\right) \cdot \left(k \cdot k\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot t\_m\right) \cdot \left(k \cdot k\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 80.1%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites65.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites67.5%
Taylor expanded in k around 0
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6465.5
Applied rewrites65.5%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites36.3%
Taylor expanded in t around 0
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6455.6
Applied rewrites55.6%
Final simplification61.3%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<=
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))
2e+275)
(/ 2.0 (* (* (* 2.0 (/ (* t_m t_m) (* l_m l_m))) t_m) (* k k)))
(/ 2.0 (* (* (* k k) (/ t_m (* l_m l_m))) (* k k))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = 2.0 / (((2.0 * ((t_m * t_m) / (l_m * l_m))) * t_m) * (k * k));
} else {
tmp = 2.0 / (((k * k) * (t_m / (l_m * l_m))) * (k * k));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))) <= 2d+275) then
tmp = 2.0d0 / (((2.0d0 * ((t_m * t_m) / (l_m * l_m))) * t_m) * (k * k))
else
tmp = 2.0d0 / (((k * k) * (t_m / (l_m * l_m))) * (k * k))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = 2.0 / (((2.0 * ((t_m * t_m) / (l_m * l_m))) * t_m) * (k * k));
} else {
tmp = 2.0 / (((k * k) * (t_m / (l_m * l_m))) * (k * k));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275: tmp = 2.0 / (((2.0 * ((t_m * t_m) / (l_m * l_m))) * t_m) * (k * k)) else: tmp = 2.0 / (((k * k) * (t_m / (l_m * l_m))) * (k * k)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = Float64(2.0 / Float64(Float64(Float64(2.0 * Float64(Float64(t_m * t_m) / Float64(l_m * l_m))) * t_m) * Float64(k * k))); else tmp = Float64(2.0 / Float64(Float64(Float64(k * k) * Float64(t_m / Float64(l_m * l_m))) * Float64(k * k))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = 2.0 / (((2.0 * ((t_m * t_m) / (l_m * l_m))) * t_m) * (k * k)); else tmp = 2.0 / (((k * k) * (t_m / (l_m * l_m))) * (k * k)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+275], N[(2.0 / N[(N[(N[(2.0 * N[(N[(t$95$m * t$95$m), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k * k), $MachinePrecision] * N[(t$95$m / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)} \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{2}{\left(\left(2 \cdot \frac{t\_m \cdot t\_m}{l\_m \cdot l\_m}\right) \cdot t\_m\right) \cdot \left(k \cdot k\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(k \cdot k\right) \cdot \frac{t\_m}{l\_m \cdot l\_m}\right) \cdot \left(k \cdot k\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 80.1%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites65.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites67.5%
Taylor expanded in k around 0
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6465.5
Applied rewrites65.5%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6445.0
Applied rewrites45.0%
Final simplification56.7%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<=
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t_m) 2.0)) 1.0)))
2e+275)
(/ (* l_m l_m) (* (* k k) (* (* t_m t_m) t_m)))
(/ 2.0 (* (* (* k k) (/ t_m (* l_m l_m))) (* k k))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = (l_m * l_m) / ((k * k) * ((t_m * t_m) * t_m));
} else {
tmp = 2.0 / (((k * k) * (t_m / (l_m * l_m))) * (k * k));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t_m) ** 2.0d0)) + 1.0d0))) <= 2d+275) then
tmp = (l_m * l_m) / ((k * k) * ((t_m * t_m) * t_m))
else
tmp = 2.0d0 / (((k * k) * (t_m / (l_m * l_m))) * (k * k))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275) {
tmp = (l_m * l_m) / ((k * k) * ((t_m * t_m) * t_m));
} else {
tmp = 2.0 / (((k * k) * (t_m / (l_m * l_m))) * (k * k));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t_m), 2.0)) + 1.0))) <= 2e+275: tmp = (l_m * l_m) / ((k * k) * ((t_m * t_m) * t_m)) else: tmp = 2.0 / (((k * k) * (t_m / (l_m * l_m))) * (k * k)) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = Float64(Float64(l_m * l_m) / Float64(Float64(k * k) * Float64(Float64(t_m * t_m) * t_m))); else tmp = Float64(2.0 / Float64(Float64(Float64(k * k) * Float64(t_m / Float64(l_m * l_m))) * Float64(k * k))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k / t_m) ^ 2.0)) + 1.0))) <= 2e+275) tmp = (l_m * l_m) / ((k * k) * ((t_m * t_m) * t_m)); else tmp = 2.0 / (((k * k) * (t_m / (l_m * l_m))) * (k * k)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[N[(2.0 / N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+275], N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(N[(k * k), $MachinePrecision] * N[(N[(t$95$m * t$95$m), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k * k), $MachinePrecision] * N[(t$95$m / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{2}{\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t\_m}\right)}^{2}\right) + 1\right)} \leq 2 \cdot 10^{+275}:\\
\;\;\;\;\frac{l\_m \cdot l\_m}{\left(k \cdot k\right) \cdot \left(\left(t\_m \cdot t\_m\right) \cdot t\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(k \cdot k\right) \cdot \frac{t\_m}{l\_m \cdot l\_m}\right) \cdot \left(k \cdot k\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) < 1.99999999999999992e275Initial program 80.1%
Taylor expanded in k around 0
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift-pow.f6464.6
Applied rewrites64.6%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6464.5
Applied rewrites64.5%
if 1.99999999999999992e275 < (/.f64 #s(literal 2 binary64) (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64)))) Initial program 18.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.9%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6445.0
Applied rewrites45.0%
Final simplification56.2%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= k 7.8e-7)
(/
2.0
(*
(* (* (exp (- (* (log t_m) 3.0) (* (log l_m) 2.0))) (sin k)) k)
(+ (+ 1.0 (* (/ k t_m) (/ k t_m))) 1.0)))
(/
2.0
(* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k)))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 7.8e-7) {
tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * sin(k)) * k) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 7.8d-7) then
tmp = 2.0d0 / (((exp(((log(t_m) * 3.0d0) - (log(l_m) * 2.0d0))) * sin(k)) * k) * ((1.0d0 + ((k / t_m) * (k / t_m))) + 1.0d0))
else
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 7.8e-7) {
tmp = 2.0 / (((Math.exp(((Math.log(t_m) * 3.0) - (Math.log(l_m) * 2.0))) * Math.sin(k)) * k) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if k <= 7.8e-7: tmp = 2.0 / (((math.exp(((math.log(t_m) * 3.0) - (math.log(l_m) * 2.0))) * math.sin(k)) * k) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)) else: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (k <= 7.8e-7) tmp = Float64(2.0 / Float64(Float64(Float64(exp(Float64(Float64(log(t_m) * 3.0) - Float64(log(l_m) * 2.0))) * sin(k)) * k) * Float64(Float64(1.0 + Float64(Float64(k / t_m) * Float64(k / t_m))) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (k <= 7.8e-7) tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * sin(k)) * k) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)); else tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[k, 7.8e-7], N[(2.0 / N[(N[(N[(N[Exp[N[(N[(N[Log[t$95$m], $MachinePrecision] * 3.0), $MachinePrecision] - N[(N[Log[l$95$m], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] * N[(N[(1.0 + N[(N[(k / t$95$m), $MachinePrecision] * N[(k / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 7.8 \cdot 10^{-7}:\\
\;\;\;\;\frac{2}{\left(\left(e^{\log t\_m \cdot 3 - \log l\_m \cdot 2} \cdot \sin k\right) \cdot k\right) \cdot \left(\left(1 + \frac{k}{t\_m} \cdot \frac{k}{t\_m}\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\end{array}
\end{array}
if k < 7.80000000000000049e-7Initial program 56.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6419.1
Applied rewrites19.1%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6419.1
Applied rewrites19.1%
Taylor expanded in k around 0
Applied rewrites18.2%
if 7.80000000000000049e-7 < k Initial program 42.8%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites54.2%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6454.4
Applied rewrites54.4%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6478.6
Applied rewrites78.6%
Final simplification30.9%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= k 7.8e-7)
(/
2.0
(*
(* (* (exp (- (* (log t_m) 3.0) (* (log l_m) 2.0))) k) (tan k))
(+ (+ 1.0 (* (/ k t_m) (/ k t_m))) 1.0)))
(/
2.0
(* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k)))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 7.8e-7) {
tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * k) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 7.8d-7) then
tmp = 2.0d0 / (((exp(((log(t_m) * 3.0d0) - (log(l_m) * 2.0d0))) * k) * tan(k)) * ((1.0d0 + ((k / t_m) * (k / t_m))) + 1.0d0))
else
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 7.8e-7) {
tmp = 2.0 / (((Math.exp(((Math.log(t_m) * 3.0) - (Math.log(l_m) * 2.0))) * k) * Math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if k <= 7.8e-7: tmp = 2.0 / (((math.exp(((math.log(t_m) * 3.0) - (math.log(l_m) * 2.0))) * k) * math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)) else: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (k <= 7.8e-7) tmp = Float64(2.0 / Float64(Float64(Float64(exp(Float64(Float64(log(t_m) * 3.0) - Float64(log(l_m) * 2.0))) * k) * tan(k)) * Float64(Float64(1.0 + Float64(Float64(k / t_m) * Float64(k / t_m))) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (k <= 7.8e-7) tmp = 2.0 / (((exp(((log(t_m) * 3.0) - (log(l_m) * 2.0))) * k) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)); else tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[k, 7.8e-7], N[(2.0 / N[(N[(N[(N[Exp[N[(N[(N[Log[t$95$m], $MachinePrecision] * 3.0), $MachinePrecision] - N[(N[Log[l$95$m], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * k), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k / t$95$m), $MachinePrecision] * N[(k / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 7.8 \cdot 10^{-7}:\\
\;\;\;\;\frac{2}{\left(\left(e^{\log t\_m \cdot 3 - \log l\_m \cdot 2} \cdot k\right) \cdot \tan k\right) \cdot \left(\left(1 + \frac{k}{t\_m} \cdot \frac{k}{t\_m}\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\end{array}
\end{array}
if k < 7.80000000000000049e-7Initial program 56.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6419.1
Applied rewrites19.1%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6419.1
Applied rewrites19.1%
Taylor expanded in k around 0
Applied rewrites18.7%
if 7.80000000000000049e-7 < k Initial program 42.8%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites54.2%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6454.4
Applied rewrites54.4%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6478.6
Applied rewrites78.6%
Final simplification31.3%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= k 2.1e-158)
(/
2.0
(*
(* (* (/ (/ (pow t_m 3.0) l_m) l_m) k) (tan k))
(+ (+ 1.0 (* (/ k t_m) (/ k t_m))) 1.0)))
(if (<= k 2.2e-6)
(/ 2.0 (* 2.0 (* (* k k) (exp (- (* 3.0 (log t_m)) (* 2.0 (log l_m)))))))
(/
2.0
(* (* (/ k l_m) (/ k l_m)) (/ (* t_m (pow (sin k) 2.0)) (cos k))))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 2.1e-158) {
tmp = 2.0 / (((((pow(t_m, 3.0) / l_m) / l_m) * k) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else if (k <= 2.2e-6) {
tmp = 2.0 / (2.0 * ((k * k) * exp(((3.0 * log(t_m)) - (2.0 * log(l_m))))));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * pow(sin(k), 2.0)) / cos(k)));
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 2.1d-158) then
tmp = 2.0d0 / ((((((t_m ** 3.0d0) / l_m) / l_m) * k) * tan(k)) * ((1.0d0 + ((k / t_m) * (k / t_m))) + 1.0d0))
else if (k <= 2.2d-6) then
tmp = 2.0d0 / (2.0d0 * ((k * k) * exp(((3.0d0 * log(t_m)) - (2.0d0 * log(l_m))))))
else
tmp = 2.0d0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ** 2.0d0)) / cos(k)))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 2.1e-158) {
tmp = 2.0 / (((((Math.pow(t_m, 3.0) / l_m) / l_m) * k) * Math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else if (k <= 2.2e-6) {
tmp = 2.0 / (2.0 * ((k * k) * Math.exp(((3.0 * Math.log(t_m)) - (2.0 * Math.log(l_m))))));
} else {
tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * Math.pow(Math.sin(k), 2.0)) / Math.cos(k)));
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if k <= 2.1e-158: tmp = 2.0 / (((((math.pow(t_m, 3.0) / l_m) / l_m) * k) * math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)) elif k <= 2.2e-6: tmp = 2.0 / (2.0 * ((k * k) * math.exp(((3.0 * math.log(t_m)) - (2.0 * math.log(l_m)))))) else: tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * math.pow(math.sin(k), 2.0)) / math.cos(k))) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (k <= 2.1e-158) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64((t_m ^ 3.0) / l_m) / l_m) * k) * tan(k)) * Float64(Float64(1.0 + Float64(Float64(k / t_m) * Float64(k / t_m))) + 1.0))); elseif (k <= 2.2e-6) tmp = Float64(2.0 / Float64(2.0 * Float64(Float64(k * k) * exp(Float64(Float64(3.0 * log(t_m)) - Float64(2.0 * log(l_m))))))); else tmp = Float64(2.0 / Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * Float64(Float64(t_m * (sin(k) ^ 2.0)) / cos(k)))); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (k <= 2.1e-158) tmp = 2.0 / ((((((t_m ^ 3.0) / l_m) / l_m) * k) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)); elseif (k <= 2.2e-6) tmp = 2.0 / (2.0 * ((k * k) * exp(((3.0 * log(t_m)) - (2.0 * log(l_m)))))); else tmp = 2.0 / (((k / l_m) * (k / l_m)) * ((t_m * (sin(k) ^ 2.0)) / cos(k))); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[k, 2.1e-158], N[(2.0 / N[(N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * k), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k / t$95$m), $MachinePrecision] * N[(k / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 2.2e-6], N[(2.0 / N[(2.0 * N[(N[(k * k), $MachinePrecision] * N[Exp[N[(N[(3.0 * N[Log[t$95$m], $MachinePrecision]), $MachinePrecision] - N[(2.0 * N[Log[l$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$m * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 2.1 \cdot 10^{-158}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\frac{{t\_m}^{3}}{l\_m}}{l\_m} \cdot k\right) \cdot \tan k\right) \cdot \left(\left(1 + \frac{k}{t\_m} \cdot \frac{k}{t\_m}\right) + 1\right)}\\
\mathbf{elif}\;k \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{2 \cdot \left(\left(k \cdot k\right) \cdot e^{3 \cdot \log t\_m - 2 \cdot \log l\_m}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot \frac{t\_m \cdot {\sin k}^{2}}{\cos k}}\\
\end{array}
\end{array}
if k < 2.09999999999999991e-158Initial program 56.6%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6419.2
Applied rewrites19.2%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6419.2
Applied rewrites19.2%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
exp-diffN/A
*-commutativeN/A
pow-to-expN/A
*-commutativeN/A
pow-to-expN/A
pow2N/A
associate-/r*N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f6458.4
Applied rewrites58.4%
if 2.09999999999999991e-158 < k < 2.2000000000000001e-6Initial program 58.8%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6418.5
Applied rewrites18.5%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6418.5
Applied rewrites18.5%
Taylor expanded in k around 0
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lower-*.f64N/A
lift-log.f6418.5
Applied rewrites18.5%
if 2.2000000000000001e-6 < k Initial program 42.8%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites54.2%
Taylor expanded in t around 0
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6454.4
Applied rewrites54.4%
Taylor expanded in t around 0
times-fracN/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lift-sin.f64N/A
lower-cos.f6478.6
Applied rewrites78.6%
Final simplification58.4%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= k 2.1e-158)
(/
2.0
(*
(* (* (/ (/ (pow t_m 3.0) l_m) l_m) k) (tan k))
(+ (+ 1.0 (* (/ k t_m) (/ k t_m))) 1.0)))
(if (<= k 2.2e-6)
(/ 2.0 (* 2.0 (* (* k k) (exp (- (* 3.0 (log t_m)) (* 2.0 (log l_m)))))))
(/
(* (/ (* (* l_m l_m) (cos k)) (* (pow (sin k) 2.0) t_m)) 2.0)
(* k k))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 2.1e-158) {
tmp = 2.0 / (((((pow(t_m, 3.0) / l_m) / l_m) * k) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else if (k <= 2.2e-6) {
tmp = 2.0 / (2.0 * ((k * k) * exp(((3.0 * log(t_m)) - (2.0 * log(l_m))))));
} else {
tmp = ((((l_m * l_m) * cos(k)) / (pow(sin(k), 2.0) * t_m)) * 2.0) / (k * k);
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 2.1d-158) then
tmp = 2.0d0 / ((((((t_m ** 3.0d0) / l_m) / l_m) * k) * tan(k)) * ((1.0d0 + ((k / t_m) * (k / t_m))) + 1.0d0))
else if (k <= 2.2d-6) then
tmp = 2.0d0 / (2.0d0 * ((k * k) * exp(((3.0d0 * log(t_m)) - (2.0d0 * log(l_m))))))
else
tmp = ((((l_m * l_m) * cos(k)) / ((sin(k) ** 2.0d0) * t_m)) * 2.0d0) / (k * k)
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 2.1e-158) {
tmp = 2.0 / (((((Math.pow(t_m, 3.0) / l_m) / l_m) * k) * Math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else if (k <= 2.2e-6) {
tmp = 2.0 / (2.0 * ((k * k) * Math.exp(((3.0 * Math.log(t_m)) - (2.0 * Math.log(l_m))))));
} else {
tmp = ((((l_m * l_m) * Math.cos(k)) / (Math.pow(Math.sin(k), 2.0) * t_m)) * 2.0) / (k * k);
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if k <= 2.1e-158: tmp = 2.0 / (((((math.pow(t_m, 3.0) / l_m) / l_m) * k) * math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)) elif k <= 2.2e-6: tmp = 2.0 / (2.0 * ((k * k) * math.exp(((3.0 * math.log(t_m)) - (2.0 * math.log(l_m)))))) else: tmp = ((((l_m * l_m) * math.cos(k)) / (math.pow(math.sin(k), 2.0) * t_m)) * 2.0) / (k * k) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (k <= 2.1e-158) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64((t_m ^ 3.0) / l_m) / l_m) * k) * tan(k)) * Float64(Float64(1.0 + Float64(Float64(k / t_m) * Float64(k / t_m))) + 1.0))); elseif (k <= 2.2e-6) tmp = Float64(2.0 / Float64(2.0 * Float64(Float64(k * k) * exp(Float64(Float64(3.0 * log(t_m)) - Float64(2.0 * log(l_m))))))); else tmp = Float64(Float64(Float64(Float64(Float64(l_m * l_m) * cos(k)) / Float64((sin(k) ^ 2.0) * t_m)) * 2.0) / Float64(k * k)); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (k <= 2.1e-158) tmp = 2.0 / ((((((t_m ^ 3.0) / l_m) / l_m) * k) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)); elseif (k <= 2.2e-6) tmp = 2.0 / (2.0 * ((k * k) * exp(((3.0 * log(t_m)) - (2.0 * log(l_m)))))); else tmp = ((((l_m * l_m) * cos(k)) / ((sin(k) ^ 2.0) * t_m)) * 2.0) / (k * k); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[k, 2.1e-158], N[(2.0 / N[(N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * k), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k / t$95$m), $MachinePrecision] * N[(k / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 2.2e-6], N[(2.0 / N[(2.0 * N[(N[(k * k), $MachinePrecision] * N[Exp[N[(N[(3.0 * N[Log[t$95$m], $MachinePrecision]), $MachinePrecision] - N[(2.0 * N[Log[l$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(l$95$m * l$95$m), $MachinePrecision] * N[Cos[k], $MachinePrecision]), $MachinePrecision] / N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 2.1 \cdot 10^{-158}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\frac{{t\_m}^{3}}{l\_m}}{l\_m} \cdot k\right) \cdot \tan k\right) \cdot \left(\left(1 + \frac{k}{t\_m} \cdot \frac{k}{t\_m}\right) + 1\right)}\\
\mathbf{elif}\;k \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{2 \cdot \left(\left(k \cdot k\right) \cdot e^{3 \cdot \log t\_m - 2 \cdot \log l\_m}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(l\_m \cdot l\_m\right) \cdot \cos k}{{\sin k}^{2} \cdot t\_m} \cdot 2}{k \cdot k}\\
\end{array}
\end{array}
if k < 2.09999999999999991e-158Initial program 56.6%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6419.2
Applied rewrites19.2%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6419.2
Applied rewrites19.2%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
exp-diffN/A
*-commutativeN/A
pow-to-expN/A
*-commutativeN/A
pow-to-expN/A
pow2N/A
associate-/r*N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f6458.4
Applied rewrites58.4%
if 2.09999999999999991e-158 < k < 2.2000000000000001e-6Initial program 58.8%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6418.5
Applied rewrites18.5%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6418.5
Applied rewrites18.5%
Taylor expanded in k around 0
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lower-*.f64N/A
lift-log.f6418.5
Applied rewrites18.5%
if 2.2000000000000001e-6 < k Initial program 42.8%
Taylor expanded in k around 0
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift-pow.f6441.2
Applied rewrites41.2%
Taylor expanded in k around inf
Applied rewrites53.9%
Taylor expanded in t around 0
*-commutativeN/A
*-commutativeN/A
pow2N/A
lower-*.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f6463.6
Applied rewrites63.6%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= k 2.1e-158)
(/
2.0
(*
(* (* (/ (/ (pow t_m 3.0) l_m) l_m) k) (tan k))
(+ (+ 1.0 (* (/ k t_m) (/ k t_m))) 1.0)))
(if (<= k 2.2e-6)
(/ 2.0 (* 2.0 (* (* k k) (exp (- (* 3.0 (log t_m)) (* 2.0 (log l_m)))))))
(*
(* (/ (* l_m l_m) (* k k)) (/ (cos k) (* (pow (sin k) 2.0) t_m)))
2.0)))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 2.1e-158) {
tmp = 2.0 / (((((pow(t_m, 3.0) / l_m) / l_m) * k) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else if (k <= 2.2e-6) {
tmp = 2.0 / (2.0 * ((k * k) * exp(((3.0 * log(t_m)) - (2.0 * log(l_m))))));
} else {
tmp = (((l_m * l_m) / (k * k)) * (cos(k) / (pow(sin(k), 2.0) * t_m))) * 2.0;
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 2.1d-158) then
tmp = 2.0d0 / ((((((t_m ** 3.0d0) / l_m) / l_m) * k) * tan(k)) * ((1.0d0 + ((k / t_m) * (k / t_m))) + 1.0d0))
else if (k <= 2.2d-6) then
tmp = 2.0d0 / (2.0d0 * ((k * k) * exp(((3.0d0 * log(t_m)) - (2.0d0 * log(l_m))))))
else
tmp = (((l_m * l_m) / (k * k)) * (cos(k) / ((sin(k) ** 2.0d0) * t_m))) * 2.0d0
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (k <= 2.1e-158) {
tmp = 2.0 / (((((Math.pow(t_m, 3.0) / l_m) / l_m) * k) * Math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0));
} else if (k <= 2.2e-6) {
tmp = 2.0 / (2.0 * ((k * k) * Math.exp(((3.0 * Math.log(t_m)) - (2.0 * Math.log(l_m))))));
} else {
tmp = (((l_m * l_m) / (k * k)) * (Math.cos(k) / (Math.pow(Math.sin(k), 2.0) * t_m))) * 2.0;
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if k <= 2.1e-158: tmp = 2.0 / (((((math.pow(t_m, 3.0) / l_m) / l_m) * k) * math.tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)) elif k <= 2.2e-6: tmp = 2.0 / (2.0 * ((k * k) * math.exp(((3.0 * math.log(t_m)) - (2.0 * math.log(l_m)))))) else: tmp = (((l_m * l_m) / (k * k)) * (math.cos(k) / (math.pow(math.sin(k), 2.0) * t_m))) * 2.0 return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (k <= 2.1e-158) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64((t_m ^ 3.0) / l_m) / l_m) * k) * tan(k)) * Float64(Float64(1.0 + Float64(Float64(k / t_m) * Float64(k / t_m))) + 1.0))); elseif (k <= 2.2e-6) tmp = Float64(2.0 / Float64(2.0 * Float64(Float64(k * k) * exp(Float64(Float64(3.0 * log(t_m)) - Float64(2.0 * log(l_m))))))); else tmp = Float64(Float64(Float64(Float64(l_m * l_m) / Float64(k * k)) * Float64(cos(k) / Float64((sin(k) ^ 2.0) * t_m))) * 2.0); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (k <= 2.1e-158) tmp = 2.0 / ((((((t_m ^ 3.0) / l_m) / l_m) * k) * tan(k)) * ((1.0 + ((k / t_m) * (k / t_m))) + 1.0)); elseif (k <= 2.2e-6) tmp = 2.0 / (2.0 * ((k * k) * exp(((3.0 * log(t_m)) - (2.0 * log(l_m)))))); else tmp = (((l_m * l_m) / (k * k)) * (cos(k) / ((sin(k) ^ 2.0) * t_m))) * 2.0; end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[k, 2.1e-158], N[(2.0 / N[(N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * k), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k / t$95$m), $MachinePrecision] * N[(k / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 2.2e-6], N[(2.0 / N[(2.0 * N[(N[(k * k), $MachinePrecision] * N[Exp[N[(N[(3.0 * N[Log[t$95$m], $MachinePrecision]), $MachinePrecision] - N[(2.0 * N[Log[l$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 2.1 \cdot 10^{-158}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\frac{{t\_m}^{3}}{l\_m}}{l\_m} \cdot k\right) \cdot \tan k\right) \cdot \left(\left(1 + \frac{k}{t\_m} \cdot \frac{k}{t\_m}\right) + 1\right)}\\
\mathbf{elif}\;k \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;\frac{2}{2 \cdot \left(\left(k \cdot k\right) \cdot e^{3 \cdot \log t\_m - 2 \cdot \log l\_m}\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{l\_m \cdot l\_m}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t\_m}\right) \cdot 2\\
\end{array}
\end{array}
if k < 2.09999999999999991e-158Initial program 56.6%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6419.2
Applied rewrites19.2%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6419.2
Applied rewrites19.2%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
exp-diffN/A
*-commutativeN/A
pow-to-expN/A
*-commutativeN/A
pow-to-expN/A
pow2N/A
associate-/r*N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f6458.4
Applied rewrites58.4%
if 2.09999999999999991e-158 < k < 2.2000000000000001e-6Initial program 58.8%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-to-expN/A
pow2N/A
pow-to-expN/A
div-expN/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6418.5
Applied rewrites18.5%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6418.5
Applied rewrites18.5%
Taylor expanded in k around 0
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-log.f64N/A
lower-*.f64N/A
lift-log.f6418.5
Applied rewrites18.5%
if 2.2000000000000001e-6 < k Initial program 42.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.9%
Final simplification54.9%
l_m = (fabs.f64 l)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k)
:precision binary64
(*
t_s
(if (<= t_m 7.5e-85)
(/ 2.0 (* (* (* (/ k l_m) (/ k l_m)) t_m) (* k k)))
(if (<= t_m 7.6e+54)
(/
2.0
(*
(* (* (/ (* (* t_m t_m) t_m) (* l_m l_m)) (sin k)) (tan k))
(+ (+ 1.0 (/ (* k k) (* t_m t_m))) 1.0)))
(/
2.0
(*
(/
(+
(* (pow (* k t_m) 2.0) (+ (* (* k k) 0.3333333333333333) 2.0))
(pow k 4.0))
(* l_m l_m))
t_m))))))l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 7.5e-85) {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
} else if (t_m <= 7.6e+54) {
tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k * k) / (t_m * t_m))) + 1.0));
} else {
tmp = 2.0 / ((((pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + pow(k, 4.0)) / (l_m * l_m)) * t_m);
}
return t_s * tmp;
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
real(8) :: tmp
if (t_m <= 7.5d-85) then
tmp = 2.0d0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k))
else if (t_m <= 7.6d+54) then
tmp = 2.0d0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0d0 + ((k * k) / (t_m * t_m))) + 1.0d0))
else
tmp = 2.0d0 / ((((((k * t_m) ** 2.0d0) * (((k * k) * 0.3333333333333333d0) + 2.0d0)) + (k ** 4.0d0)) / (l_m * l_m)) * t_m)
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
double tmp;
if (t_m <= 7.5e-85) {
tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k));
} else if (t_m <= 7.6e+54) {
tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + ((k * k) / (t_m * t_m))) + 1.0));
} else {
tmp = 2.0 / ((((Math.pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + Math.pow(k, 4.0)) / (l_m * l_m)) * t_m);
}
return t_s * tmp;
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): tmp = 0 if t_m <= 7.5e-85: tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)) elif t_m <= 7.6e+54: tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * math.sin(k)) * math.tan(k)) * ((1.0 + ((k * k) / (t_m * t_m))) + 1.0)) else: tmp = 2.0 / ((((math.pow((k * t_m), 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + math.pow(k, 4.0)) / (l_m * l_m)) * t_m) return t_s * tmp
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) tmp = 0.0 if (t_m <= 7.5e-85) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k / l_m) * Float64(k / l_m)) * t_m) * Float64(k * k))); elseif (t_m <= 7.6e+54) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(t_m * t_m) * t_m) / Float64(l_m * l_m)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + Float64(Float64(k * k) / Float64(t_m * t_m))) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64((Float64(k * t_m) ^ 2.0) * Float64(Float64(Float64(k * k) * 0.3333333333333333) + 2.0)) + (k ^ 4.0)) / Float64(l_m * l_m)) * t_m)); end return Float64(t_s * tmp) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k) tmp = 0.0; if (t_m <= 7.5e-85) tmp = 2.0 / ((((k / l_m) * (k / l_m)) * t_m) * (k * k)); elseif (t_m <= 7.6e+54) tmp = 2.0 / ((((((t_m * t_m) * t_m) / (l_m * l_m)) * sin(k)) * tan(k)) * ((1.0 + ((k * k) / (t_m * t_m))) + 1.0)); else tmp = 2.0 / ((((((k * t_m) ^ 2.0) * (((k * k) * 0.3333333333333333) + 2.0)) + (k ^ 4.0)) / (l_m * l_m)) * t_m); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * If[LessEqual[t$95$m, 7.5e-85], N[(2.0 / N[(N[(N[(N[(k / l$95$m), $MachinePrecision] * N[(k / l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 7.6e+54], N[(2.0 / N[(N[(N[(N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * t$95$m), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k * k), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(N[Power[N[(k * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(N[(k * k), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 7.5 \cdot 10^{-85}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{k}{l\_m} \cdot \frac{k}{l\_m}\right) \cdot t\_m\right) \cdot \left(k \cdot k\right)}\\
\mathbf{elif}\;t\_m \leq 7.6 \cdot 10^{+54}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\left(t\_m \cdot t\_m\right) \cdot t\_m}{l\_m \cdot l\_m} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + \frac{k \cdot k}{t\_m \cdot t\_m}\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{{\left(k \cdot t\_m\right)}^{2} \cdot \left(\left(k \cdot k\right) \cdot 0.3333333333333333 + 2\right) + {k}^{4}}{l\_m \cdot l\_m} \cdot t\_m}\\
\end{array}
\end{array}
if t < 7.5000000000000003e-85Initial program 46.2%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.3%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites51.8%
Taylor expanded in t around 0
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6459.6
Applied rewrites59.6%
if 7.5000000000000003e-85 < t < 7.6000000000000005e54Initial program 75.7%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
frac-timesN/A
unpow2N/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6475.8
Applied rewrites75.8%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6475.7
Applied rewrites75.7%
if 7.6000000000000005e54 < t Initial program 62.2%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.3%
Final simplification64.8%
l_m = (fabs.f64 l) t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l_m k) :precision binary64 (* t_s (/ (* l_m l_m) (* (* k k) (* (* t_m t_m) t_m)))))
l_m = fabs(l);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k) {
return t_s * ((l_m * l_m) / ((k * k) * ((t_m * t_m) * t_m)));
}
l_m = private
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_m, k)
use fmin_fmax_functions
real(8), intent (in) :: t_s
real(8), intent (in) :: t_m
real(8), intent (in) :: l_m
real(8), intent (in) :: k
code = t_s * ((l_m * l_m) / ((k * k) * ((t_m * t_m) * t_m)))
end function
l_m = Math.abs(l);
t\_m = Math.abs(t);
t\_s = Math.copySign(1.0, t);
public static double code(double t_s, double t_m, double l_m, double k) {
return t_s * ((l_m * l_m) / ((k * k) * ((t_m * t_m) * t_m)));
}
l_m = math.fabs(l) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k): return t_s * ((l_m * l_m) / ((k * k) * ((t_m * t_m) * t_m)))
l_m = abs(l) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k) return Float64(t_s * Float64(Float64(l_m * l_m) / Float64(Float64(k * k) * Float64(Float64(t_m * t_m) * t_m)))) end
l_m = abs(l); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l_m, k) tmp = t_s * ((l_m * l_m) / ((k * k) * ((t_m * t_m) * t_m))); end
l_m = N[Abs[l], $MachinePrecision]
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$95$m_, k_] := N[(t$95$s * N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(N[(k * k), $MachinePrecision] * N[(N[(t$95$m * t$95$m), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \frac{l\_m \cdot l\_m}{\left(k \cdot k\right) \cdot \left(\left(t\_m \cdot t\_m\right) \cdot t\_m\right)}
\end{array}
Initial program 53.9%
Taylor expanded in k around 0
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift-pow.f6447.7
Applied rewrites47.7%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6447.7
Applied rewrites47.7%
Final simplification47.7%
herbie shell --seed 2025058
(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))))