
(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 20 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)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= k_m 1.2e-129)
(/
2.0
(*
(* (* (exp (fma (log t_m) 3.0 (* -2.0 (log l_m)))) (sin k_m)) (tan k_m))
2.0))
(/
2.0
(*
(/
(fma (pow (* (sin k_m) t_m) 2.0) 2.0 (pow (* (sin k_m) k_m) 2.0))
(* (cos k_m) l_m))
(/ t_m l_m))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (k_m <= 1.2e-129) {
tmp = 2.0 / (((exp(fma(log(t_m), 3.0, (-2.0 * log(l_m)))) * sin(k_m)) * tan(k_m)) * 2.0);
} else {
tmp = 2.0 / ((fma(pow((sin(k_m) * t_m), 2.0), 2.0, pow((sin(k_m) * k_m), 2.0)) / (cos(k_m) * l_m)) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (k_m <= 1.2e-129) tmp = Float64(2.0 / Float64(Float64(Float64(exp(fma(log(t_m), 3.0, Float64(-2.0 * log(l_m)))) * sin(k_m)) * tan(k_m)) * 2.0)); else tmp = Float64(2.0 / Float64(Float64(fma((Float64(sin(k_m) * t_m) ^ 2.0), 2.0, (Float64(sin(k_m) * k_m) ^ 2.0)) / Float64(cos(k_m) * l_m)) * Float64(t_m / l_m))); end return Float64(t_s * tmp) end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[k$95$m, 1.2e-129], N[(2.0 / N[(N[(N[(N[Exp[N[(N[Log[t$95$m], $MachinePrecision] * 3.0 + N[(-2.0 * N[Log[l$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * 2.0 + N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * k$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[k$95$m], $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k\_m \leq 1.2 \cdot 10^{-129}:\\
\;\;\;\;\frac{2}{\left(\left(e^{\mathsf{fma}\left(\log t\_m, 3, -2 \cdot \log l\_m\right)} \cdot \sin k\_m\right) \cdot \tan k\_m\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\mathsf{fma}\left({\left(\sin k\_m \cdot t\_m\right)}^{2}, 2, {\left(\sin k\_m \cdot k\_m\right)}^{2}\right)}{\cos k\_m \cdot l\_m} \cdot \frac{t\_m}{l\_m}}\\
\end{array}
\end{array}
if k < 1.19999999999999994e-129Initial program 49.9%
Taylor expanded in t around inf
Applied rewrites47.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.f6415.9
Applied rewrites15.9%
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-log.f6415.9
Applied rewrites15.9%
if 1.19999999999999994e-129 < k Initial program 51.4%
Taylor expanded in t around 0
Applied rewrites70.4%
Applied rewrites69.5%
Applied rewrites79.7%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<=
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k_m)) (tan k_m))
(+ (+ 1.0 (pow (/ k_m t_m) 2.0)) 1.0))
INFINITY)
(/ (* l_m l_m) (* k_m (* k_m (pow t_m 3.0))))
(/ 2.0 (* (* (* (/ (/ t_m l_m) l_m) (* k_m k_m)) k_m) k_m)))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k_m)) * tan(k_m)) * ((1.0 + pow((k_m / t_m), 2.0)) + 1.0)) <= ((double) INFINITY)) {
tmp = (l_m * l_m) / (k_m * (k_m * pow(t_m, 3.0)));
} else {
tmp = 2.0 / (((((t_m / l_m) / l_m) * (k_m * k_m)) * k_m) * k_m);
}
return t_s * tmp;
}
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double tmp;
if (((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k_m)) * Math.tan(k_m)) * ((1.0 + Math.pow((k_m / t_m), 2.0)) + 1.0)) <= Double.POSITIVE_INFINITY) {
tmp = (l_m * l_m) / (k_m * (k_m * Math.pow(t_m, 3.0)));
} else {
tmp = 2.0 / (((((t_m / l_m) / l_m) * (k_m * k_m)) * k_m) * k_m);
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): tmp = 0 if ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k_m)) * math.tan(k_m)) * ((1.0 + math.pow((k_m / t_m), 2.0)) + 1.0)) <= math.inf: tmp = (l_m * l_m) / (k_m * (k_m * math.pow(t_m, 3.0))) else: tmp = 2.0 / (((((t_m / l_m) / l_m) * (k_m * k_m)) * k_m) * k_m) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k_m)) * tan(k_m)) * Float64(Float64(1.0 + (Float64(k_m / t_m) ^ 2.0)) + 1.0)) <= Inf) tmp = Float64(Float64(l_m * l_m) / Float64(k_m * Float64(k_m * (t_m ^ 3.0)))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(t_m / l_m) / l_m) * Float64(k_m * k_m)) * k_m) * k_m)); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) tmp = 0.0; if ((((((t_m ^ 3.0) / (l_m * l_m)) * sin(k_m)) * tan(k_m)) * ((1.0 + ((k_m / t_m) ^ 2.0)) + 1.0)) <= Inf) tmp = (l_m * l_m) / (k_m * (k_m * (t_m ^ 3.0))); else tmp = 2.0 / (((((t_m / l_m) / l_m) * (k_m * k_m)) * k_m) * k_m); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[N[(N[(N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision] * N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k$95$m / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(k$95$m * N[(k$95$m * N[Power[t$95$m, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(N[(t$95$m / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;\left(\left(\frac{{t\_m}^{3}}{l\_m \cdot l\_m} \cdot \sin k\_m\right) \cdot \tan k\_m\right) \cdot \left(\left(1 + {\left(\frac{k\_m}{t\_m}\right)}^{2}\right) + 1\right) \leq \infty:\\
\;\;\;\;\frac{l\_m \cdot l\_m}{k\_m \cdot \left(k\_m \cdot {t\_m}^{3}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\frac{t\_m}{l\_m}}{l\_m} \cdot \left(k\_m \cdot k\_m\right)\right) \cdot k\_m\right) \cdot k\_m}\\
\end{array}
\end{array}
if (*.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))) < +inf.0Initial program 78.7%
Taylor expanded in k around 0
Applied rewrites62.5%
Applied rewrites70.9%
if +inf.0 < (*.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 0.0%
Taylor expanded in t around 0
Applied rewrites50.5%
Taylor expanded in k around 0
Applied rewrites14.8%
Taylor expanded in t around 0
Applied rewrites33.9%
Applied rewrites38.4%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= t_m 6.2e-60)
(/ 2.0 (* (/ (pow (* (sin k_m) k_m) 2.0) (* (cos k_m) l_m)) (/ t_m l_m)))
(if (<= t_m 9.2e+89)
(/
2.0
(*
(* (* (/ (/ (pow t_m 3.0) l_m) l_m) (sin k_m)) (tan k_m))
(+ (+ 1.0 (pow (/ k_m t_m) 2.0)) 1.0)))
(/
2.0
(*
(*
(* (exp (fma (log t_m) 3.0 (* -2.0 (log l_m)))) (sin k_m))
(tan k_m))
2.0))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (t_m <= 6.2e-60) {
tmp = 2.0 / ((pow((sin(k_m) * k_m), 2.0) / (cos(k_m) * l_m)) * (t_m / l_m));
} else if (t_m <= 9.2e+89) {
tmp = 2.0 / (((((pow(t_m, 3.0) / l_m) / l_m) * sin(k_m)) * tan(k_m)) * ((1.0 + pow((k_m / t_m), 2.0)) + 1.0));
} else {
tmp = 2.0 / (((exp(fma(log(t_m), 3.0, (-2.0 * log(l_m)))) * sin(k_m)) * tan(k_m)) * 2.0);
}
return t_s * tmp;
}
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (t_m <= 6.2e-60) tmp = Float64(2.0 / Float64(Float64((Float64(sin(k_m) * k_m) ^ 2.0) / Float64(cos(k_m) * l_m)) * Float64(t_m / l_m))); elseif (t_m <= 9.2e+89) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64((t_m ^ 3.0) / l_m) / l_m) * sin(k_m)) * tan(k_m)) * Float64(Float64(1.0 + (Float64(k_m / t_m) ^ 2.0)) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64(exp(fma(log(t_m), 3.0, Float64(-2.0 * log(l_m)))) * sin(k_m)) * tan(k_m)) * 2.0)); end return Float64(t_s * tmp) end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 6.2e-60], N[(2.0 / N[(N[(N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * k$95$m), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Cos[k$95$m], $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 9.2e+89], 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$95$m], $MachinePrecision]), $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k$95$m / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Exp[N[(N[Log[t$95$m], $MachinePrecision] * 3.0 + N[(-2.0 * N[Log[l$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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 6.2 \cdot 10^{-60}:\\
\;\;\;\;\frac{2}{\frac{{\left(\sin k\_m \cdot k\_m\right)}^{2}}{\cos k\_m \cdot l\_m} \cdot \frac{t\_m}{l\_m}}\\
\mathbf{elif}\;t\_m \leq 9.2 \cdot 10^{+89}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\frac{{t\_m}^{3}}{l\_m}}{l\_m} \cdot \sin k\_m\right) \cdot \tan k\_m\right) \cdot \left(\left(1 + {\left(\frac{k\_m}{t\_m}\right)}^{2}\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(e^{\mathsf{fma}\left(\log t\_m, 3, -2 \cdot \log l\_m\right)} \cdot \sin k\_m\right) \cdot \tan k\_m\right) \cdot 2}\\
\end{array}
\end{array}
if t < 6.19999999999999976e-60Initial program 41.7%
Taylor expanded in t around 0
Applied rewrites70.1%
Applied rewrites70.6%
Applied rewrites80.7%
Taylor expanded in t around 0
Applied rewrites67.8%
if 6.19999999999999976e-60 < t < 9.1999999999999996e89Initial program 70.2%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-pow.f6483.3
Applied rewrites83.3%
if 9.1999999999999996e89 < t Initial program 73.1%
Taylor expanded in t around inf
Applied rewrites73.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.f6452.0
Applied rewrites52.0%
lift--.f64N/A
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-log.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
metadata-evalN/A
lower-*.f64N/A
lift-log.f6452.1
Applied rewrites52.1%
Final simplification66.8%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<=
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k_m)) (tan k_m))
(+ (+ 1.0 (pow (/ k_m t_m) 2.0)) 1.0)))
1e+30)
(/ (* l_m l_m) (* (* k_m k_m) (* (* t_m t_m) t_m)))
(/ 2.0 (* (* (* k_m k_m) (/ t_m (* l_m l_m))) (* k_m k_m))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k_m)) * tan(k_m)) * ((1.0 + pow((k_m / t_m), 2.0)) + 1.0))) <= 1e+30) {
tmp = (l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m));
} else {
tmp = 2.0 / (((k_m * k_m) * (t_m / (l_m * l_m))) * (k_m * k_m));
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: tmp
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k_m)) * tan(k_m)) * ((1.0d0 + ((k_m / t_m) ** 2.0d0)) + 1.0d0))) <= 1d+30) then
tmp = (l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m))
else
tmp = 2.0d0 / (((k_m * k_m) * (t_m / (l_m * l_m))) * (k_m * k_m))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k_m)) * Math.tan(k_m)) * ((1.0 + Math.pow((k_m / t_m), 2.0)) + 1.0))) <= 1e+30) {
tmp = (l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m));
} else {
tmp = 2.0 / (((k_m * k_m) * (t_m / (l_m * l_m))) * (k_m * k_m));
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k_m)) * math.tan(k_m)) * ((1.0 + math.pow((k_m / t_m), 2.0)) + 1.0))) <= 1e+30: tmp = (l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m)) else: tmp = 2.0 / (((k_m * k_m) * (t_m / (l_m * l_m))) * (k_m * k_m)) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k_m)) * tan(k_m)) * Float64(Float64(1.0 + (Float64(k_m / t_m) ^ 2.0)) + 1.0))) <= 1e+30) tmp = Float64(Float64(l_m * l_m) / Float64(Float64(k_m * k_m) * Float64(Float64(t_m * t_m) * t_m))); else tmp = Float64(2.0 / Float64(Float64(Float64(k_m * k_m) * Float64(t_m / Float64(l_m * l_m))) * Float64(k_m * k_m))); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k_m)) * tan(k_m)) * ((1.0 + ((k_m / t_m) ^ 2.0)) + 1.0))) <= 1e+30) tmp = (l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m)); else tmp = 2.0 / (((k_m * k_m) * (t_m / (l_m * l_m))) * (k_m * k_m)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := 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$95$m], $MachinePrecision]), $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k$95$m / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+30], N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(N[(t$95$m * t$95$m), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(t$95$m / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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\_m\right) \cdot \tan k\_m\right) \cdot \left(\left(1 + {\left(\frac{k\_m}{t\_m}\right)}^{2}\right) + 1\right)} \leq 10^{+30}:\\
\;\;\;\;\frac{l\_m \cdot l\_m}{\left(k\_m \cdot k\_m\right) \cdot \left(\left(t\_m \cdot t\_m\right) \cdot t\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(k\_m \cdot k\_m\right) \cdot \frac{t\_m}{l\_m \cdot l\_m}\right) \cdot \left(k\_m \cdot k\_m\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)))) < 1e30Initial program 78.8%
Taylor expanded in k around 0
Applied rewrites63.0%
Applied rewrites63.0%
if 1e30 < (/.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 19.8%
Taylor expanded in t around 0
Applied rewrites60.0%
Taylor expanded in k around 0
Applied rewrites29.2%
Taylor expanded in t around 0
Applied rewrites41.8%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<=
(/
2.0
(*
(* (* (/ (pow t_m 3.0) (* l_m l_m)) (sin k_m)) (tan k_m))
(+ (+ 1.0 (pow (/ k_m t_m) 2.0)) 1.0)))
1e+30)
(/ (* l_m l_m) (* (* k_m k_m) (* (* t_m t_m) t_m)))
(/ 2.0 (/ (* (* (* k_m k_m) t_m) (* k_m k_m)) (* l_m l_m))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if ((2.0 / ((((pow(t_m, 3.0) / (l_m * l_m)) * sin(k_m)) * tan(k_m)) * ((1.0 + pow((k_m / t_m), 2.0)) + 1.0))) <= 1e+30) {
tmp = (l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m));
} else {
tmp = 2.0 / ((((k_m * k_m) * t_m) * (k_m * k_m)) / (l_m * l_m));
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: tmp
if ((2.0d0 / (((((t_m ** 3.0d0) / (l_m * l_m)) * sin(k_m)) * tan(k_m)) * ((1.0d0 + ((k_m / t_m) ** 2.0d0)) + 1.0d0))) <= 1d+30) then
tmp = (l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m))
else
tmp = 2.0d0 / ((((k_m * k_m) * t_m) * (k_m * k_m)) / (l_m * l_m))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double tmp;
if ((2.0 / ((((Math.pow(t_m, 3.0) / (l_m * l_m)) * Math.sin(k_m)) * Math.tan(k_m)) * ((1.0 + Math.pow((k_m / t_m), 2.0)) + 1.0))) <= 1e+30) {
tmp = (l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m));
} else {
tmp = 2.0 / ((((k_m * k_m) * t_m) * (k_m * k_m)) / (l_m * l_m));
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): tmp = 0 if (2.0 / ((((math.pow(t_m, 3.0) / (l_m * l_m)) * math.sin(k_m)) * math.tan(k_m)) * ((1.0 + math.pow((k_m / t_m), 2.0)) + 1.0))) <= 1e+30: tmp = (l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m)) else: tmp = 2.0 / ((((k_m * k_m) * t_m) * (k_m * k_m)) / (l_m * l_m)) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (Float64(2.0 / Float64(Float64(Float64(Float64((t_m ^ 3.0) / Float64(l_m * l_m)) * sin(k_m)) * tan(k_m)) * Float64(Float64(1.0 + (Float64(k_m / t_m) ^ 2.0)) + 1.0))) <= 1e+30) tmp = Float64(Float64(l_m * l_m) / Float64(Float64(k_m * k_m) * Float64(Float64(t_m * t_m) * t_m))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k_m * k_m) * t_m) * Float64(k_m * k_m)) / Float64(l_m * l_m))); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) tmp = 0.0; if ((2.0 / (((((t_m ^ 3.0) / (l_m * l_m)) * sin(k_m)) * tan(k_m)) * ((1.0 + ((k_m / t_m) ^ 2.0)) + 1.0))) <= 1e+30) tmp = (l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m)); else tmp = 2.0 / ((((k_m * k_m) * t_m) * (k_m * k_m)) / (l_m * l_m)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := 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$95$m], $MachinePrecision]), $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k$95$m / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+30], N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(N[(t$95$m * t$95$m), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] / N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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\_m\right) \cdot \tan k\_m\right) \cdot \left(\left(1 + {\left(\frac{k\_m}{t\_m}\right)}^{2}\right) + 1\right)} \leq 10^{+30}:\\
\;\;\;\;\frac{l\_m \cdot l\_m}{\left(k\_m \cdot k\_m\right) \cdot \left(\left(t\_m \cdot t\_m\right) \cdot t\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\left(\left(k\_m \cdot k\_m\right) \cdot t\_m\right) \cdot \left(k\_m \cdot k\_m\right)}{l\_m \cdot l\_m}}\\
\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)))) < 1e30Initial program 78.8%
Taylor expanded in k around 0
Applied rewrites63.0%
Applied rewrites63.0%
if 1e30 < (/.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 19.8%
Taylor expanded in t around 0
Applied rewrites60.0%
Taylor expanded in k around 0
Applied rewrites29.2%
Taylor expanded in l around 0
Applied rewrites36.1%
Taylor expanded in t around 0
Applied rewrites40.2%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= t_m 6.2e-60)
(/ 2.0 (* (/ (pow (* (sin k_m) k_m) 2.0) (* (cos k_m) l_m)) (/ t_m l_m)))
(if (<= t_m 1e+88)
(/
2.0
(*
(* (* (/ (/ (pow t_m 3.0) l_m) l_m) (sin k_m)) (tan k_m))
(+ (+ 1.0 (pow (/ k_m t_m) 2.0)) 1.0)))
(/ 2.0 (* (* (/ (pow (* k_m t_m) 2.0) l_m) 2.0) (/ t_m l_m)))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (t_m <= 6.2e-60) {
tmp = 2.0 / ((pow((sin(k_m) * k_m), 2.0) / (cos(k_m) * l_m)) * (t_m / l_m));
} else if (t_m <= 1e+88) {
tmp = 2.0 / (((((pow(t_m, 3.0) / l_m) / l_m) * sin(k_m)) * tan(k_m)) * ((1.0 + pow((k_m / t_m), 2.0)) + 1.0));
} else {
tmp = 2.0 / (((pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: tmp
if (t_m <= 6.2d-60) then
tmp = 2.0d0 / ((((sin(k_m) * k_m) ** 2.0d0) / (cos(k_m) * l_m)) * (t_m / l_m))
else if (t_m <= 1d+88) then
tmp = 2.0d0 / ((((((t_m ** 3.0d0) / l_m) / l_m) * sin(k_m)) * tan(k_m)) * ((1.0d0 + ((k_m / t_m) ** 2.0d0)) + 1.0d0))
else
tmp = 2.0d0 / (((((k_m * t_m) ** 2.0d0) / l_m) * 2.0d0) * (t_m / l_m))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double tmp;
if (t_m <= 6.2e-60) {
tmp = 2.0 / ((Math.pow((Math.sin(k_m) * k_m), 2.0) / (Math.cos(k_m) * l_m)) * (t_m / l_m));
} else if (t_m <= 1e+88) {
tmp = 2.0 / (((((Math.pow(t_m, 3.0) / l_m) / l_m) * Math.sin(k_m)) * Math.tan(k_m)) * ((1.0 + Math.pow((k_m / t_m), 2.0)) + 1.0));
} else {
tmp = 2.0 / (((Math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): tmp = 0 if t_m <= 6.2e-60: tmp = 2.0 / ((math.pow((math.sin(k_m) * k_m), 2.0) / (math.cos(k_m) * l_m)) * (t_m / l_m)) elif t_m <= 1e+88: tmp = 2.0 / (((((math.pow(t_m, 3.0) / l_m) / l_m) * math.sin(k_m)) * math.tan(k_m)) * ((1.0 + math.pow((k_m / t_m), 2.0)) + 1.0)) else: tmp = 2.0 / (((math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m)) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (t_m <= 6.2e-60) tmp = Float64(2.0 / Float64(Float64((Float64(sin(k_m) * k_m) ^ 2.0) / Float64(cos(k_m) * l_m)) * Float64(t_m / l_m))); elseif (t_m <= 1e+88) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64((t_m ^ 3.0) / l_m) / l_m) * sin(k_m)) * tan(k_m)) * Float64(Float64(1.0 + (Float64(k_m / t_m) ^ 2.0)) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64((Float64(k_m * t_m) ^ 2.0) / l_m) * 2.0) * Float64(t_m / l_m))); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) tmp = 0.0; if (t_m <= 6.2e-60) tmp = 2.0 / ((((sin(k_m) * k_m) ^ 2.0) / (cos(k_m) * l_m)) * (t_m / l_m)); elseif (t_m <= 1e+88) tmp = 2.0 / ((((((t_m ^ 3.0) / l_m) / l_m) * sin(k_m)) * tan(k_m)) * ((1.0 + ((k_m / t_m) ^ 2.0)) + 1.0)); else tmp = 2.0 / (((((k_m * t_m) ^ 2.0) / l_m) * 2.0) * (t_m / l_m)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 6.2e-60], N[(2.0 / N[(N[(N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * k$95$m), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Cos[k$95$m], $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 1e+88], 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$95$m], $MachinePrecision]), $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k$95$m / t$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] / l$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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 6.2 \cdot 10^{-60}:\\
\;\;\;\;\frac{2}{\frac{{\left(\sin k\_m \cdot k\_m\right)}^{2}}{\cos k\_m \cdot l\_m} \cdot \frac{t\_m}{l\_m}}\\
\mathbf{elif}\;t\_m \leq 10^{+88}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\frac{{t\_m}^{3}}{l\_m}}{l\_m} \cdot \sin k\_m\right) \cdot \tan k\_m\right) \cdot \left(\left(1 + {\left(\frac{k\_m}{t\_m}\right)}^{2}\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{{\left(k\_m \cdot t\_m\right)}^{2}}{l\_m} \cdot 2\right) \cdot \frac{t\_m}{l\_m}}\\
\end{array}
\end{array}
if t < 6.19999999999999976e-60Initial program 41.7%
Taylor expanded in t around 0
Applied rewrites70.1%
Applied rewrites70.6%
Applied rewrites80.7%
Taylor expanded in t around 0
Applied rewrites67.8%
if 6.19999999999999976e-60 < t < 9.99999999999999959e87Initial program 70.2%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-pow.f6483.3
Applied rewrites83.3%
if 9.99999999999999959e87 < t Initial program 73.1%
Taylor expanded in t around 0
Applied rewrites84.4%
Applied rewrites86.4%
Applied rewrites91.2%
Taylor expanded in k around 0
Applied rewrites91.2%
Final simplification73.7%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= t_m 5.5e-60)
(/ 2.0 (* (/ (pow (* (sin k_m) k_m) 2.0) (* (cos k_m) l_m)) (/ t_m l_m)))
(if (<= t_m 1e+88)
(/
2.0
(*
(* (/ (/ (* (* t_m t_m) t_m) l_m) l_m) (sin k_m))
(* (tan k_m) (+ (+ (pow (/ k_m t_m) 2.0) 1.0) 1.0))))
(/ 2.0 (* (* (/ (pow (* k_m t_m) 2.0) l_m) 2.0) (/ t_m l_m)))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (t_m <= 5.5e-60) {
tmp = 2.0 / ((pow((sin(k_m) * k_m), 2.0) / (cos(k_m) * l_m)) * (t_m / l_m));
} else if (t_m <= 1e+88) {
tmp = 2.0 / ((((((t_m * t_m) * t_m) / l_m) / l_m) * sin(k_m)) * (tan(k_m) * ((pow((k_m / t_m), 2.0) + 1.0) + 1.0)));
} else {
tmp = 2.0 / (((pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: tmp
if (t_m <= 5.5d-60) then
tmp = 2.0d0 / ((((sin(k_m) * k_m) ** 2.0d0) / (cos(k_m) * l_m)) * (t_m / l_m))
else if (t_m <= 1d+88) then
tmp = 2.0d0 / ((((((t_m * t_m) * t_m) / l_m) / l_m) * sin(k_m)) * (tan(k_m) * ((((k_m / t_m) ** 2.0d0) + 1.0d0) + 1.0d0)))
else
tmp = 2.0d0 / (((((k_m * t_m) ** 2.0d0) / l_m) * 2.0d0) * (t_m / l_m))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double tmp;
if (t_m <= 5.5e-60) {
tmp = 2.0 / ((Math.pow((Math.sin(k_m) * k_m), 2.0) / (Math.cos(k_m) * l_m)) * (t_m / l_m));
} else if (t_m <= 1e+88) {
tmp = 2.0 / ((((((t_m * t_m) * t_m) / l_m) / l_m) * Math.sin(k_m)) * (Math.tan(k_m) * ((Math.pow((k_m / t_m), 2.0) + 1.0) + 1.0)));
} else {
tmp = 2.0 / (((Math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): tmp = 0 if t_m <= 5.5e-60: tmp = 2.0 / ((math.pow((math.sin(k_m) * k_m), 2.0) / (math.cos(k_m) * l_m)) * (t_m / l_m)) elif t_m <= 1e+88: tmp = 2.0 / ((((((t_m * t_m) * t_m) / l_m) / l_m) * math.sin(k_m)) * (math.tan(k_m) * ((math.pow((k_m / t_m), 2.0) + 1.0) + 1.0))) else: tmp = 2.0 / (((math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m)) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (t_m <= 5.5e-60) tmp = Float64(2.0 / Float64(Float64((Float64(sin(k_m) * k_m) ^ 2.0) / Float64(cos(k_m) * l_m)) * Float64(t_m / l_m))); elseif (t_m <= 1e+88) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(t_m * t_m) * t_m) / l_m) / l_m) * sin(k_m)) * Float64(tan(k_m) * Float64(Float64((Float64(k_m / t_m) ^ 2.0) + 1.0) + 1.0)))); else tmp = Float64(2.0 / Float64(Float64(Float64((Float64(k_m * t_m) ^ 2.0) / l_m) * 2.0) * Float64(t_m / l_m))); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) tmp = 0.0; if (t_m <= 5.5e-60) tmp = 2.0 / ((((sin(k_m) * k_m) ^ 2.0) / (cos(k_m) * l_m)) * (t_m / l_m)); elseif (t_m <= 1e+88) tmp = 2.0 / ((((((t_m * t_m) * t_m) / l_m) / l_m) * sin(k_m)) * (tan(k_m) * ((((k_m / t_m) ^ 2.0) + 1.0) + 1.0))); else tmp = 2.0 / (((((k_m * t_m) ^ 2.0) / l_m) * 2.0) * (t_m / l_m)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 5.5e-60], N[(2.0 / N[(N[(N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * k$95$m), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Cos[k$95$m], $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 1e+88], N[(2.0 / N[(N[(N[(N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * t$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * N[Sin[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[Tan[k$95$m], $MachinePrecision] * N[(N[(N[Power[N[(k$95$m / t$95$m), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] / l$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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 5.5 \cdot 10^{-60}:\\
\;\;\;\;\frac{2}{\frac{{\left(\sin k\_m \cdot k\_m\right)}^{2}}{\cos k\_m \cdot l\_m} \cdot \frac{t\_m}{l\_m}}\\
\mathbf{elif}\;t\_m \leq 10^{+88}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{\left(t\_m \cdot t\_m\right) \cdot t\_m}{l\_m}}{l\_m} \cdot \sin k\_m\right) \cdot \left(\tan k\_m \cdot \left(\left({\left(\frac{k\_m}{t\_m}\right)}^{2} + 1\right) + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{{\left(k\_m \cdot t\_m\right)}^{2}}{l\_m} \cdot 2\right) \cdot \frac{t\_m}{l\_m}}\\
\end{array}
\end{array}
if t < 5.4999999999999997e-60Initial program 41.7%
Taylor expanded in t around 0
Applied rewrites70.1%
Applied rewrites70.6%
Applied rewrites80.7%
Taylor expanded in t around 0
Applied rewrites67.8%
if 5.4999999999999997e-60 < t < 9.99999999999999959e87Initial program 70.2%
Applied rewrites83.3%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6483.3
Applied rewrites83.3%
if 9.99999999999999959e87 < t Initial program 73.1%
Taylor expanded in t around 0
Applied rewrites84.4%
Applied rewrites86.4%
Applied rewrites91.2%
Taylor expanded in k around 0
Applied rewrites91.2%
Final simplification73.7%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= t_m 2.4e-33)
(/ 2.0 (* (/ (/ (pow (* (sin k_m) k_m) 2.0) l_m) (cos k_m)) (/ t_m l_m)))
(if (<= t_m 2.7e+81)
(/ 2.0 (* (* (/ (/ (* k_m (pow t_m 3.0)) l_m) l_m) (tan k_m)) 2.0))
(/ 2.0 (* (* (/ (pow (* k_m t_m) 2.0) l_m) 2.0) (/ t_m l_m)))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (t_m <= 2.4e-33) {
tmp = 2.0 / (((pow((sin(k_m) * k_m), 2.0) / l_m) / cos(k_m)) * (t_m / l_m));
} else if (t_m <= 2.7e+81) {
tmp = 2.0 / (((((k_m * pow(t_m, 3.0)) / l_m) / l_m) * tan(k_m)) * 2.0);
} else {
tmp = 2.0 / (((pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: tmp
if (t_m <= 2.4d-33) then
tmp = 2.0d0 / (((((sin(k_m) * k_m) ** 2.0d0) / l_m) / cos(k_m)) * (t_m / l_m))
else if (t_m <= 2.7d+81) then
tmp = 2.0d0 / (((((k_m * (t_m ** 3.0d0)) / l_m) / l_m) * tan(k_m)) * 2.0d0)
else
tmp = 2.0d0 / (((((k_m * t_m) ** 2.0d0) / l_m) * 2.0d0) * (t_m / l_m))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double tmp;
if (t_m <= 2.4e-33) {
tmp = 2.0 / (((Math.pow((Math.sin(k_m) * k_m), 2.0) / l_m) / Math.cos(k_m)) * (t_m / l_m));
} else if (t_m <= 2.7e+81) {
tmp = 2.0 / (((((k_m * Math.pow(t_m, 3.0)) / l_m) / l_m) * Math.tan(k_m)) * 2.0);
} else {
tmp = 2.0 / (((Math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): tmp = 0 if t_m <= 2.4e-33: tmp = 2.0 / (((math.pow((math.sin(k_m) * k_m), 2.0) / l_m) / math.cos(k_m)) * (t_m / l_m)) elif t_m <= 2.7e+81: tmp = 2.0 / (((((k_m * math.pow(t_m, 3.0)) / l_m) / l_m) * math.tan(k_m)) * 2.0) else: tmp = 2.0 / (((math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m)) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (t_m <= 2.4e-33) tmp = Float64(2.0 / Float64(Float64(Float64((Float64(sin(k_m) * k_m) ^ 2.0) / l_m) / cos(k_m)) * Float64(t_m / l_m))); elseif (t_m <= 2.7e+81) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(k_m * (t_m ^ 3.0)) / l_m) / l_m) * tan(k_m)) * 2.0)); else tmp = Float64(2.0 / Float64(Float64(Float64((Float64(k_m * t_m) ^ 2.0) / l_m) * 2.0) * Float64(t_m / l_m))); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) tmp = 0.0; if (t_m <= 2.4e-33) tmp = 2.0 / (((((sin(k_m) * k_m) ^ 2.0) / l_m) / cos(k_m)) * (t_m / l_m)); elseif (t_m <= 2.7e+81) tmp = 2.0 / (((((k_m * (t_m ^ 3.0)) / l_m) / l_m) * tan(k_m)) * 2.0); else tmp = 2.0 / (((((k_m * t_m) ^ 2.0) / l_m) * 2.0) * (t_m / l_m)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 2.4e-33], N[(2.0 / N[(N[(N[(N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * k$95$m), $MachinePrecision], 2.0], $MachinePrecision] / l$95$m), $MachinePrecision] / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 2.7e+81], N[(2.0 / N[(N[(N[(N[(N[(k$95$m * N[Power[t$95$m, 3.0], $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] / l$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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 2.4 \cdot 10^{-33}:\\
\;\;\;\;\frac{2}{\frac{\frac{{\left(\sin k\_m \cdot k\_m\right)}^{2}}{l\_m}}{\cos k\_m} \cdot \frac{t\_m}{l\_m}}\\
\mathbf{elif}\;t\_m \leq 2.7 \cdot 10^{+81}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{k\_m \cdot {t\_m}^{3}}{l\_m}}{l\_m} \cdot \tan k\_m\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{{\left(k\_m \cdot t\_m\right)}^{2}}{l\_m} \cdot 2\right) \cdot \frac{t\_m}{l\_m}}\\
\end{array}
\end{array}
if t < 2.4e-33Initial program 43.1%
Taylor expanded in t around 0
Applied rewrites71.0%
Applied rewrites71.5%
Applied rewrites81.3%
Taylor expanded in t around 0
Applied rewrites68.8%
if 2.4e-33 < t < 2.6999999999999999e81Initial program 72.1%
Taylor expanded in t around inf
Applied rewrites51.6%
Taylor expanded in k around 0
Applied rewrites58.7%
Applied rewrites77.0%
if 2.6999999999999999e81 < t Initial program 70.2%
Taylor expanded in t around 0
Applied rewrites80.9%
Applied rewrites82.9%
Applied rewrites89.5%
Taylor expanded in k around 0
Applied rewrites89.2%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= t_m 2.4e-33)
(/ 2.0 (* (/ (pow (* (sin k_m) k_m) 2.0) (* (cos k_m) l_m)) (/ t_m l_m)))
(if (<= t_m 2.7e+81)
(/ 2.0 (* (* (/ (/ (* k_m (pow t_m 3.0)) l_m) l_m) (tan k_m)) 2.0))
(/ 2.0 (* (* (/ (pow (* k_m t_m) 2.0) l_m) 2.0) (/ t_m l_m)))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (t_m <= 2.4e-33) {
tmp = 2.0 / ((pow((sin(k_m) * k_m), 2.0) / (cos(k_m) * l_m)) * (t_m / l_m));
} else if (t_m <= 2.7e+81) {
tmp = 2.0 / (((((k_m * pow(t_m, 3.0)) / l_m) / l_m) * tan(k_m)) * 2.0);
} else {
tmp = 2.0 / (((pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: tmp
if (t_m <= 2.4d-33) then
tmp = 2.0d0 / ((((sin(k_m) * k_m) ** 2.0d0) / (cos(k_m) * l_m)) * (t_m / l_m))
else if (t_m <= 2.7d+81) then
tmp = 2.0d0 / (((((k_m * (t_m ** 3.0d0)) / l_m) / l_m) * tan(k_m)) * 2.0d0)
else
tmp = 2.0d0 / (((((k_m * t_m) ** 2.0d0) / l_m) * 2.0d0) * (t_m / l_m))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double tmp;
if (t_m <= 2.4e-33) {
tmp = 2.0 / ((Math.pow((Math.sin(k_m) * k_m), 2.0) / (Math.cos(k_m) * l_m)) * (t_m / l_m));
} else if (t_m <= 2.7e+81) {
tmp = 2.0 / (((((k_m * Math.pow(t_m, 3.0)) / l_m) / l_m) * Math.tan(k_m)) * 2.0);
} else {
tmp = 2.0 / (((Math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): tmp = 0 if t_m <= 2.4e-33: tmp = 2.0 / ((math.pow((math.sin(k_m) * k_m), 2.0) / (math.cos(k_m) * l_m)) * (t_m / l_m)) elif t_m <= 2.7e+81: tmp = 2.0 / (((((k_m * math.pow(t_m, 3.0)) / l_m) / l_m) * math.tan(k_m)) * 2.0) else: tmp = 2.0 / (((math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m)) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (t_m <= 2.4e-33) tmp = Float64(2.0 / Float64(Float64((Float64(sin(k_m) * k_m) ^ 2.0) / Float64(cos(k_m) * l_m)) * Float64(t_m / l_m))); elseif (t_m <= 2.7e+81) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(k_m * (t_m ^ 3.0)) / l_m) / l_m) * tan(k_m)) * 2.0)); else tmp = Float64(2.0 / Float64(Float64(Float64((Float64(k_m * t_m) ^ 2.0) / l_m) * 2.0) * Float64(t_m / l_m))); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) tmp = 0.0; if (t_m <= 2.4e-33) tmp = 2.0 / ((((sin(k_m) * k_m) ^ 2.0) / (cos(k_m) * l_m)) * (t_m / l_m)); elseif (t_m <= 2.7e+81) tmp = 2.0 / (((((k_m * (t_m ^ 3.0)) / l_m) / l_m) * tan(k_m)) * 2.0); else tmp = 2.0 / (((((k_m * t_m) ^ 2.0) / l_m) * 2.0) * (t_m / l_m)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 2.4e-33], N[(2.0 / N[(N[(N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * k$95$m), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Cos[k$95$m], $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 2.7e+81], N[(2.0 / N[(N[(N[(N[(N[(k$95$m * N[Power[t$95$m, 3.0], $MachinePrecision]), $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] / l$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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 2.4 \cdot 10^{-33}:\\
\;\;\;\;\frac{2}{\frac{{\left(\sin k\_m \cdot k\_m\right)}^{2}}{\cos k\_m \cdot l\_m} \cdot \frac{t\_m}{l\_m}}\\
\mathbf{elif}\;t\_m \leq 2.7 \cdot 10^{+81}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{k\_m \cdot {t\_m}^{3}}{l\_m}}{l\_m} \cdot \tan k\_m\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{{\left(k\_m \cdot t\_m\right)}^{2}}{l\_m} \cdot 2\right) \cdot \frac{t\_m}{l\_m}}\\
\end{array}
\end{array}
if t < 2.4e-33Initial program 43.1%
Taylor expanded in t around 0
Applied rewrites71.0%
Applied rewrites71.5%
Applied rewrites81.3%
Taylor expanded in t around 0
Applied rewrites68.8%
if 2.4e-33 < t < 2.6999999999999999e81Initial program 72.1%
Taylor expanded in t around inf
Applied rewrites51.6%
Taylor expanded in k around 0
Applied rewrites58.7%
Applied rewrites77.0%
if 2.6999999999999999e81 < t Initial program 70.2%
Taylor expanded in t around 0
Applied rewrites80.9%
Applied rewrites82.9%
Applied rewrites89.5%
Taylor expanded in k around 0
Applied rewrites89.2%
Final simplification73.2%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(let* ((t_2 (* (cos k_m) l_m)))
(*
t_s
(if (<= k_m 0.175)
(/ 2.0 (* (/ (* (pow (* k_m t_m) 2.0) 2.0) t_2) (/ t_m l_m)))
(/ 2.0 (/ (* (pow (* (sin k_m) k_m) 2.0) t_m) (* t_2 l_m)))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double t_2 = cos(k_m) * l_m;
double tmp;
if (k_m <= 0.175) {
tmp = 2.0 / (((pow((k_m * t_m), 2.0) * 2.0) / t_2) * (t_m / l_m));
} else {
tmp = 2.0 / ((pow((sin(k_m) * k_m), 2.0) * t_m) / (t_2 * l_m));
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: t_2
real(8) :: tmp
t_2 = cos(k_m) * l_m
if (k_m <= 0.175d0) then
tmp = 2.0d0 / (((((k_m * t_m) ** 2.0d0) * 2.0d0) / t_2) * (t_m / l_m))
else
tmp = 2.0d0 / ((((sin(k_m) * k_m) ** 2.0d0) * t_m) / (t_2 * l_m))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double t_2 = Math.cos(k_m) * l_m;
double tmp;
if (k_m <= 0.175) {
tmp = 2.0 / (((Math.pow((k_m * t_m), 2.0) * 2.0) / t_2) * (t_m / l_m));
} else {
tmp = 2.0 / ((Math.pow((Math.sin(k_m) * k_m), 2.0) * t_m) / (t_2 * l_m));
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): t_2 = math.cos(k_m) * l_m tmp = 0 if k_m <= 0.175: tmp = 2.0 / (((math.pow((k_m * t_m), 2.0) * 2.0) / t_2) * (t_m / l_m)) else: tmp = 2.0 / ((math.pow((math.sin(k_m) * k_m), 2.0) * t_m) / (t_2 * l_m)) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) t_2 = Float64(cos(k_m) * l_m) tmp = 0.0 if (k_m <= 0.175) tmp = Float64(2.0 / Float64(Float64(Float64((Float64(k_m * t_m) ^ 2.0) * 2.0) / t_2) * Float64(t_m / l_m))); else tmp = Float64(2.0 / Float64(Float64((Float64(sin(k_m) * k_m) ^ 2.0) * t_m) / Float64(t_2 * l_m))); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) t_2 = cos(k_m) * l_m; tmp = 0.0; if (k_m <= 0.175) tmp = 2.0 / (((((k_m * t_m) ^ 2.0) * 2.0) / t_2) * (t_m / l_m)); else tmp = 2.0 / ((((sin(k_m) * k_m) ^ 2.0) * t_m) / (t_2 * l_m)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := Block[{t$95$2 = N[(N[Cos[k$95$m], $MachinePrecision] * l$95$m), $MachinePrecision]}, N[(t$95$s * If[LessEqual[k$95$m, 0.175], N[(2.0 / N[(N[(N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / t$95$2), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * k$95$m), $MachinePrecision], 2.0], $MachinePrecision] * t$95$m), $MachinePrecision] / N[(t$95$2 * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \cos k\_m \cdot l\_m\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k\_m \leq 0.175:\\
\;\;\;\;\frac{2}{\frac{{\left(k\_m \cdot t\_m\right)}^{2} \cdot 2}{t\_2} \cdot \frac{t\_m}{l\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{{\left(\sin k\_m \cdot k\_m\right)}^{2} \cdot t\_m}{t\_2 \cdot l\_m}}\\
\end{array}
\end{array}
\end{array}
if k < 0.17499999999999999Initial program 52.6%
Taylor expanded in t around 0
Applied rewrites74.0%
Applied rewrites74.8%
Applied rewrites85.9%
Taylor expanded in k around 0
Applied rewrites66.3%
if 0.17499999999999999 < k Initial program 44.5%
Taylor expanded in t around 0
Applied rewrites69.0%
Applied rewrites68.9%
Taylor expanded in t around 0
Applied rewrites66.5%
Final simplification66.4%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= k_m 1.02e-16)
(/ 2.0 (* (/ (* (pow (* k_m t_m) 2.0) 2.0) (* (cos k_m) l_m)) (/ t_m l_m)))
(/
2.0
(* (/ (pow (* (sin k_m) k_m) 2.0) (* (cos k_m) (* l_m l_m))) t_m)))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (k_m <= 1.02e-16) {
tmp = 2.0 / (((pow((k_m * t_m), 2.0) * 2.0) / (cos(k_m) * l_m)) * (t_m / l_m));
} else {
tmp = 2.0 / ((pow((sin(k_m) * k_m), 2.0) / (cos(k_m) * (l_m * l_m))) * t_m);
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: tmp
if (k_m <= 1.02d-16) then
tmp = 2.0d0 / (((((k_m * t_m) ** 2.0d0) * 2.0d0) / (cos(k_m) * l_m)) * (t_m / l_m))
else
tmp = 2.0d0 / ((((sin(k_m) * k_m) ** 2.0d0) / (cos(k_m) * (l_m * l_m))) * t_m)
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double tmp;
if (k_m <= 1.02e-16) {
tmp = 2.0 / (((Math.pow((k_m * t_m), 2.0) * 2.0) / (Math.cos(k_m) * l_m)) * (t_m / l_m));
} else {
tmp = 2.0 / ((Math.pow((Math.sin(k_m) * k_m), 2.0) / (Math.cos(k_m) * (l_m * l_m))) * t_m);
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): tmp = 0 if k_m <= 1.02e-16: tmp = 2.0 / (((math.pow((k_m * t_m), 2.0) * 2.0) / (math.cos(k_m) * l_m)) * (t_m / l_m)) else: tmp = 2.0 / ((math.pow((math.sin(k_m) * k_m), 2.0) / (math.cos(k_m) * (l_m * l_m))) * t_m) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (k_m <= 1.02e-16) tmp = Float64(2.0 / Float64(Float64(Float64((Float64(k_m * t_m) ^ 2.0) * 2.0) / Float64(cos(k_m) * l_m)) * Float64(t_m / l_m))); else tmp = Float64(2.0 / Float64(Float64((Float64(sin(k_m) * k_m) ^ 2.0) / Float64(cos(k_m) * Float64(l_m * l_m))) * t_m)); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) tmp = 0.0; if (k_m <= 1.02e-16) tmp = 2.0 / (((((k_m * t_m) ^ 2.0) * 2.0) / (cos(k_m) * l_m)) * (t_m / l_m)); else tmp = 2.0 / ((((sin(k_m) * k_m) ^ 2.0) / (cos(k_m) * (l_m * l_m))) * t_m); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[k$95$m, 1.02e-16], N[(2.0 / N[(N[(N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[(N[Cos[k$95$m], $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[Power[N[(N[Sin[k$95$m], $MachinePrecision] * k$95$m), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Cos[k$95$m], $MachinePrecision] * N[(l$95$m * l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;k\_m \leq 1.02 \cdot 10^{-16}:\\
\;\;\;\;\frac{2}{\frac{{\left(k\_m \cdot t\_m\right)}^{2} \cdot 2}{\cos k\_m \cdot l\_m} \cdot \frac{t\_m}{l\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{{\left(\sin k\_m \cdot k\_m\right)}^{2}}{\cos k\_m \cdot \left(l\_m \cdot l\_m\right)} \cdot t\_m}\\
\end{array}
\end{array}
if k < 1.0200000000000001e-16Initial program 53.2%
Taylor expanded in t around 0
Applied rewrites74.7%
Applied rewrites75.6%
Applied rewrites85.7%
Taylor expanded in k around 0
Applied rewrites66.0%
if 1.0200000000000001e-16 < k Initial program 43.4%
Taylor expanded in t around 0
Applied rewrites67.2%
Taylor expanded in t around 0
Applied rewrites63.6%
Final simplification65.4%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(let* ((t_2 (* (cos k_m) l_m)))
(*
t_s
(if (<= t_m 1.22e-101)
(/
2.0
(*
(/
(*
(fma
(fma (* t_m t_m) -0.6666666666666666 1.0)
(* k_m k_m)
(* (* t_m t_m) 2.0))
(* k_m k_m))
t_2)
(/ t_m l_m)))
(if (<= t_m 9.2e+64)
(/
2.0
(*
(* (/ (/ (* (* t_m t_m) t_m) l_m) l_m) (* (sin k_m) (tan k_m)))
(+ (+ 1.0 (/ (* k_m k_m) (* t_m t_m))) 1.0)))
(/ 2.0 (* (/ (* (pow (* k_m t_m) 2.0) 2.0) t_2) (/ t_m l_m))))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double t_2 = cos(k_m) * l_m;
double tmp;
if (t_m <= 1.22e-101) {
tmp = 2.0 / (((fma(fma((t_m * t_m), -0.6666666666666666, 1.0), (k_m * k_m), ((t_m * t_m) * 2.0)) * (k_m * k_m)) / t_2) * (t_m / l_m));
} else if (t_m <= 9.2e+64) {
tmp = 2.0 / ((((((t_m * t_m) * t_m) / l_m) / l_m) * (sin(k_m) * tan(k_m))) * ((1.0 + ((k_m * k_m) / (t_m * t_m))) + 1.0));
} else {
tmp = 2.0 / (((pow((k_m * t_m), 2.0) * 2.0) / t_2) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) t_2 = Float64(cos(k_m) * l_m) tmp = 0.0 if (t_m <= 1.22e-101) tmp = Float64(2.0 / Float64(Float64(Float64(fma(fma(Float64(t_m * t_m), -0.6666666666666666, 1.0), Float64(k_m * k_m), Float64(Float64(t_m * t_m) * 2.0)) * Float64(k_m * k_m)) / t_2) * Float64(t_m / l_m))); elseif (t_m <= 9.2e+64) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(t_m * t_m) * t_m) / l_m) / l_m) * Float64(sin(k_m) * tan(k_m))) * Float64(Float64(1.0 + Float64(Float64(k_m * k_m) / Float64(t_m * t_m))) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64((Float64(k_m * t_m) ^ 2.0) * 2.0) / t_2) * Float64(t_m / l_m))); end return Float64(t_s * tmp) end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := Block[{t$95$2 = N[(N[Cos[k$95$m], $MachinePrecision] * l$95$m), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 1.22e-101], N[(2.0 / N[(N[(N[(N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * -0.6666666666666666 + 1.0), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision] + N[(N[(t$95$m * t$95$m), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 9.2e+64], N[(2.0 / N[(N[(N[(N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * t$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * N[(N[Sin[k$95$m], $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k$95$m * k$95$m), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / t$95$2), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \cos k\_m \cdot l\_m\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 1.22 \cdot 10^{-101}:\\
\;\;\;\;\frac{2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(t\_m \cdot t\_m, -0.6666666666666666, 1\right), k\_m \cdot k\_m, \left(t\_m \cdot t\_m\right) \cdot 2\right) \cdot \left(k\_m \cdot k\_m\right)}{t\_2} \cdot \frac{t\_m}{l\_m}}\\
\mathbf{elif}\;t\_m \leq 9.2 \cdot 10^{+64}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{\left(t\_m \cdot t\_m\right) \cdot t\_m}{l\_m}}{l\_m} \cdot \left(\sin k\_m \cdot \tan k\_m\right)\right) \cdot \left(\left(1 + \frac{k\_m \cdot k\_m}{t\_m \cdot t\_m}\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{{\left(k\_m \cdot t\_m\right)}^{2} \cdot 2}{t\_2} \cdot \frac{t\_m}{l\_m}}\\
\end{array}
\end{array}
\end{array}
if t < 1.2199999999999999e-101Initial program 41.9%
Taylor expanded in t around 0
Applied rewrites71.7%
Applied rewrites72.2%
Applied rewrites82.3%
Taylor expanded in k around 0
Applied rewrites50.3%
if 1.2199999999999999e-101 < t < 9.2e64Initial program 65.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-*.f6465.9
Applied rewrites65.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-tan.f64N/A
associate-*l*N/A
pow2N/A
lower-*.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-tan.f6473.7
Applied rewrites73.7%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6473.7
Applied rewrites73.7%
if 9.2e64 < t Initial program 68.8%
Taylor expanded in t around 0
Applied rewrites79.2%
Applied rewrites81.2%
Applied rewrites87.7%
Taylor expanded in k around 0
Applied rewrites87.4%
Final simplification60.7%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= t_m 1.6e-105)
(/
2.0
(*
(/
(*
(fma
(fma (* t_m t_m) -0.6666666666666666 1.0)
(* k_m k_m)
(* (* t_m t_m) 2.0))
(* k_m k_m))
(* (cos k_m) l_m))
(/ t_m l_m)))
(if (<= t_m 6.5e+86)
(/ 2.0 (* (* (* (/ k_m l_m) (/ (pow t_m 3.0) l_m)) (tan k_m)) 2.0))
(/ 2.0 (* (* (/ (pow (* k_m t_m) 2.0) l_m) 2.0) (/ t_m l_m)))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (t_m <= 1.6e-105) {
tmp = 2.0 / (((fma(fma((t_m * t_m), -0.6666666666666666, 1.0), (k_m * k_m), ((t_m * t_m) * 2.0)) * (k_m * k_m)) / (cos(k_m) * l_m)) * (t_m / l_m));
} else if (t_m <= 6.5e+86) {
tmp = 2.0 / ((((k_m / l_m) * (pow(t_m, 3.0) / l_m)) * tan(k_m)) * 2.0);
} else {
tmp = 2.0 / (((pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (t_m <= 1.6e-105) tmp = Float64(2.0 / Float64(Float64(Float64(fma(fma(Float64(t_m * t_m), -0.6666666666666666, 1.0), Float64(k_m * k_m), Float64(Float64(t_m * t_m) * 2.0)) * Float64(k_m * k_m)) / Float64(cos(k_m) * l_m)) * Float64(t_m / l_m))); elseif (t_m <= 6.5e+86) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k_m / l_m) * Float64((t_m ^ 3.0) / l_m)) * tan(k_m)) * 2.0)); else tmp = Float64(2.0 / Float64(Float64(Float64((Float64(k_m * t_m) ^ 2.0) / l_m) * 2.0) * Float64(t_m / l_m))); end return Float64(t_s * tmp) end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 1.6e-105], N[(2.0 / N[(N[(N[(N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * -0.6666666666666666 + 1.0), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision] + N[(N[(t$95$m * t$95$m), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[k$95$m], $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 6.5e+86], N[(2.0 / N[(N[(N[(N[(k$95$m / l$95$m), $MachinePrecision] * N[(N[Power[t$95$m, 3.0], $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision] * N[Tan[k$95$m], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] / l$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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 1.6 \cdot 10^{-105}:\\
\;\;\;\;\frac{2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(t\_m \cdot t\_m, -0.6666666666666666, 1\right), k\_m \cdot k\_m, \left(t\_m \cdot t\_m\right) \cdot 2\right) \cdot \left(k\_m \cdot k\_m\right)}{\cos k\_m \cdot l\_m} \cdot \frac{t\_m}{l\_m}}\\
\mathbf{elif}\;t\_m \leq 6.5 \cdot 10^{+86}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{k\_m}{l\_m} \cdot \frac{{t\_m}^{3}}{l\_m}\right) \cdot \tan k\_m\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{{\left(k\_m \cdot t\_m\right)}^{2}}{l\_m} \cdot 2\right) \cdot \frac{t\_m}{l\_m}}\\
\end{array}
\end{array}
if t < 1.59999999999999991e-105Initial program 41.9%
Taylor expanded in t around 0
Applied rewrites71.7%
Applied rewrites72.2%
Applied rewrites82.3%
Taylor expanded in k around 0
Applied rewrites50.3%
if 1.59999999999999991e-105 < t < 6.49999999999999996e86Initial program 61.2%
Taylor expanded in t around inf
Applied rewrites43.8%
Taylor expanded in k around 0
Applied rewrites44.2%
Applied rewrites63.6%
if 6.49999999999999996e86 < t Initial program 73.1%
Taylor expanded in t around 0
Applied rewrites84.4%
Applied rewrites86.4%
Applied rewrites91.2%
Taylor expanded in k around 0
Applied rewrites91.2%
Final simplification59.6%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= t_m 2.1e-27)
(/
2.0
(*
(/
(*
(fma
(fma (* t_m t_m) -0.6666666666666666 1.0)
(* k_m k_m)
(* (* t_m t_m) 2.0))
(* k_m k_m))
(* (cos k_m) l_m))
(/ t_m l_m)))
(/ 2.0 (* (* (/ (pow (* k_m t_m) 2.0) l_m) 2.0) (/ t_m l_m))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (t_m <= 2.1e-27) {
tmp = 2.0 / (((fma(fma((t_m * t_m), -0.6666666666666666, 1.0), (k_m * k_m), ((t_m * t_m) * 2.0)) * (k_m * k_m)) / (cos(k_m) * l_m)) * (t_m / l_m));
} else {
tmp = 2.0 / (((pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (t_m <= 2.1e-27) tmp = Float64(2.0 / Float64(Float64(Float64(fma(fma(Float64(t_m * t_m), -0.6666666666666666, 1.0), Float64(k_m * k_m), Float64(Float64(t_m * t_m) * 2.0)) * Float64(k_m * k_m)) / Float64(cos(k_m) * l_m)) * Float64(t_m / l_m))); else tmp = Float64(2.0 / Float64(Float64(Float64((Float64(k_m * t_m) ^ 2.0) / l_m) * 2.0) * Float64(t_m / l_m))); end return Float64(t_s * tmp) end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 2.1e-27], N[(2.0 / N[(N[(N[(N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * -0.6666666666666666 + 1.0), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision] + N[(N[(t$95$m * t$95$m), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[k$95$m], $MachinePrecision] * l$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] / l$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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 2.1 \cdot 10^{-27}:\\
\;\;\;\;\frac{2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(t\_m \cdot t\_m, -0.6666666666666666, 1\right), k\_m \cdot k\_m, \left(t\_m \cdot t\_m\right) \cdot 2\right) \cdot \left(k\_m \cdot k\_m\right)}{\cos k\_m \cdot l\_m} \cdot \frac{t\_m}{l\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{{\left(k\_m \cdot t\_m\right)}^{2}}{l\_m} \cdot 2\right) \cdot \frac{t\_m}{l\_m}}\\
\end{array}
\end{array}
if t < 2.10000000000000015e-27Initial program 43.1%
Taylor expanded in t around 0
Applied rewrites70.8%
Applied rewrites71.3%
Applied rewrites81.0%
Taylor expanded in k around 0
Applied rewrites50.8%
if 2.10000000000000015e-27 < t Initial program 71.4%
Taylor expanded in t around 0
Applied rewrites77.8%
Applied rewrites78.8%
Applied rewrites85.5%
Taylor expanded in k around 0
Applied rewrites82.6%
Final simplification59.0%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= t_m 1.18e-105)
(/ 2.0 (* (* (* (/ (/ t_m l_m) l_m) (* k_m k_m)) k_m) k_m))
(if (<= t_m 1.26e-18)
(/
2.0
(*
(* (* k_m k_m) (/ (/ (pow t_m 3.0) l_m) l_m))
(+ (+ 1.0 (/ (* k_m k_m) (* t_m t_m))) 1.0)))
(/ 2.0 (* (* (/ (pow (* k_m t_m) 2.0) l_m) 2.0) (/ t_m l_m)))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (t_m <= 1.18e-105) {
tmp = 2.0 / (((((t_m / l_m) / l_m) * (k_m * k_m)) * k_m) * k_m);
} else if (t_m <= 1.26e-18) {
tmp = 2.0 / (((k_m * k_m) * ((pow(t_m, 3.0) / l_m) / l_m)) * ((1.0 + ((k_m * k_m) / (t_m * t_m))) + 1.0));
} else {
tmp = 2.0 / (((pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: tmp
if (t_m <= 1.18d-105) then
tmp = 2.0d0 / (((((t_m / l_m) / l_m) * (k_m * k_m)) * k_m) * k_m)
else if (t_m <= 1.26d-18) then
tmp = 2.0d0 / (((k_m * k_m) * (((t_m ** 3.0d0) / l_m) / l_m)) * ((1.0d0 + ((k_m * k_m) / (t_m * t_m))) + 1.0d0))
else
tmp = 2.0d0 / (((((k_m * t_m) ** 2.0d0) / l_m) * 2.0d0) * (t_m / l_m))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double tmp;
if (t_m <= 1.18e-105) {
tmp = 2.0 / (((((t_m / l_m) / l_m) * (k_m * k_m)) * k_m) * k_m);
} else if (t_m <= 1.26e-18) {
tmp = 2.0 / (((k_m * k_m) * ((Math.pow(t_m, 3.0) / l_m) / l_m)) * ((1.0 + ((k_m * k_m) / (t_m * t_m))) + 1.0));
} else {
tmp = 2.0 / (((Math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): tmp = 0 if t_m <= 1.18e-105: tmp = 2.0 / (((((t_m / l_m) / l_m) * (k_m * k_m)) * k_m) * k_m) elif t_m <= 1.26e-18: tmp = 2.0 / (((k_m * k_m) * ((math.pow(t_m, 3.0) / l_m) / l_m)) * ((1.0 + ((k_m * k_m) / (t_m * t_m))) + 1.0)) else: tmp = 2.0 / (((math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m)) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (t_m <= 1.18e-105) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(t_m / l_m) / l_m) * Float64(k_m * k_m)) * k_m) * k_m)); elseif (t_m <= 1.26e-18) tmp = Float64(2.0 / Float64(Float64(Float64(k_m * k_m) * Float64(Float64((t_m ^ 3.0) / l_m) / l_m)) * Float64(Float64(1.0 + Float64(Float64(k_m * k_m) / Float64(t_m * t_m))) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64((Float64(k_m * t_m) ^ 2.0) / l_m) * 2.0) * Float64(t_m / l_m))); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) tmp = 0.0; if (t_m <= 1.18e-105) tmp = 2.0 / (((((t_m / l_m) / l_m) * (k_m * k_m)) * k_m) * k_m); elseif (t_m <= 1.26e-18) tmp = 2.0 / (((k_m * k_m) * (((t_m ^ 3.0) / l_m) / l_m)) * ((1.0 + ((k_m * k_m) / (t_m * t_m))) + 1.0)); else tmp = 2.0 / (((((k_m * t_m) ^ 2.0) / l_m) * 2.0) * (t_m / l_m)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 1.18e-105], N[(2.0 / N[(N[(N[(N[(N[(t$95$m / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] * k$95$m), $MachinePrecision] * k$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$m, 1.26e-18], N[(2.0 / N[(N[(N[(k$95$m * k$95$m), $MachinePrecision] * N[(N[(N[Power[t$95$m, 3.0], $MachinePrecision] / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(k$95$m * k$95$m), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] / l$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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 1.18 \cdot 10^{-105}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\frac{t\_m}{l\_m}}{l\_m} \cdot \left(k\_m \cdot k\_m\right)\right) \cdot k\_m\right) \cdot k\_m}\\
\mathbf{elif}\;t\_m \leq 1.26 \cdot 10^{-18}:\\
\;\;\;\;\frac{2}{\left(\left(k\_m \cdot k\_m\right) \cdot \frac{\frac{{t\_m}^{3}}{l\_m}}{l\_m}\right) \cdot \left(\left(1 + \frac{k\_m \cdot k\_m}{t\_m \cdot t\_m}\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{{\left(k\_m \cdot t\_m\right)}^{2}}{l\_m} \cdot 2\right) \cdot \frac{t\_m}{l\_m}}\\
\end{array}
\end{array}
if t < 1.1799999999999999e-105Initial program 41.9%
Taylor expanded in t around 0
Applied rewrites71.7%
Taylor expanded in k around 0
Applied rewrites31.0%
Taylor expanded in t around 0
Applied rewrites48.5%
Applied rewrites52.1%
if 1.1799999999999999e-105 < t < 1.26000000000000004e-18Initial program 55.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-*.f6455.8
Applied rewrites55.8%
Taylor expanded in k around 0
Applied rewrites60.4%
if 1.26000000000000004e-18 < t Initial program 71.6%
Taylor expanded in t around 0
Applied rewrites79.4%
Applied rewrites80.8%
Applied rewrites85.9%
Taylor expanded in k around 0
Applied rewrites82.9%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= t_m 4.5e-30)
(/ 2.0 (* (* k_m (* k_m (/ (/ t_m l_m) l_m))) (* k_m k_m)))
(/ 2.0 (* (* (/ (pow (* k_m t_m) 2.0) l_m) 2.0) (/ t_m l_m))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (t_m <= 4.5e-30) {
tmp = 2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m));
} else {
tmp = 2.0 / (((pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: tmp
if (t_m <= 4.5d-30) then
tmp = 2.0d0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m))
else
tmp = 2.0d0 / (((((k_m * t_m) ** 2.0d0) / l_m) * 2.0d0) * (t_m / l_m))
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double tmp;
if (t_m <= 4.5e-30) {
tmp = 2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m));
} else {
tmp = 2.0 / (((Math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m));
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): tmp = 0 if t_m <= 4.5e-30: tmp = 2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m)) else: tmp = 2.0 / (((math.pow((k_m * t_m), 2.0) / l_m) * 2.0) * (t_m / l_m)) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (t_m <= 4.5e-30) tmp = Float64(2.0 / Float64(Float64(k_m * Float64(k_m * Float64(Float64(t_m / l_m) / l_m))) * Float64(k_m * k_m))); else tmp = Float64(2.0 / Float64(Float64(Float64((Float64(k_m * t_m) ^ 2.0) / l_m) * 2.0) * Float64(t_m / l_m))); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) tmp = 0.0; if (t_m <= 4.5e-30) tmp = 2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m)); else tmp = 2.0 / (((((k_m * t_m) ^ 2.0) / l_m) * 2.0) * (t_m / l_m)); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 4.5e-30], N[(2.0 / N[(N[(k$95$m * N[(k$95$m * N[(N[(t$95$m / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] / l$95$m), $MachinePrecision] * 2.0), $MachinePrecision] * N[(t$95$m / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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 4.5 \cdot 10^{-30}:\\
\;\;\;\;\frac{2}{\left(k\_m \cdot \left(k\_m \cdot \frac{\frac{t\_m}{l\_m}}{l\_m}\right)\right) \cdot \left(k\_m \cdot k\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\frac{{\left(k\_m \cdot t\_m\right)}^{2}}{l\_m} \cdot 2\right) \cdot \frac{t\_m}{l\_m}}\\
\end{array}
\end{array}
if t < 4.49999999999999967e-30Initial program 43.1%
Taylor expanded in t around 0
Applied rewrites70.8%
Taylor expanded in k around 0
Applied rewrites32.3%
Taylor expanded in t around 0
Applied rewrites47.8%
Applied rewrites51.0%
if 4.49999999999999967e-30 < t Initial program 71.4%
Taylor expanded in t around 0
Applied rewrites77.8%
Applied rewrites78.8%
Applied rewrites85.5%
Taylor expanded in k around 0
Applied rewrites82.6%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(*
t_s
(if (<= t_m 5e+20)
(/ 2.0 (* (* k_m (* k_m (/ (/ t_m l_m) l_m))) (* k_m k_m)))
(/ (* l_m l_m) (* (pow (* k_m t_m) 2.0) t_m)))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double tmp;
if (t_m <= 5e+20) {
tmp = 2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m));
} else {
tmp = (l_m * l_m) / (pow((k_m * t_m), 2.0) * t_m);
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: tmp
if (t_m <= 5d+20) then
tmp = 2.0d0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m))
else
tmp = (l_m * l_m) / (((k_m * t_m) ** 2.0d0) * t_m)
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double tmp;
if (t_m <= 5e+20) {
tmp = 2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m));
} else {
tmp = (l_m * l_m) / (Math.pow((k_m * t_m), 2.0) * t_m);
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): tmp = 0 if t_m <= 5e+20: tmp = 2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m)) else: tmp = (l_m * l_m) / (math.pow((k_m * t_m), 2.0) * t_m) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) tmp = 0.0 if (t_m <= 5e+20) tmp = Float64(2.0 / Float64(Float64(k_m * Float64(k_m * Float64(Float64(t_m / l_m) / l_m))) * Float64(k_m * k_m))); else tmp = Float64(Float64(l_m * l_m) / Float64((Float64(k_m * t_m) ^ 2.0) * t_m)); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) tmp = 0.0; if (t_m <= 5e+20) tmp = 2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m)); else tmp = (l_m * l_m) / (((k_m * t_m) ^ 2.0) * t_m); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 5e+20], N[(2.0 / N[(N[(k$95$m * N[(k$95$m * N[(N[(t$95$m / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(N[Power[N[(k$95$m * t$95$m), $MachinePrecision], 2.0], $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\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 5 \cdot 10^{+20}:\\
\;\;\;\;\frac{2}{\left(k\_m \cdot \left(k\_m \cdot \frac{\frac{t\_m}{l\_m}}{l\_m}\right)\right) \cdot \left(k\_m \cdot k\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{l\_m \cdot l\_m}{{\left(k\_m \cdot t\_m\right)}^{2} \cdot t\_m}\\
\end{array}
\end{array}
if t < 5e20Initial program 44.3%
Taylor expanded in t around 0
Applied rewrites70.1%
Taylor expanded in k around 0
Applied rewrites33.1%
Taylor expanded in t around 0
Applied rewrites47.3%
Applied rewrites50.4%
if 5e20 < t Initial program 72.8%
Taylor expanded in k around 0
Applied rewrites61.9%
Applied rewrites61.9%
Applied rewrites83.8%
l_m = (fabs.f64 l)
k_m = (fabs.f64 k)
t\_m = (fabs.f64 t)
t\_s = (copysign.f64 #s(literal 1 binary64) t)
(FPCore (t_s t_m l_m k_m)
:precision binary64
(let* ((t_2 (/ (/ t_m l_m) l_m)))
(*
t_s
(if (<= t_m 9.8e-26)
(/ 2.0 (* (* k_m (* k_m t_2)) (* k_m k_m)))
(/ 2.0 (* (* (* (* t_m t_2) 2.0) (* k_m k_m)) t_m))))))l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
double t_2 = (t_m / l_m) / l_m;
double tmp;
if (t_m <= 9.8e-26) {
tmp = 2.0 / ((k_m * (k_m * t_2)) * (k_m * k_m));
} else {
tmp = 2.0 / ((((t_m * t_2) * 2.0) * (k_m * k_m)) * t_m);
}
return t_s * tmp;
}
l_m = private
k_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_m)
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_m
real(8) :: t_2
real(8) :: tmp
t_2 = (t_m / l_m) / l_m
if (t_m <= 9.8d-26) then
tmp = 2.0d0 / ((k_m * (k_m * t_2)) * (k_m * k_m))
else
tmp = 2.0d0 / ((((t_m * t_2) * 2.0d0) * (k_m * k_m)) * t_m)
end if
code = t_s * tmp
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
double t_2 = (t_m / l_m) / l_m;
double tmp;
if (t_m <= 9.8e-26) {
tmp = 2.0 / ((k_m * (k_m * t_2)) * (k_m * k_m));
} else {
tmp = 2.0 / ((((t_m * t_2) * 2.0) * (k_m * k_m)) * t_m);
}
return t_s * tmp;
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): t_2 = (t_m / l_m) / l_m tmp = 0 if t_m <= 9.8e-26: tmp = 2.0 / ((k_m * (k_m * t_2)) * (k_m * k_m)) else: tmp = 2.0 / ((((t_m * t_2) * 2.0) * (k_m * k_m)) * t_m) return t_s * tmp
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) t_2 = Float64(Float64(t_m / l_m) / l_m) tmp = 0.0 if (t_m <= 9.8e-26) tmp = Float64(2.0 / Float64(Float64(k_m * Float64(k_m * t_2)) * Float64(k_m * k_m))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(t_m * t_2) * 2.0) * Float64(k_m * k_m)) * t_m)); end return Float64(t_s * tmp) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp_2 = code(t_s, t_m, l_m, k_m) t_2 = (t_m / l_m) / l_m; tmp = 0.0; if (t_m <= 9.8e-26) tmp = 2.0 / ((k_m * (k_m * t_2)) * (k_m * k_m)); else tmp = 2.0 / ((((t_m * t_2) * 2.0) * (k_m * k_m)) * t_m); end tmp_2 = t_s * tmp; end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := Block[{t$95$2 = N[(N[(t$95$m / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision]}, N[(t$95$s * If[LessEqual[t$95$m, 9.8e-26], N[(2.0 / N[(N[(k$95$m * N[(k$95$m * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(t$95$m * t$95$2), $MachinePrecision] * 2.0), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision] * t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
\begin{array}{l}
t_2 := \frac{\frac{t\_m}{l\_m}}{l\_m}\\
t\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_m \leq 9.8 \cdot 10^{-26}:\\
\;\;\;\;\frac{2}{\left(k\_m \cdot \left(k\_m \cdot t\_2\right)\right) \cdot \left(k\_m \cdot k\_m\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\left(t\_m \cdot t\_2\right) \cdot 2\right) \cdot \left(k\_m \cdot k\_m\right)\right) \cdot t\_m}\\
\end{array}
\end{array}
\end{array}
if t < 9.7999999999999998e-26Initial program 43.2%
Taylor expanded in t around 0
Applied rewrites70.6%
Taylor expanded in k around 0
Applied rewrites32.5%
Taylor expanded in t around 0
Applied rewrites47.9%
Applied rewrites51.1%
if 9.7999999999999998e-26 < t Initial program 72.0%
Taylor expanded in t around 0
Applied rewrites78.6%
Taylor expanded in k around 0
Applied rewrites14.5%
Taylor expanded in k around 0
Applied rewrites69.6%
l_m = (fabs.f64 l) k_m = (fabs.f64 k) t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l_m k_m) :precision binary64 (* t_s (/ 2.0 (* (* k_m (* k_m (/ (/ t_m l_m) l_m))) (* k_m k_m)))))
l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
return t_s * (2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m)));
}
l_m = private
k_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_m)
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_m
code = t_s * (2.0d0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m)))
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
return t_s * (2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m)));
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): return t_s * (2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m)))
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) return Float64(t_s * Float64(2.0 / Float64(Float64(k_m * Float64(k_m * Float64(Float64(t_m / l_m) / l_m))) * Float64(k_m * k_m)))) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l_m, k_m) tmp = t_s * (2.0 / ((k_m * (k_m * ((t_m / l_m) / l_m))) * (k_m * k_m))); end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * N[(2.0 / N[(N[(k$95$m * N[(k$95$m * N[(N[(t$95$m / l$95$m), $MachinePrecision] / l$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(k$95$m * k$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l_m = \left|\ell\right|
\\
k_m = \left|k\right|
\\
t\_m = \left|t\right|
\\
t\_s = \mathsf{copysign}\left(1, t\right)
\\
t\_s \cdot \frac{2}{\left(k\_m \cdot \left(k\_m \cdot \frac{\frac{t\_m}{l\_m}}{l\_m}\right)\right) \cdot \left(k\_m \cdot k\_m\right)}
\end{array}
Initial program 50.4%
Taylor expanded in t around 0
Applied rewrites72.6%
Taylor expanded in k around 0
Applied rewrites28.0%
Taylor expanded in t around 0
Applied rewrites50.6%
Applied rewrites53.0%
l_m = (fabs.f64 l) k_m = (fabs.f64 k) t\_m = (fabs.f64 t) t\_s = (copysign.f64 #s(literal 1 binary64) t) (FPCore (t_s t_m l_m k_m) :precision binary64 (* t_s (/ (* l_m l_m) (* (* k_m k_m) (* (* t_m t_m) t_m)))))
l_m = fabs(l);
k_m = fabs(k);
t\_m = fabs(t);
t\_s = copysign(1.0, t);
double code(double t_s, double t_m, double l_m, double k_m) {
return t_s * ((l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m)));
}
l_m = private
k_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_m)
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_m
code = t_s * ((l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m)))
end function
l_m = Math.abs(l);
k_m = Math.abs(k);
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_m) {
return t_s * ((l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m)));
}
l_m = math.fabs(l) k_m = math.fabs(k) t\_m = math.fabs(t) t\_s = math.copysign(1.0, t) def code(t_s, t_m, l_m, k_m): return t_s * ((l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m)))
l_m = abs(l) k_m = abs(k) t\_m = abs(t) t\_s = copysign(1.0, t) function code(t_s, t_m, l_m, k_m) return Float64(t_s * Float64(Float64(l_m * l_m) / Float64(Float64(k_m * k_m) * Float64(Float64(t_m * t_m) * t_m)))) end
l_m = abs(l); k_m = abs(k); t\_m = abs(t); t\_s = sign(t) * abs(1.0); function tmp = code(t_s, t_m, l_m, k_m) tmp = t_s * ((l_m * l_m) / ((k_m * k_m) * ((t_m * t_m) * t_m))); end
l_m = N[Abs[l], $MachinePrecision]
k_m = N[Abs[k], $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$95$m_] := N[(t$95$s * N[(N[(l$95$m * l$95$m), $MachinePrecision] / N[(N[(k$95$m * k$95$m), $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|
\\
k_m = \left|k\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\_m \cdot k\_m\right) \cdot \left(\left(t\_m \cdot t\_m\right) \cdot t\_m\right)}
\end{array}
Initial program 50.4%
Taylor expanded in k around 0
Applied rewrites42.4%
Applied rewrites42.4%
herbie shell --seed 2025025
(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))))