
(FPCore (t l k) :precision binary64 (/ 2 (* (* (* (/ (pow t 3) (* l l)) (sin k)) (tan k)) (+ (+ 1 (pow (/ k t) 2)) 1))))
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 / N[(N[(N[(N[(N[Power[t, 3], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1 + N[Power[N[(k / t), $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision] + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\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)}
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (t l k) :precision binary64 (/ 2 (* (* (* (/ (pow t 3) (* l l)) (sin k)) (tan k)) (+ (+ 1 (pow (/ k t) 2)) 1))))
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 / N[(N[(N[(N[(N[Power[t, 3], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1 + N[Power[N[(k / t), $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision] + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\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)}
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (* (sin k) (fabs t)) l))
(t_2 (* (fabs t) (fabs t)))
(t_3 (pow (sin k) 2))
(t_4 (/ (fabs t) l)))
(*
(copysign 1 t)
(if (<=
(fabs t)
4495317912455029/12486994201263968925526388919172665222994392570659884603436627838501486955279062480481224412253967884639307724485626491581791902717153141225160704)
(*
(/
(* l l)
(*
(fabs t)
(+
(* 2 (/ (* (pow (fabs t) 2) t_3) (cos k)))
(/ (* (pow k 2) t_3) (cos k)))))
2)
(if (<= (fabs t) 5902958103587057/590295810358705651712)
(/
2
(*
t_1
(* (* t_4 (fabs t)) (* (- (* (/ k t_2) k) -2) (tan k)))))
(if (<=
(fabs t)
102000000000000002010628671640657454961172628716945651504250908899455859726500368768078250896781213696)
(/
2
(/
(*
(/ (* t_2 (* (fabs t) (sin k))) l)
(* (sin k) (- (/ (* k k) t_2) -2)))
(* l (cos k))))
(/ 2 (* (* (* (tan k) t_4) (* t_1 (fabs t))) 2))))))))double code(double t, double l, double k) {
double t_1 = (sin(k) * fabs(t)) / l;
double t_2 = fabs(t) * fabs(t);
double t_3 = pow(sin(k), 2.0);
double t_4 = fabs(t) / l;
double tmp;
if (fabs(t) <= 3.6e-130) {
tmp = ((l * l) / (fabs(t) * ((2.0 * ((pow(fabs(t), 2.0) * t_3) / cos(k))) + ((pow(k, 2.0) * t_3) / cos(k))))) * 2.0;
} else if (fabs(t) <= 1e-5) {
tmp = 2.0 / (t_1 * ((t_4 * fabs(t)) * ((((k / t_2) * k) - -2.0) * tan(k))));
} else if (fabs(t) <= 1.02e+101) {
tmp = 2.0 / ((((t_2 * (fabs(t) * sin(k))) / l) * (sin(k) * (((k * k) / t_2) - -2.0))) / (l * cos(k)));
} else {
tmp = 2.0 / (((tan(k) * t_4) * (t_1 * fabs(t))) * 2.0);
}
return copysign(1.0, t) * tmp;
}
public static double code(double t, double l, double k) {
double t_1 = (Math.sin(k) * Math.abs(t)) / l;
double t_2 = Math.abs(t) * Math.abs(t);
double t_3 = Math.pow(Math.sin(k), 2.0);
double t_4 = Math.abs(t) / l;
double tmp;
if (Math.abs(t) <= 3.6e-130) {
tmp = ((l * l) / (Math.abs(t) * ((2.0 * ((Math.pow(Math.abs(t), 2.0) * t_3) / Math.cos(k))) + ((Math.pow(k, 2.0) * t_3) / Math.cos(k))))) * 2.0;
} else if (Math.abs(t) <= 1e-5) {
tmp = 2.0 / (t_1 * ((t_4 * Math.abs(t)) * ((((k / t_2) * k) - -2.0) * Math.tan(k))));
} else if (Math.abs(t) <= 1.02e+101) {
tmp = 2.0 / ((((t_2 * (Math.abs(t) * Math.sin(k))) / l) * (Math.sin(k) * (((k * k) / t_2) - -2.0))) / (l * Math.cos(k)));
} else {
tmp = 2.0 / (((Math.tan(k) * t_4) * (t_1 * Math.abs(t))) * 2.0);
}
return Math.copySign(1.0, t) * tmp;
}
def code(t, l, k): t_1 = (math.sin(k) * math.fabs(t)) / l t_2 = math.fabs(t) * math.fabs(t) t_3 = math.pow(math.sin(k), 2.0) t_4 = math.fabs(t) / l tmp = 0 if math.fabs(t) <= 3.6e-130: tmp = ((l * l) / (math.fabs(t) * ((2.0 * ((math.pow(math.fabs(t), 2.0) * t_3) / math.cos(k))) + ((math.pow(k, 2.0) * t_3) / math.cos(k))))) * 2.0 elif math.fabs(t) <= 1e-5: tmp = 2.0 / (t_1 * ((t_4 * math.fabs(t)) * ((((k / t_2) * k) - -2.0) * math.tan(k)))) elif math.fabs(t) <= 1.02e+101: tmp = 2.0 / ((((t_2 * (math.fabs(t) * math.sin(k))) / l) * (math.sin(k) * (((k * k) / t_2) - -2.0))) / (l * math.cos(k))) else: tmp = 2.0 / (((math.tan(k) * t_4) * (t_1 * math.fabs(t))) * 2.0) return math.copysign(1.0, t) * tmp
function code(t, l, k) t_1 = Float64(Float64(sin(k) * abs(t)) / l) t_2 = Float64(abs(t) * abs(t)) t_3 = sin(k) ^ 2.0 t_4 = Float64(abs(t) / l) tmp = 0.0 if (abs(t) <= 3.6e-130) tmp = Float64(Float64(Float64(l * l) / Float64(abs(t) * Float64(Float64(2.0 * Float64(Float64((abs(t) ^ 2.0) * t_3) / cos(k))) + Float64(Float64((k ^ 2.0) * t_3) / cos(k))))) * 2.0); elseif (abs(t) <= 1e-5) tmp = Float64(2.0 / Float64(t_1 * Float64(Float64(t_4 * abs(t)) * Float64(Float64(Float64(Float64(k / t_2) * k) - -2.0) * tan(k))))); elseif (abs(t) <= 1.02e+101) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(t_2 * Float64(abs(t) * sin(k))) / l) * Float64(sin(k) * Float64(Float64(Float64(k * k) / t_2) - -2.0))) / Float64(l * cos(k)))); else tmp = Float64(2.0 / Float64(Float64(Float64(tan(k) * t_4) * Float64(t_1 * abs(t))) * 2.0)); end return Float64(copysign(1.0, t) * tmp) end
function tmp_2 = code(t, l, k) t_1 = (sin(k) * abs(t)) / l; t_2 = abs(t) * abs(t); t_3 = sin(k) ^ 2.0; t_4 = abs(t) / l; tmp = 0.0; if (abs(t) <= 3.6e-130) tmp = ((l * l) / (abs(t) * ((2.0 * (((abs(t) ^ 2.0) * t_3) / cos(k))) + (((k ^ 2.0) * t_3) / cos(k))))) * 2.0; elseif (abs(t) <= 1e-5) tmp = 2.0 / (t_1 * ((t_4 * abs(t)) * ((((k / t_2) * k) - -2.0) * tan(k)))); elseif (abs(t) <= 1.02e+101) tmp = 2.0 / ((((t_2 * (abs(t) * sin(k))) / l) * (sin(k) * (((k * k) / t_2) - -2.0))) / (l * cos(k))); else tmp = 2.0 / (((tan(k) * t_4) * (t_1 * abs(t))) * 2.0); end tmp_2 = (sign(t) * abs(1.0)) * tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(N[Sin[k], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[t], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[k], $MachinePrecision], 2], $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[t], $MachinePrecision] / l), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[t], $MachinePrecision], 4495317912455029/12486994201263968925526388919172665222994392570659884603436627838501486955279062480481224412253967884639307724485626491581791902717153141225160704], N[(N[(N[(l * l), $MachinePrecision] / N[(N[Abs[t], $MachinePrecision] * N[(N[(2 * N[(N[(N[Power[N[Abs[t], $MachinePrecision], 2], $MachinePrecision] * t$95$3), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[k, 2], $MachinePrecision] * t$95$3), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 5902958103587057/590295810358705651712], N[(2 / N[(t$95$1 * N[(N[(t$95$4 * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(k / t$95$2), $MachinePrecision] * k), $MachinePrecision] - -2), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 102000000000000002010628671640657454961172628716945651504250908899455859726500368768078250896781213696], N[(2 / N[(N[(N[(N[(t$95$2 * N[(N[Abs[t], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[Sin[k], $MachinePrecision] * N[(N[(N[(k * k), $MachinePrecision] / t$95$2), $MachinePrecision] - -2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2 / N[(N[(N[(N[Tan[k], $MachinePrecision] * t$95$4), $MachinePrecision] * N[(t$95$1 * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{\sin k \cdot \left|t\right|}{\ell}\\
t_2 := \left|t\right| \cdot \left|t\right|\\
t_3 := {\sin k}^{2}\\
t_4 := \frac{\left|t\right|}{\ell}\\
\mathsf{copysign}\left(1, t\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|t\right| \leq \frac{4495317912455029}{12486994201263968925526388919172665222994392570659884603436627838501486955279062480481224412253967884639307724485626491581791902717153141225160704}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\left|t\right| \cdot \left(2 \cdot \frac{{\left(\left|t\right|\right)}^{2} \cdot t\_3}{\cos k} + \frac{{k}^{2} \cdot t\_3}{\cos k}\right)} \cdot 2\\
\mathbf{elif}\;\left|t\right| \leq \frac{5902958103587057}{590295810358705651712}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \left(\left(t\_4 \cdot \left|t\right|\right) \cdot \left(\left(\frac{k}{t\_2} \cdot k - -2\right) \cdot \tan k\right)\right)}\\
\mathbf{elif}\;\left|t\right| \leq 102000000000000002010628671640657454961172628716945651504250908899455859726500368768078250896781213696:\\
\;\;\;\;\frac{2}{\frac{\frac{t\_2 \cdot \left(\left|t\right| \cdot \sin k\right)}{\ell} \cdot \left(\sin k \cdot \left(\frac{k \cdot k}{t\_2} - -2\right)\right)}{\ell \cdot \cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\tan k \cdot t\_4\right) \cdot \left(t\_1 \cdot \left|t\right|\right)\right) \cdot 2}\\
\end{array}
\end{array}
if t < 3.6000000000000001e-130Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
Taylor expanded in t around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-cos.f64N/A
lower-/.f64N/A
Applied rewrites66.4%
if 3.6000000000000001e-130 < t < 1.0000000000000001e-5Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
mult-flipN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6474.5%
Applied rewrites74.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
unpow2N/A
lift-pow.f64N/A
Applied rewrites68.7%
if 1.0000000000000001e-5 < t < 1.02e101Initial program 55.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-/r*N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites50.6%
if 1.02e101 < t Initial program 55.1%
Taylor expanded in t around inf
Applied rewrites54.8%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
frac-timesN/A
frac-2negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lift-*.f64N/A
frac-timesN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
Applied rewrites57.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
Applied rewrites70.6%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (fabs t) l))
(t_2 (* (fabs t) (fabs t)))
(t_3 (/ (* (sin k) (fabs t)) l)))
(*
(copysign 1 t)
(if (<=
(fabs t)
4495317912455029/12486994201263968925526388919172665222994392570659884603436627838501486955279062480481224412253967884639307724485626491581791902717153141225160704)
(*
(/
(* l l)
(/ (* (pow k 2) (* (fabs t) (pow (sin k) 2))) (cos k)))
2)
(if (<= (fabs t) 5902958103587057/590295810358705651712)
(/
2
(*
t_3
(* (* t_1 (fabs t)) (* (- (* (/ k t_2) k) -2) (tan k)))))
(if (<=
(fabs t)
102000000000000002010628671640657454961172628716945651504250908899455859726500368768078250896781213696)
(/
2
(/
(*
(/ (* t_2 (* (fabs t) (sin k))) l)
(* (sin k) (- (/ (* k k) t_2) -2)))
(* l (cos k))))
(/ 2 (* (* (* (tan k) t_1) (* t_3 (fabs t))) 2))))))))double code(double t, double l, double k) {
double t_1 = fabs(t) / l;
double t_2 = fabs(t) * fabs(t);
double t_3 = (sin(k) * fabs(t)) / l;
double tmp;
if (fabs(t) <= 3.6e-130) {
tmp = ((l * l) / ((pow(k, 2.0) * (fabs(t) * pow(sin(k), 2.0))) / cos(k))) * 2.0;
} else if (fabs(t) <= 1e-5) {
tmp = 2.0 / (t_3 * ((t_1 * fabs(t)) * ((((k / t_2) * k) - -2.0) * tan(k))));
} else if (fabs(t) <= 1.02e+101) {
tmp = 2.0 / ((((t_2 * (fabs(t) * sin(k))) / l) * (sin(k) * (((k * k) / t_2) - -2.0))) / (l * cos(k)));
} else {
tmp = 2.0 / (((tan(k) * t_1) * (t_3 * fabs(t))) * 2.0);
}
return copysign(1.0, t) * tmp;
}
public static double code(double t, double l, double k) {
double t_1 = Math.abs(t) / l;
double t_2 = Math.abs(t) * Math.abs(t);
double t_3 = (Math.sin(k) * Math.abs(t)) / l;
double tmp;
if (Math.abs(t) <= 3.6e-130) {
tmp = ((l * l) / ((Math.pow(k, 2.0) * (Math.abs(t) * Math.pow(Math.sin(k), 2.0))) / Math.cos(k))) * 2.0;
} else if (Math.abs(t) <= 1e-5) {
tmp = 2.0 / (t_3 * ((t_1 * Math.abs(t)) * ((((k / t_2) * k) - -2.0) * Math.tan(k))));
} else if (Math.abs(t) <= 1.02e+101) {
tmp = 2.0 / ((((t_2 * (Math.abs(t) * Math.sin(k))) / l) * (Math.sin(k) * (((k * k) / t_2) - -2.0))) / (l * Math.cos(k)));
} else {
tmp = 2.0 / (((Math.tan(k) * t_1) * (t_3 * Math.abs(t))) * 2.0);
}
return Math.copySign(1.0, t) * tmp;
}
def code(t, l, k): t_1 = math.fabs(t) / l t_2 = math.fabs(t) * math.fabs(t) t_3 = (math.sin(k) * math.fabs(t)) / l tmp = 0 if math.fabs(t) <= 3.6e-130: tmp = ((l * l) / ((math.pow(k, 2.0) * (math.fabs(t) * math.pow(math.sin(k), 2.0))) / math.cos(k))) * 2.0 elif math.fabs(t) <= 1e-5: tmp = 2.0 / (t_3 * ((t_1 * math.fabs(t)) * ((((k / t_2) * k) - -2.0) * math.tan(k)))) elif math.fabs(t) <= 1.02e+101: tmp = 2.0 / ((((t_2 * (math.fabs(t) * math.sin(k))) / l) * (math.sin(k) * (((k * k) / t_2) - -2.0))) / (l * math.cos(k))) else: tmp = 2.0 / (((math.tan(k) * t_1) * (t_3 * math.fabs(t))) * 2.0) return math.copysign(1.0, t) * tmp
function code(t, l, k) t_1 = Float64(abs(t) / l) t_2 = Float64(abs(t) * abs(t)) t_3 = Float64(Float64(sin(k) * abs(t)) / l) tmp = 0.0 if (abs(t) <= 3.6e-130) tmp = Float64(Float64(Float64(l * l) / Float64(Float64((k ^ 2.0) * Float64(abs(t) * (sin(k) ^ 2.0))) / cos(k))) * 2.0); elseif (abs(t) <= 1e-5) tmp = Float64(2.0 / Float64(t_3 * Float64(Float64(t_1 * abs(t)) * Float64(Float64(Float64(Float64(k / t_2) * k) - -2.0) * tan(k))))); elseif (abs(t) <= 1.02e+101) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(t_2 * Float64(abs(t) * sin(k))) / l) * Float64(sin(k) * Float64(Float64(Float64(k * k) / t_2) - -2.0))) / Float64(l * cos(k)))); else tmp = Float64(2.0 / Float64(Float64(Float64(tan(k) * t_1) * Float64(t_3 * abs(t))) * 2.0)); end return Float64(copysign(1.0, t) * tmp) end
function tmp_2 = code(t, l, k) t_1 = abs(t) / l; t_2 = abs(t) * abs(t); t_3 = (sin(k) * abs(t)) / l; tmp = 0.0; if (abs(t) <= 3.6e-130) tmp = ((l * l) / (((k ^ 2.0) * (abs(t) * (sin(k) ^ 2.0))) / cos(k))) * 2.0; elseif (abs(t) <= 1e-5) tmp = 2.0 / (t_3 * ((t_1 * abs(t)) * ((((k / t_2) * k) - -2.0) * tan(k)))); elseif (abs(t) <= 1.02e+101) tmp = 2.0 / ((((t_2 * (abs(t) * sin(k))) / l) * (sin(k) * (((k * k) / t_2) - -2.0))) / (l * cos(k))); else tmp = 2.0 / (((tan(k) * t_1) * (t_3 * abs(t))) * 2.0); end tmp_2 = (sign(t) * abs(1.0)) * tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Abs[t], $MachinePrecision] / l), $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[t], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sin[k], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[t], $MachinePrecision], 4495317912455029/12486994201263968925526388919172665222994392570659884603436627838501486955279062480481224412253967884639307724485626491581791902717153141225160704], N[(N[(N[(l * l), $MachinePrecision] / N[(N[(N[Power[k, 2], $MachinePrecision] * N[(N[Abs[t], $MachinePrecision] * N[Power[N[Sin[k], $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 5902958103587057/590295810358705651712], N[(2 / N[(t$95$3 * N[(N[(t$95$1 * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(k / t$95$2), $MachinePrecision] * k), $MachinePrecision] - -2), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 102000000000000002010628671640657454961172628716945651504250908899455859726500368768078250896781213696], N[(2 / N[(N[(N[(N[(t$95$2 * N[(N[Abs[t], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[Sin[k], $MachinePrecision] * N[(N[(N[(k * k), $MachinePrecision] / t$95$2), $MachinePrecision] - -2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2 / N[(N[(N[(N[Tan[k], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(t$95$3 * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{\left|t\right|}{\ell}\\
t_2 := \left|t\right| \cdot \left|t\right|\\
t_3 := \frac{\sin k \cdot \left|t\right|}{\ell}\\
\mathsf{copysign}\left(1, t\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|t\right| \leq \frac{4495317912455029}{12486994201263968925526388919172665222994392570659884603436627838501486955279062480481224412253967884639307724485626491581791902717153141225160704}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\frac{{k}^{2} \cdot \left(\left|t\right| \cdot {\sin k}^{2}\right)}{\cos k}} \cdot 2\\
\mathbf{elif}\;\left|t\right| \leq \frac{5902958103587057}{590295810358705651712}:\\
\;\;\;\;\frac{2}{t\_3 \cdot \left(\left(t\_1 \cdot \left|t\right|\right) \cdot \left(\left(\frac{k}{t\_2} \cdot k - -2\right) \cdot \tan k\right)\right)}\\
\mathbf{elif}\;\left|t\right| \leq 102000000000000002010628671640657454961172628716945651504250908899455859726500368768078250896781213696:\\
\;\;\;\;\frac{2}{\frac{\frac{t\_2 \cdot \left(\left|t\right| \cdot \sin k\right)}{\ell} \cdot \left(\sin k \cdot \left(\frac{k \cdot k}{t\_2} - -2\right)\right)}{\ell \cdot \cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\tan k \cdot t\_1\right) \cdot \left(t\_3 \cdot \left|t\right|\right)\right) \cdot 2}\\
\end{array}
\end{array}
if t < 3.6000000000000001e-130Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-cos.f6459.2%
Applied rewrites59.2%
if 3.6000000000000001e-130 < t < 1.0000000000000001e-5Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
mult-flipN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6474.5%
Applied rewrites74.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
unpow2N/A
lift-pow.f64N/A
Applied rewrites68.7%
if 1.0000000000000001e-5 < t < 1.02e101Initial program 55.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-/r*N/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites50.6%
if 1.02e101 < t Initial program 55.1%
Taylor expanded in t around inf
Applied rewrites54.8%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
frac-timesN/A
frac-2negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lift-*.f64N/A
frac-timesN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
Applied rewrites57.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
Applied rewrites70.6%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (* (sin (fabs k)) t) l)) (t_2 (tan (fabs k))))
(if (<= (fabs k) 4704172149284445/2475880078570760549798248448)
(/ 2 (* (* (* t_2 (/ t l)) (* t_1 t)) 2))
(/
2
(*
t_1
(*
(* (/ t l) t)
(* (- (* (/ (fabs k) (* t t)) (fabs k)) -2) t_2)))))))double code(double t, double l, double k) {
double t_1 = (sin(fabs(k)) * t) / l;
double t_2 = tan(fabs(k));
double tmp;
if (fabs(k) <= 1.9e-12) {
tmp = 2.0 / (((t_2 * (t / l)) * (t_1 * t)) * 2.0);
} else {
tmp = 2.0 / (t_1 * (((t / l) * t) * ((((fabs(k) / (t * t)) * fabs(k)) - -2.0) * t_2)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (sin(abs(k)) * t) / l
t_2 = tan(abs(k))
if (abs(k) <= 1.9d-12) then
tmp = 2.0d0 / (((t_2 * (t / l)) * (t_1 * t)) * 2.0d0)
else
tmp = 2.0d0 / (t_1 * (((t / l) * t) * ((((abs(k) / (t * t)) * abs(k)) - (-2.0d0)) * t_2)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = (Math.sin(Math.abs(k)) * t) / l;
double t_2 = Math.tan(Math.abs(k));
double tmp;
if (Math.abs(k) <= 1.9e-12) {
tmp = 2.0 / (((t_2 * (t / l)) * (t_1 * t)) * 2.0);
} else {
tmp = 2.0 / (t_1 * (((t / l) * t) * ((((Math.abs(k) / (t * t)) * Math.abs(k)) - -2.0) * t_2)));
}
return tmp;
}
def code(t, l, k): t_1 = (math.sin(math.fabs(k)) * t) / l t_2 = math.tan(math.fabs(k)) tmp = 0 if math.fabs(k) <= 1.9e-12: tmp = 2.0 / (((t_2 * (t / l)) * (t_1 * t)) * 2.0) else: tmp = 2.0 / (t_1 * (((t / l) * t) * ((((math.fabs(k) / (t * t)) * math.fabs(k)) - -2.0) * t_2))) return tmp
function code(t, l, k) t_1 = Float64(Float64(sin(abs(k)) * t) / l) t_2 = tan(abs(k)) tmp = 0.0 if (abs(k) <= 1.9e-12) tmp = Float64(2.0 / Float64(Float64(Float64(t_2 * Float64(t / l)) * Float64(t_1 * t)) * 2.0)); else tmp = Float64(2.0 / Float64(t_1 * Float64(Float64(Float64(t / l) * t) * Float64(Float64(Float64(Float64(abs(k) / Float64(t * t)) * abs(k)) - -2.0) * t_2)))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = (sin(abs(k)) * t) / l; t_2 = tan(abs(k)); tmp = 0.0; if (abs(k) <= 1.9e-12) tmp = 2.0 / (((t_2 * (t / l)) * (t_1 * t)) * 2.0); else tmp = 2.0 / (t_1 * (((t / l) * t) * ((((abs(k) / (t * t)) * abs(k)) - -2.0) * t_2))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(N[Sin[N[Abs[k], $MachinePrecision]], $MachinePrecision] * t), $MachinePrecision] / l), $MachinePrecision]}, Block[{t$95$2 = N[Tan[N[Abs[k], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 4704172149284445/2475880078570760549798248448], N[(2 / N[(N[(N[(t$95$2 * N[(t / l), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision], N[(2 / N[(t$95$1 * N[(N[(N[(t / l), $MachinePrecision] * t), $MachinePrecision] * N[(N[(N[(N[(N[Abs[k], $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision] - -2), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{\sin \left(\left|k\right|\right) \cdot t}{\ell}\\
t_2 := \tan \left(\left|k\right|\right)\\
\mathbf{if}\;\left|k\right| \leq \frac{4704172149284445}{2475880078570760549798248448}:\\
\;\;\;\;\frac{2}{\left(\left(t\_2 \cdot \frac{t}{\ell}\right) \cdot \left(t\_1 \cdot t\right)\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \left(\left(\frac{t}{\ell} \cdot t\right) \cdot \left(\left(\frac{\left|k\right|}{t \cdot t} \cdot \left|k\right| - -2\right) \cdot t\_2\right)\right)}\\
\end{array}
if k < 1.9e-12Initial program 55.1%
Taylor expanded in t around inf
Applied rewrites54.8%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
frac-timesN/A
frac-2negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lift-*.f64N/A
frac-timesN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
Applied rewrites57.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
Applied rewrites70.6%
if 1.9e-12 < k Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
mult-flipN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6474.5%
Applied rewrites74.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
unpow2N/A
lift-pow.f64N/A
Applied rewrites68.7%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (sin (fabs k)) t))
(t_2 (tan (fabs k)))
(t_3 (* (- (* (/ (fabs k) (* t t)) (fabs k)) -2) t_2)))
(if (<= (fabs k) 4000000000000000)
(/ 2 (* (* (* t_2 (/ t l)) (* (/ t_1 l) t)) 2))
(if (<=
(fabs k)
2450000000000000003809422588439219235392891374242316420580707544617560446523970637754472568887578728787168513894952296647753728)
(* (* (/ l (* t t)) (/ l (* t_3 t_1))) 2)
(/ 2 (* (/ t l) (* (* (/ (* (fabs k) t) l) t) t_3)))))))double code(double t, double l, double k) {
double t_1 = sin(fabs(k)) * t;
double t_2 = tan(fabs(k));
double t_3 = (((fabs(k) / (t * t)) * fabs(k)) - -2.0) * t_2;
double tmp;
if (fabs(k) <= 4e+15) {
tmp = 2.0 / (((t_2 * (t / l)) * ((t_1 / l) * t)) * 2.0);
} else if (fabs(k) <= 2.45e+126) {
tmp = ((l / (t * t)) * (l / (t_3 * t_1))) * 2.0;
} else {
tmp = 2.0 / ((t / l) * ((((fabs(k) * t) / l) * t) * t_3));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sin(abs(k)) * t
t_2 = tan(abs(k))
t_3 = (((abs(k) / (t * t)) * abs(k)) - (-2.0d0)) * t_2
if (abs(k) <= 4d+15) then
tmp = 2.0d0 / (((t_2 * (t / l)) * ((t_1 / l) * t)) * 2.0d0)
else if (abs(k) <= 2.45d+126) then
tmp = ((l / (t * t)) * (l / (t_3 * t_1))) * 2.0d0
else
tmp = 2.0d0 / ((t / l) * ((((abs(k) * t) / l) * t) * t_3))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.sin(Math.abs(k)) * t;
double t_2 = Math.tan(Math.abs(k));
double t_3 = (((Math.abs(k) / (t * t)) * Math.abs(k)) - -2.0) * t_2;
double tmp;
if (Math.abs(k) <= 4e+15) {
tmp = 2.0 / (((t_2 * (t / l)) * ((t_1 / l) * t)) * 2.0);
} else if (Math.abs(k) <= 2.45e+126) {
tmp = ((l / (t * t)) * (l / (t_3 * t_1))) * 2.0;
} else {
tmp = 2.0 / ((t / l) * ((((Math.abs(k) * t) / l) * t) * t_3));
}
return tmp;
}
def code(t, l, k): t_1 = math.sin(math.fabs(k)) * t t_2 = math.tan(math.fabs(k)) t_3 = (((math.fabs(k) / (t * t)) * math.fabs(k)) - -2.0) * t_2 tmp = 0 if math.fabs(k) <= 4e+15: tmp = 2.0 / (((t_2 * (t / l)) * ((t_1 / l) * t)) * 2.0) elif math.fabs(k) <= 2.45e+126: tmp = ((l / (t * t)) * (l / (t_3 * t_1))) * 2.0 else: tmp = 2.0 / ((t / l) * ((((math.fabs(k) * t) / l) * t) * t_3)) return tmp
function code(t, l, k) t_1 = Float64(sin(abs(k)) * t) t_2 = tan(abs(k)) t_3 = Float64(Float64(Float64(Float64(abs(k) / Float64(t * t)) * abs(k)) - -2.0) * t_2) tmp = 0.0 if (abs(k) <= 4e+15) tmp = Float64(2.0 / Float64(Float64(Float64(t_2 * Float64(t / l)) * Float64(Float64(t_1 / l) * t)) * 2.0)); elseif (abs(k) <= 2.45e+126) tmp = Float64(Float64(Float64(l / Float64(t * t)) * Float64(l / Float64(t_3 * t_1))) * 2.0); else tmp = Float64(2.0 / Float64(Float64(t / l) * Float64(Float64(Float64(Float64(abs(k) * t) / l) * t) * t_3))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = sin(abs(k)) * t; t_2 = tan(abs(k)); t_3 = (((abs(k) / (t * t)) * abs(k)) - -2.0) * t_2; tmp = 0.0; if (abs(k) <= 4e+15) tmp = 2.0 / (((t_2 * (t / l)) * ((t_1 / l) * t)) * 2.0); elseif (abs(k) <= 2.45e+126) tmp = ((l / (t * t)) * (l / (t_3 * t_1))) * 2.0; else tmp = 2.0 / ((t / l) * ((((abs(k) * t) / l) * t) * t_3)); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Sin[N[Abs[k], $MachinePrecision]], $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[Tan[N[Abs[k], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[Abs[k], $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision] - -2), $MachinePrecision] * t$95$2), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 4000000000000000], N[(2 / N[(N[(N[(t$95$2 * N[(t / l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[k], $MachinePrecision], 2450000000000000003809422588439219235392891374242316420580707544617560446523970637754472568887578728787168513894952296647753728], N[(N[(N[(l / N[(t * t), $MachinePrecision]), $MachinePrecision] * N[(l / N[(t$95$3 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision], N[(2 / N[(N[(t / l), $MachinePrecision] * N[(N[(N[(N[(N[Abs[k], $MachinePrecision] * t), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \sin \left(\left|k\right|\right) \cdot t\\
t_2 := \tan \left(\left|k\right|\right)\\
t_3 := \left(\frac{\left|k\right|}{t \cdot t} \cdot \left|k\right| - -2\right) \cdot t\_2\\
\mathbf{if}\;\left|k\right| \leq 4000000000000000:\\
\;\;\;\;\frac{2}{\left(\left(t\_2 \cdot \frac{t}{\ell}\right) \cdot \left(\frac{t\_1}{\ell} \cdot t\right)\right) \cdot 2}\\
\mathbf{elif}\;\left|k\right| \leq 2450000000000000003809422588439219235392891374242316420580707544617560446523970637754472568887578728787168513894952296647753728:\\
\;\;\;\;\left(\frac{\ell}{t \cdot t} \cdot \frac{\ell}{t\_3 \cdot t\_1}\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t}{\ell} \cdot \left(\left(\frac{\left|k\right| \cdot t}{\ell} \cdot t\right) \cdot t\_3\right)}\\
\end{array}
if k < 4e15Initial program 55.1%
Taylor expanded in t around inf
Applied rewrites54.8%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
frac-timesN/A
frac-2negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lift-*.f64N/A
frac-timesN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
Applied rewrites57.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
Applied rewrites70.6%
if 4e15 < k < 2.45e126Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6451.6%
Applied rewrites57.7%
if 2.45e126 < k Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites64.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (fabs t) (fabs t)))
(t_2 (/ (fabs t) l))
(t_3 (* k (fabs t)))
(t_4 (/ t_3 l)))
(*
(copysign 1 t)
(if (<=
(fabs t)
2022342995529785/297403381695556612559612499629980112026252040331878891811154371863188131432080874709033662899231270117959744758038594610090917049108981141558166116220478925156594168089491974788537281966859547374047839156470287441213549741375576017631419788069731616602409021090828782564753069762936832)
(*
(/
(* l l)
(*
(* (* (* k (+ 1 (* -1/6 (pow k 2)))) (fabs t)) (fabs t))
(fabs t)))
(/ 2 (+ k k)))
(if (<= (fabs t) 4999999999999999727876154935214080)
(/
2
(*
(* (* (* t_2 (fabs t)) t_4) (tan k))
(+ (+ 1 (/ (* (/ k (fabs t)) k) (fabs t))) 1)))
(if (<=
(fabs t)
3999999999999999869344675216466765095398132743226221891671847117885183383686911450434959473821876224)
(* (/ l (* t_3 t_1)) (* (/ l (+ k k)) 2))
(/
2
(*
t_2
(*
(* t_4 (fabs t))
(* (- (* (/ k t_1) k) -2) (tan k)))))))))))double code(double t, double l, double k) {
double t_1 = fabs(t) * fabs(t);
double t_2 = fabs(t) / l;
double t_3 = k * fabs(t);
double t_4 = t_3 / l;
double tmp;
if (fabs(t) <= 6.8e-270) {
tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * pow(k, 2.0)))) * fabs(t)) * fabs(t)) * fabs(t))) * (2.0 / (k + k));
} else if (fabs(t) <= 5e+33) {
tmp = 2.0 / ((((t_2 * fabs(t)) * t_4) * tan(k)) * ((1.0 + (((k / fabs(t)) * k) / fabs(t))) + 1.0));
} else if (fabs(t) <= 4e+99) {
tmp = (l / (t_3 * t_1)) * ((l / (k + k)) * 2.0);
} else {
tmp = 2.0 / (t_2 * ((t_4 * fabs(t)) * ((((k / t_1) * k) - -2.0) * tan(k))));
}
return copysign(1.0, t) * tmp;
}
public static double code(double t, double l, double k) {
double t_1 = Math.abs(t) * Math.abs(t);
double t_2 = Math.abs(t) / l;
double t_3 = k * Math.abs(t);
double t_4 = t_3 / l;
double tmp;
if (Math.abs(t) <= 6.8e-270) {
tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * Math.pow(k, 2.0)))) * Math.abs(t)) * Math.abs(t)) * Math.abs(t))) * (2.0 / (k + k));
} else if (Math.abs(t) <= 5e+33) {
tmp = 2.0 / ((((t_2 * Math.abs(t)) * t_4) * Math.tan(k)) * ((1.0 + (((k / Math.abs(t)) * k) / Math.abs(t))) + 1.0));
} else if (Math.abs(t) <= 4e+99) {
tmp = (l / (t_3 * t_1)) * ((l / (k + k)) * 2.0);
} else {
tmp = 2.0 / (t_2 * ((t_4 * Math.abs(t)) * ((((k / t_1) * k) - -2.0) * Math.tan(k))));
}
return Math.copySign(1.0, t) * tmp;
}
def code(t, l, k): t_1 = math.fabs(t) * math.fabs(t) t_2 = math.fabs(t) / l t_3 = k * math.fabs(t) t_4 = t_3 / l tmp = 0 if math.fabs(t) <= 6.8e-270: tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * math.pow(k, 2.0)))) * math.fabs(t)) * math.fabs(t)) * math.fabs(t))) * (2.0 / (k + k)) elif math.fabs(t) <= 5e+33: tmp = 2.0 / ((((t_2 * math.fabs(t)) * t_4) * math.tan(k)) * ((1.0 + (((k / math.fabs(t)) * k) / math.fabs(t))) + 1.0)) elif math.fabs(t) <= 4e+99: tmp = (l / (t_3 * t_1)) * ((l / (k + k)) * 2.0) else: tmp = 2.0 / (t_2 * ((t_4 * math.fabs(t)) * ((((k / t_1) * k) - -2.0) * math.tan(k)))) return math.copysign(1.0, t) * tmp
function code(t, l, k) t_1 = Float64(abs(t) * abs(t)) t_2 = Float64(abs(t) / l) t_3 = Float64(k * abs(t)) t_4 = Float64(t_3 / l) tmp = 0.0 if (abs(t) <= 6.8e-270) tmp = Float64(Float64(Float64(l * l) / Float64(Float64(Float64(Float64(k * Float64(1.0 + Float64(-0.16666666666666666 * (k ^ 2.0)))) * abs(t)) * abs(t)) * abs(t))) * Float64(2.0 / Float64(k + k))); elseif (abs(t) <= 5e+33) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(t_2 * abs(t)) * t_4) * tan(k)) * Float64(Float64(1.0 + Float64(Float64(Float64(k / abs(t)) * k) / abs(t))) + 1.0))); elseif (abs(t) <= 4e+99) tmp = Float64(Float64(l / Float64(t_3 * t_1)) * Float64(Float64(l / Float64(k + k)) * 2.0)); else tmp = Float64(2.0 / Float64(t_2 * Float64(Float64(t_4 * abs(t)) * Float64(Float64(Float64(Float64(k / t_1) * k) - -2.0) * tan(k))))); end return Float64(copysign(1.0, t) * tmp) end
function tmp_2 = code(t, l, k) t_1 = abs(t) * abs(t); t_2 = abs(t) / l; t_3 = k * abs(t); t_4 = t_3 / l; tmp = 0.0; if (abs(t) <= 6.8e-270) tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * (k ^ 2.0)))) * abs(t)) * abs(t)) * abs(t))) * (2.0 / (k + k)); elseif (abs(t) <= 5e+33) tmp = 2.0 / ((((t_2 * abs(t)) * t_4) * tan(k)) * ((1.0 + (((k / abs(t)) * k) / abs(t))) + 1.0)); elseif (abs(t) <= 4e+99) tmp = (l / (t_3 * t_1)) * ((l / (k + k)) * 2.0); else tmp = 2.0 / (t_2 * ((t_4 * abs(t)) * ((((k / t_1) * k) - -2.0) * tan(k)))); end tmp_2 = (sign(t) * abs(1.0)) * tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Abs[t], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[t], $MachinePrecision] / l), $MachinePrecision]}, Block[{t$95$3 = N[(k * N[Abs[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 / l), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[t], $MachinePrecision], 2022342995529785/297403381695556612559612499629980112026252040331878891811154371863188131432080874709033662899231270117959744758038594610090917049108981141558166116220478925156594168089491974788537281966859547374047839156470287441213549741375576017631419788069731616602409021090828782564753069762936832], N[(N[(N[(l * l), $MachinePrecision] / N[(N[(N[(N[(k * N[(1 + N[(-1/6 * N[Power[k, 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2 / N[(k + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 4999999999999999727876154935214080], N[(2 / N[(N[(N[(N[(t$95$2 * N[Abs[t], $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1 + N[(N[(N[(k / N[Abs[t], $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] / N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 3999999999999999869344675216466765095398132743226221891671847117885183383686911450434959473821876224], N[(N[(l / N[(t$95$3 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[(l / N[(k + k), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision], N[(2 / N[(t$95$2 * N[(N[(t$95$4 * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(k / t$95$1), $MachinePrecision] * k), $MachinePrecision] - -2), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \left|t\right| \cdot \left|t\right|\\
t_2 := \frac{\left|t\right|}{\ell}\\
t_3 := k \cdot \left|t\right|\\
t_4 := \frac{t\_3}{\ell}\\
\mathsf{copysign}\left(1, t\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|t\right| \leq \frac{2022342995529785}{297403381695556612559612499629980112026252040331878891811154371863188131432080874709033662899231270117959744758038594610090917049108981141558166116220478925156594168089491974788537281966859547374047839156470287441213549741375576017631419788069731616602409021090828782564753069762936832}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\left(\left(\left(k \cdot \left(1 + \frac{-1}{6} \cdot {k}^{2}\right)\right) \cdot \left|t\right|\right) \cdot \left|t\right|\right) \cdot \left|t\right|} \cdot \frac{2}{k + k}\\
\mathbf{elif}\;\left|t\right| \leq 4999999999999999727876154935214080:\\
\;\;\;\;\frac{2}{\left(\left(\left(t\_2 \cdot \left|t\right|\right) \cdot t\_4\right) \cdot \tan k\right) \cdot \left(\left(1 + \frac{\frac{k}{\left|t\right|} \cdot k}{\left|t\right|}\right) + 1\right)}\\
\mathbf{elif}\;\left|t\right| \leq 3999999999999999869344675216466765095398132743226221891671847117885183383686911450434959473821876224:\\
\;\;\;\;\frac{\ell}{t\_3 \cdot t\_1} \cdot \left(\frac{\ell}{k + k} \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_2 \cdot \left(\left(t\_4 \cdot \left|t\right|\right) \cdot \left(\left(\frac{k}{t\_1} \cdot k - -2\right) \cdot \tan k\right)\right)}\\
\end{array}
\end{array}
if t < 6.8000000000000001e-270Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites56.4%
Taylor expanded in k around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6462.2%
Applied rewrites62.2%
if 6.8000000000000001e-270 < t < 4.9999999999999997e33Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
associate-/l*N/A
lift-*.f64N/A
lower-/.f6468.6%
Applied rewrites68.6%
if 4.9999999999999997e33 < t < 3.9999999999999999e99Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.2%
if 3.9999999999999999e99 < t Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites64.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (tan (fabs k))))
(if (<=
(fabs k)
19600000000000000374956579330606504855576818647416687785348925165027140076453871189112209616714959517606064769747386368)
(/ 2 (* (* (* t_1 (/ t l)) (* (/ (* (sin (fabs k)) t) l) t)) 2))
(/
2
(*
(/ t l)
(*
(* (/ (* (fabs k) t) l) t)
(* (- (* (/ (fabs k) (* t t)) (fabs k)) -2) t_1)))))))double code(double t, double l, double k) {
double t_1 = tan(fabs(k));
double tmp;
if (fabs(k) <= 1.96e+118) {
tmp = 2.0 / (((t_1 * (t / l)) * (((sin(fabs(k)) * t) / l) * t)) * 2.0);
} else {
tmp = 2.0 / ((t / l) * ((((fabs(k) * t) / l) * t) * ((((fabs(k) / (t * t)) * fabs(k)) - -2.0) * t_1)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = tan(abs(k))
if (abs(k) <= 1.96d+118) then
tmp = 2.0d0 / (((t_1 * (t / l)) * (((sin(abs(k)) * t) / l) * t)) * 2.0d0)
else
tmp = 2.0d0 / ((t / l) * ((((abs(k) * t) / l) * t) * ((((abs(k) / (t * t)) * abs(k)) - (-2.0d0)) * t_1)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.tan(Math.abs(k));
double tmp;
if (Math.abs(k) <= 1.96e+118) {
tmp = 2.0 / (((t_1 * (t / l)) * (((Math.sin(Math.abs(k)) * t) / l) * t)) * 2.0);
} else {
tmp = 2.0 / ((t / l) * ((((Math.abs(k) * t) / l) * t) * ((((Math.abs(k) / (t * t)) * Math.abs(k)) - -2.0) * t_1)));
}
return tmp;
}
def code(t, l, k): t_1 = math.tan(math.fabs(k)) tmp = 0 if math.fabs(k) <= 1.96e+118: tmp = 2.0 / (((t_1 * (t / l)) * (((math.sin(math.fabs(k)) * t) / l) * t)) * 2.0) else: tmp = 2.0 / ((t / l) * ((((math.fabs(k) * t) / l) * t) * ((((math.fabs(k) / (t * t)) * math.fabs(k)) - -2.0) * t_1))) return tmp
function code(t, l, k) t_1 = tan(abs(k)) tmp = 0.0 if (abs(k) <= 1.96e+118) tmp = Float64(2.0 / Float64(Float64(Float64(t_1 * Float64(t / l)) * Float64(Float64(Float64(sin(abs(k)) * t) / l) * t)) * 2.0)); else tmp = Float64(2.0 / Float64(Float64(t / l) * Float64(Float64(Float64(Float64(abs(k) * t) / l) * t) * Float64(Float64(Float64(Float64(abs(k) / Float64(t * t)) * abs(k)) - -2.0) * t_1)))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = tan(abs(k)); tmp = 0.0; if (abs(k) <= 1.96e+118) tmp = 2.0 / (((t_1 * (t / l)) * (((sin(abs(k)) * t) / l) * t)) * 2.0); else tmp = 2.0 / ((t / l) * ((((abs(k) * t) / l) * t) * ((((abs(k) / (t * t)) * abs(k)) - -2.0) * t_1))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[Tan[N[Abs[k], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 19600000000000000374956579330606504855576818647416687785348925165027140076453871189112209616714959517606064769747386368], N[(2 / N[(N[(N[(t$95$1 * N[(t / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Sin[N[Abs[k], $MachinePrecision]], $MachinePrecision] * t), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision], N[(2 / N[(N[(t / l), $MachinePrecision] * N[(N[(N[(N[(N[Abs[k], $MachinePrecision] * t), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision] * N[(N[(N[(N[(N[Abs[k], $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision] - -2), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \tan \left(\left|k\right|\right)\\
\mathbf{if}\;\left|k\right| \leq 19600000000000000374956579330606504855576818647416687785348925165027140076453871189112209616714959517606064769747386368:\\
\;\;\;\;\frac{2}{\left(\left(t\_1 \cdot \frac{t}{\ell}\right) \cdot \left(\frac{\sin \left(\left|k\right|\right) \cdot t}{\ell} \cdot t\right)\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t}{\ell} \cdot \left(\left(\frac{\left|k\right| \cdot t}{\ell} \cdot t\right) \cdot \left(\left(\frac{\left|k\right|}{t \cdot t} \cdot \left|k\right| - -2\right) \cdot t\_1\right)\right)}\\
\end{array}
if k < 1.96e118Initial program 55.1%
Taylor expanded in t around inf
Applied rewrites54.8%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
frac-timesN/A
frac-2negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lift-*.f64N/A
frac-timesN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
Applied rewrites57.2%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
Applied rewrites70.6%
if 1.96e118 < k Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites64.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* k (fabs t)))
(t_2 (/ t_1 l))
(t_3 (/ (fabs t) l))
(t_4 (* (fabs t) (fabs t)))
(t_5 (* (- (* (/ k t_4) k) -2) (tan k))))
(*
(copysign 1 t)
(if (<=
(fabs t)
3455165794209175/7198262071269114212496861612297570974191515389283066612961208916178940129074380592510465097766225371439873457013633432197133225688790879502413624289384262168215552)
(*
(/
(* l l)
(*
(* (* (* k (+ 1 (* -1/6 (pow k 2)))) (fabs t)) (fabs t))
(fabs t)))
(/ 2 (+ k k)))
(if (<= (fabs t) 4999999999999999727876154935214080)
(/ 2 (* t_2 (* (* t_3 (fabs t)) t_5)))
(if (<=
(fabs t)
3999999999999999869344675216466765095398132743226221891671847117885183383686911450434959473821876224)
(* (/ l (* t_1 t_4)) (* (/ l (+ k k)) 2))
(/ 2 (* t_3 (* (* t_2 (fabs t)) t_5)))))))))double code(double t, double l, double k) {
double t_1 = k * fabs(t);
double t_2 = t_1 / l;
double t_3 = fabs(t) / l;
double t_4 = fabs(t) * fabs(t);
double t_5 = (((k / t_4) * k) - -2.0) * tan(k);
double tmp;
if (fabs(t) <= 4.8e-148) {
tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * pow(k, 2.0)))) * fabs(t)) * fabs(t)) * fabs(t))) * (2.0 / (k + k));
} else if (fabs(t) <= 5e+33) {
tmp = 2.0 / (t_2 * ((t_3 * fabs(t)) * t_5));
} else if (fabs(t) <= 4e+99) {
tmp = (l / (t_1 * t_4)) * ((l / (k + k)) * 2.0);
} else {
tmp = 2.0 / (t_3 * ((t_2 * fabs(t)) * t_5));
}
return copysign(1.0, t) * tmp;
}
public static double code(double t, double l, double k) {
double t_1 = k * Math.abs(t);
double t_2 = t_1 / l;
double t_3 = Math.abs(t) / l;
double t_4 = Math.abs(t) * Math.abs(t);
double t_5 = (((k / t_4) * k) - -2.0) * Math.tan(k);
double tmp;
if (Math.abs(t) <= 4.8e-148) {
tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * Math.pow(k, 2.0)))) * Math.abs(t)) * Math.abs(t)) * Math.abs(t))) * (2.0 / (k + k));
} else if (Math.abs(t) <= 5e+33) {
tmp = 2.0 / (t_2 * ((t_3 * Math.abs(t)) * t_5));
} else if (Math.abs(t) <= 4e+99) {
tmp = (l / (t_1 * t_4)) * ((l / (k + k)) * 2.0);
} else {
tmp = 2.0 / (t_3 * ((t_2 * Math.abs(t)) * t_5));
}
return Math.copySign(1.0, t) * tmp;
}
def code(t, l, k): t_1 = k * math.fabs(t) t_2 = t_1 / l t_3 = math.fabs(t) / l t_4 = math.fabs(t) * math.fabs(t) t_5 = (((k / t_4) * k) - -2.0) * math.tan(k) tmp = 0 if math.fabs(t) <= 4.8e-148: tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * math.pow(k, 2.0)))) * math.fabs(t)) * math.fabs(t)) * math.fabs(t))) * (2.0 / (k + k)) elif math.fabs(t) <= 5e+33: tmp = 2.0 / (t_2 * ((t_3 * math.fabs(t)) * t_5)) elif math.fabs(t) <= 4e+99: tmp = (l / (t_1 * t_4)) * ((l / (k + k)) * 2.0) else: tmp = 2.0 / (t_3 * ((t_2 * math.fabs(t)) * t_5)) return math.copysign(1.0, t) * tmp
function code(t, l, k) t_1 = Float64(k * abs(t)) t_2 = Float64(t_1 / l) t_3 = Float64(abs(t) / l) t_4 = Float64(abs(t) * abs(t)) t_5 = Float64(Float64(Float64(Float64(k / t_4) * k) - -2.0) * tan(k)) tmp = 0.0 if (abs(t) <= 4.8e-148) tmp = Float64(Float64(Float64(l * l) / Float64(Float64(Float64(Float64(k * Float64(1.0 + Float64(-0.16666666666666666 * (k ^ 2.0)))) * abs(t)) * abs(t)) * abs(t))) * Float64(2.0 / Float64(k + k))); elseif (abs(t) <= 5e+33) tmp = Float64(2.0 / Float64(t_2 * Float64(Float64(t_3 * abs(t)) * t_5))); elseif (abs(t) <= 4e+99) tmp = Float64(Float64(l / Float64(t_1 * t_4)) * Float64(Float64(l / Float64(k + k)) * 2.0)); else tmp = Float64(2.0 / Float64(t_3 * Float64(Float64(t_2 * abs(t)) * t_5))); end return Float64(copysign(1.0, t) * tmp) end
function tmp_2 = code(t, l, k) t_1 = k * abs(t); t_2 = t_1 / l; t_3 = abs(t) / l; t_4 = abs(t) * abs(t); t_5 = (((k / t_4) * k) - -2.0) * tan(k); tmp = 0.0; if (abs(t) <= 4.8e-148) tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * (k ^ 2.0)))) * abs(t)) * abs(t)) * abs(t))) * (2.0 / (k + k)); elseif (abs(t) <= 5e+33) tmp = 2.0 / (t_2 * ((t_3 * abs(t)) * t_5)); elseif (abs(t) <= 4e+99) tmp = (l / (t_1 * t_4)) * ((l / (k + k)) * 2.0); else tmp = 2.0 / (t_3 * ((t_2 * abs(t)) * t_5)); end tmp_2 = (sign(t) * abs(1.0)) * tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(k * N[Abs[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / l), $MachinePrecision]}, Block[{t$95$3 = N[(N[Abs[t], $MachinePrecision] / l), $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[t], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[(N[(k / t$95$4), $MachinePrecision] * k), $MachinePrecision] - -2), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[t], $MachinePrecision], 3455165794209175/7198262071269114212496861612297570974191515389283066612961208916178940129074380592510465097766225371439873457013633432197133225688790879502413624289384262168215552], N[(N[(N[(l * l), $MachinePrecision] / N[(N[(N[(N[(k * N[(1 + N[(-1/6 * N[Power[k, 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2 / N[(k + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 4999999999999999727876154935214080], N[(2 / N[(t$95$2 * N[(N[(t$95$3 * N[Abs[t], $MachinePrecision]), $MachinePrecision] * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 3999999999999999869344675216466765095398132743226221891671847117885183383686911450434959473821876224], N[(N[(l / N[(t$95$1 * t$95$4), $MachinePrecision]), $MachinePrecision] * N[(N[(l / N[(k + k), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision], N[(2 / N[(t$95$3 * N[(N[(t$95$2 * N[Abs[t], $MachinePrecision]), $MachinePrecision] * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := k \cdot \left|t\right|\\
t_2 := \frac{t\_1}{\ell}\\
t_3 := \frac{\left|t\right|}{\ell}\\
t_4 := \left|t\right| \cdot \left|t\right|\\
t_5 := \left(\frac{k}{t\_4} \cdot k - -2\right) \cdot \tan k\\
\mathsf{copysign}\left(1, t\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|t\right| \leq \frac{3455165794209175}{7198262071269114212496861612297570974191515389283066612961208916178940129074380592510465097766225371439873457013633432197133225688790879502413624289384262168215552}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\left(\left(\left(k \cdot \left(1 + \frac{-1}{6} \cdot {k}^{2}\right)\right) \cdot \left|t\right|\right) \cdot \left|t\right|\right) \cdot \left|t\right|} \cdot \frac{2}{k + k}\\
\mathbf{elif}\;\left|t\right| \leq 4999999999999999727876154935214080:\\
\;\;\;\;\frac{2}{t\_2 \cdot \left(\left(t\_3 \cdot \left|t\right|\right) \cdot t\_5\right)}\\
\mathbf{elif}\;\left|t\right| \leq 3999999999999999869344675216466765095398132743226221891671847117885183383686911450434959473821876224:\\
\;\;\;\;\frac{\ell}{t\_1 \cdot t\_4} \cdot \left(\frac{\ell}{k + k} \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_3 \cdot \left(\left(t\_2 \cdot \left|t\right|\right) \cdot t\_5\right)}\\
\end{array}
\end{array}
if t < 4.8000000000000002e-148Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites56.4%
Taylor expanded in k around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6462.2%
Applied rewrites62.2%
if 4.8000000000000002e-148 < t < 4.9999999999999997e33Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6469.6%
Applied rewrites61.3%
if 4.9999999999999997e33 < t < 3.9999999999999999e99Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.2%
if 3.9999999999999999e99 < t Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites64.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ t (fabs l))))
(if (<= (fabs l) 2349999999999999944735847609781977088)
(/
2
(*
(* (* (* t_1 t) (/ (* k t) (fabs l))) (tan k))
(+ (+ 1 (/ (* (/ k t) k) t)) 1)))
(/ 2 (* (* (* t (* t_1 (/ (* (sin k) t) (fabs l)))) (tan k)) 2)))))double code(double t, double l, double k) {
double t_1 = t / fabs(l);
double tmp;
if (fabs(l) <= 2.35e+36) {
tmp = 2.0 / ((((t_1 * t) * ((k * t) / fabs(l))) * tan(k)) * ((1.0 + (((k / t) * k) / t)) + 1.0));
} else {
tmp = 2.0 / (((t * (t_1 * ((sin(k) * t) / fabs(l)))) * tan(k)) * 2.0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = t / abs(l)
if (abs(l) <= 2.35d+36) then
tmp = 2.0d0 / ((((t_1 * t) * ((k * t) / abs(l))) * tan(k)) * ((1.0d0 + (((k / t) * k) / t)) + 1.0d0))
else
tmp = 2.0d0 / (((t * (t_1 * ((sin(k) * t) / abs(l)))) * tan(k)) * 2.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = t / Math.abs(l);
double tmp;
if (Math.abs(l) <= 2.35e+36) {
tmp = 2.0 / ((((t_1 * t) * ((k * t) / Math.abs(l))) * Math.tan(k)) * ((1.0 + (((k / t) * k) / t)) + 1.0));
} else {
tmp = 2.0 / (((t * (t_1 * ((Math.sin(k) * t) / Math.abs(l)))) * Math.tan(k)) * 2.0);
}
return tmp;
}
def code(t, l, k): t_1 = t / math.fabs(l) tmp = 0 if math.fabs(l) <= 2.35e+36: tmp = 2.0 / ((((t_1 * t) * ((k * t) / math.fabs(l))) * math.tan(k)) * ((1.0 + (((k / t) * k) / t)) + 1.0)) else: tmp = 2.0 / (((t * (t_1 * ((math.sin(k) * t) / math.fabs(l)))) * math.tan(k)) * 2.0) return tmp
function code(t, l, k) t_1 = Float64(t / abs(l)) tmp = 0.0 if (abs(l) <= 2.35e+36) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(t_1 * t) * Float64(Float64(k * t) / abs(l))) * tan(k)) * Float64(Float64(1.0 + Float64(Float64(Float64(k / t) * k) / t)) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64(t * Float64(t_1 * Float64(Float64(sin(k) * t) / abs(l)))) * tan(k)) * 2.0)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = t / abs(l); tmp = 0.0; if (abs(l) <= 2.35e+36) tmp = 2.0 / ((((t_1 * t) * ((k * t) / abs(l))) * tan(k)) * ((1.0 + (((k / t) * k) / t)) + 1.0)); else tmp = 2.0 / (((t * (t_1 * ((sin(k) * t) / abs(l)))) * tan(k)) * 2.0); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(t / N[Abs[l], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[l], $MachinePrecision], 2349999999999999944735847609781977088], N[(2 / N[(N[(N[(N[(t$95$1 * t), $MachinePrecision] * N[(N[(k * t), $MachinePrecision] / N[Abs[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1 + N[(N[(N[(k / t), $MachinePrecision] * k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2 / N[(N[(N[(t * N[(t$95$1 * N[(N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision] / N[Abs[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \frac{t}{\left|\ell\right|}\\
\mathbf{if}\;\left|\ell\right| \leq 2349999999999999944735847609781977088:\\
\;\;\;\;\frac{2}{\left(\left(\left(t\_1 \cdot t\right) \cdot \frac{k \cdot t}{\left|\ell\right|}\right) \cdot \tan k\right) \cdot \left(\left(1 + \frac{\frac{k}{t} \cdot k}{t}\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(t \cdot \left(t\_1 \cdot \frac{\sin k \cdot t}{\left|\ell\right|}\right)\right) \cdot \tan k\right) \cdot 2}\\
\end{array}
if l < 2.3499999999999999e36Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
associate-/l*N/A
lift-*.f64N/A
lower-/.f6468.6%
Applied rewrites68.6%
if 2.3499999999999999e36 < l Initial program 55.1%
Taylor expanded in t around inf
Applied rewrites54.8%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6468.4%
Applied rewrites68.4%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (/ (fabs t) l) (fabs t))) (t_2 (/ (* k (fabs t)) l)))
(*
(copysign 1 t)
(if (<=
(fabs t)
3455165794209175/7198262071269114212496861612297570974191515389283066612961208916178940129074380592510465097766225371439873457013633432197133225688790879502413624289384262168215552)
(*
(/
(* l l)
(*
(* (* (* k (+ 1 (* -1/6 (pow k 2)))) (fabs t)) (fabs t))
(fabs t)))
(/ 2 (+ k k)))
(if (<= (fabs t) 6965490562232727/1180591620717411303424)
(/
2
(*
(* (- (* (/ k (* (fabs t) (fabs t))) k) -2) t_1)
(* t_2 (tan k))))
(if (<=
(fabs t)
9999999999999999338604948347429745623719502164303315186116928223077006466996036476256924325958459471709145545996985214755393808134448127932794585054037286174943850004480)
(*
(/ l (* (* (* (sin k) (fabs t)) (fabs t)) (fabs t)))
(/ (* l 2) (+ k k)))
(/ 2 (* (* (* t_1 t_2) (tan k)) (+ 1 1)))))))))double code(double t, double l, double k) {
double t_1 = (fabs(t) / l) * fabs(t);
double t_2 = (k * fabs(t)) / l;
double tmp;
if (fabs(t) <= 4.8e-148) {
tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * pow(k, 2.0)))) * fabs(t)) * fabs(t)) * fabs(t))) * (2.0 / (k + k));
} else if (fabs(t) <= 5.9e-6) {
tmp = 2.0 / (((((k / (fabs(t) * fabs(t))) * k) - -2.0) * t_1) * (t_2 * tan(k)));
} else if (fabs(t) <= 1e+169) {
tmp = (l / (((sin(k) * fabs(t)) * fabs(t)) * fabs(t))) * ((l * 2.0) / (k + k));
} else {
tmp = 2.0 / (((t_1 * t_2) * tan(k)) * (1.0 + 1.0));
}
return copysign(1.0, t) * tmp;
}
public static double code(double t, double l, double k) {
double t_1 = (Math.abs(t) / l) * Math.abs(t);
double t_2 = (k * Math.abs(t)) / l;
double tmp;
if (Math.abs(t) <= 4.8e-148) {
tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * Math.pow(k, 2.0)))) * Math.abs(t)) * Math.abs(t)) * Math.abs(t))) * (2.0 / (k + k));
} else if (Math.abs(t) <= 5.9e-6) {
tmp = 2.0 / (((((k / (Math.abs(t) * Math.abs(t))) * k) - -2.0) * t_1) * (t_2 * Math.tan(k)));
} else if (Math.abs(t) <= 1e+169) {
tmp = (l / (((Math.sin(k) * Math.abs(t)) * Math.abs(t)) * Math.abs(t))) * ((l * 2.0) / (k + k));
} else {
tmp = 2.0 / (((t_1 * t_2) * Math.tan(k)) * (1.0 + 1.0));
}
return Math.copySign(1.0, t) * tmp;
}
def code(t, l, k): t_1 = (math.fabs(t) / l) * math.fabs(t) t_2 = (k * math.fabs(t)) / l tmp = 0 if math.fabs(t) <= 4.8e-148: tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * math.pow(k, 2.0)))) * math.fabs(t)) * math.fabs(t)) * math.fabs(t))) * (2.0 / (k + k)) elif math.fabs(t) <= 5.9e-6: tmp = 2.0 / (((((k / (math.fabs(t) * math.fabs(t))) * k) - -2.0) * t_1) * (t_2 * math.tan(k))) elif math.fabs(t) <= 1e+169: tmp = (l / (((math.sin(k) * math.fabs(t)) * math.fabs(t)) * math.fabs(t))) * ((l * 2.0) / (k + k)) else: tmp = 2.0 / (((t_1 * t_2) * math.tan(k)) * (1.0 + 1.0)) return math.copysign(1.0, t) * tmp
function code(t, l, k) t_1 = Float64(Float64(abs(t) / l) * abs(t)) t_2 = Float64(Float64(k * abs(t)) / l) tmp = 0.0 if (abs(t) <= 4.8e-148) tmp = Float64(Float64(Float64(l * l) / Float64(Float64(Float64(Float64(k * Float64(1.0 + Float64(-0.16666666666666666 * (k ^ 2.0)))) * abs(t)) * abs(t)) * abs(t))) * Float64(2.0 / Float64(k + k))); elseif (abs(t) <= 5.9e-6) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(k / Float64(abs(t) * abs(t))) * k) - -2.0) * t_1) * Float64(t_2 * tan(k)))); elseif (abs(t) <= 1e+169) tmp = Float64(Float64(l / Float64(Float64(Float64(sin(k) * abs(t)) * abs(t)) * abs(t))) * Float64(Float64(l * 2.0) / Float64(k + k))); else tmp = Float64(2.0 / Float64(Float64(Float64(t_1 * t_2) * tan(k)) * Float64(1.0 + 1.0))); end return Float64(copysign(1.0, t) * tmp) end
function tmp_2 = code(t, l, k) t_1 = (abs(t) / l) * abs(t); t_2 = (k * abs(t)) / l; tmp = 0.0; if (abs(t) <= 4.8e-148) tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * (k ^ 2.0)))) * abs(t)) * abs(t)) * abs(t))) * (2.0 / (k + k)); elseif (abs(t) <= 5.9e-6) tmp = 2.0 / (((((k / (abs(t) * abs(t))) * k) - -2.0) * t_1) * (t_2 * tan(k))); elseif (abs(t) <= 1e+169) tmp = (l / (((sin(k) * abs(t)) * abs(t)) * abs(t))) * ((l * 2.0) / (k + k)); else tmp = 2.0 / (((t_1 * t_2) * tan(k)) * (1.0 + 1.0)); end tmp_2 = (sign(t) * abs(1.0)) * tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(N[Abs[t], $MachinePrecision] / l), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(k * N[Abs[t], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[t], $MachinePrecision], 3455165794209175/7198262071269114212496861612297570974191515389283066612961208916178940129074380592510465097766225371439873457013633432197133225688790879502413624289384262168215552], N[(N[(N[(l * l), $MachinePrecision] / N[(N[(N[(N[(k * N[(1 + N[(-1/6 * N[Power[k, 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2 / N[(k + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 6965490562232727/1180591620717411303424], N[(2 / N[(N[(N[(N[(N[(k / N[(N[Abs[t], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] - -2), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(t$95$2 * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 9999999999999999338604948347429745623719502164303315186116928223077006466996036476256924325958459471709145545996985214755393808134448127932794585054037286174943850004480], N[(N[(l / N[(N[(N[(N[Sin[k], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * 2), $MachinePrecision] / N[(k + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2 / N[(N[(N[(t$95$1 * t$95$2), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(1 + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \frac{\left|t\right|}{\ell} \cdot \left|t\right|\\
t_2 := \frac{k \cdot \left|t\right|}{\ell}\\
\mathsf{copysign}\left(1, t\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|t\right| \leq \frac{3455165794209175}{7198262071269114212496861612297570974191515389283066612961208916178940129074380592510465097766225371439873457013633432197133225688790879502413624289384262168215552}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\left(\left(\left(k \cdot \left(1 + \frac{-1}{6} \cdot {k}^{2}\right)\right) \cdot \left|t\right|\right) \cdot \left|t\right|\right) \cdot \left|t\right|} \cdot \frac{2}{k + k}\\
\mathbf{elif}\;\left|t\right| \leq \frac{6965490562232727}{1180591620717411303424}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{k}{\left|t\right| \cdot \left|t\right|} \cdot k - -2\right) \cdot t\_1\right) \cdot \left(t\_2 \cdot \tan k\right)}\\
\mathbf{elif}\;\left|t\right| \leq 9999999999999999338604948347429745623719502164303315186116928223077006466996036476256924325958459471709145545996985214755393808134448127932794585054037286174943850004480:\\
\;\;\;\;\frac{\ell}{\left(\left(\sin k \cdot \left|t\right|\right) \cdot \left|t\right|\right) \cdot \left|t\right|} \cdot \frac{\ell \cdot 2}{k + k}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(t\_1 \cdot t\_2\right) \cdot \tan k\right) \cdot \left(1 + 1\right)}\\
\end{array}
\end{array}
if t < 4.8000000000000002e-148Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites56.4%
Taylor expanded in k around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6462.2%
Applied rewrites62.2%
if 4.8000000000000002e-148 < t < 5.9000000000000003e-6Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites59.1%
if 5.9000000000000003e-6 < t < 9.9999999999999993e168Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites62.1%
if 9.9999999999999993e168 < t Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
Taylor expanded in t around inf
Applied rewrites65.1%
(FPCore (t l k)
:precision binary64
(*
(copysign 1 t)
(if (<=
(fabs t)
3455165794209175/7198262071269114212496861612297570974191515389283066612961208916178940129074380592510465097766225371439873457013633432197133225688790879502413624289384262168215552)
(*
(/
(* l l)
(*
(* (* (* k (+ 1 (* -1/6 (pow k 2)))) (fabs t)) (fabs t))
(fabs t)))
(/ 2 (+ k k)))
(/
2
(*
(/ (fabs t) l)
(*
(* (/ (* k (fabs t)) l) (fabs t))
(* (- (* (/ k (* (fabs t) (fabs t))) k) -2) (tan k))))))))double code(double t, double l, double k) {
double tmp;
if (fabs(t) <= 4.8e-148) {
tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * pow(k, 2.0)))) * fabs(t)) * fabs(t)) * fabs(t))) * (2.0 / (k + k));
} else {
tmp = 2.0 / ((fabs(t) / l) * ((((k * fabs(t)) / l) * fabs(t)) * ((((k / (fabs(t) * fabs(t))) * k) - -2.0) * tan(k))));
}
return copysign(1.0, t) * tmp;
}
public static double code(double t, double l, double k) {
double tmp;
if (Math.abs(t) <= 4.8e-148) {
tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * Math.pow(k, 2.0)))) * Math.abs(t)) * Math.abs(t)) * Math.abs(t))) * (2.0 / (k + k));
} else {
tmp = 2.0 / ((Math.abs(t) / l) * ((((k * Math.abs(t)) / l) * Math.abs(t)) * ((((k / (Math.abs(t) * Math.abs(t))) * k) - -2.0) * Math.tan(k))));
}
return Math.copySign(1.0, t) * tmp;
}
def code(t, l, k): tmp = 0 if math.fabs(t) <= 4.8e-148: tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * math.pow(k, 2.0)))) * math.fabs(t)) * math.fabs(t)) * math.fabs(t))) * (2.0 / (k + k)) else: tmp = 2.0 / ((math.fabs(t) / l) * ((((k * math.fabs(t)) / l) * math.fabs(t)) * ((((k / (math.fabs(t) * math.fabs(t))) * k) - -2.0) * math.tan(k)))) return math.copysign(1.0, t) * tmp
function code(t, l, k) tmp = 0.0 if (abs(t) <= 4.8e-148) tmp = Float64(Float64(Float64(l * l) / Float64(Float64(Float64(Float64(k * Float64(1.0 + Float64(-0.16666666666666666 * (k ^ 2.0)))) * abs(t)) * abs(t)) * abs(t))) * Float64(2.0 / Float64(k + k))); else tmp = Float64(2.0 / Float64(Float64(abs(t) / l) * Float64(Float64(Float64(Float64(k * abs(t)) / l) * abs(t)) * Float64(Float64(Float64(Float64(k / Float64(abs(t) * abs(t))) * k) - -2.0) * tan(k))))); end return Float64(copysign(1.0, t) * tmp) end
function tmp_2 = code(t, l, k) tmp = 0.0; if (abs(t) <= 4.8e-148) tmp = ((l * l) / ((((k * (1.0 + (-0.16666666666666666 * (k ^ 2.0)))) * abs(t)) * abs(t)) * abs(t))) * (2.0 / (k + k)); else tmp = 2.0 / ((abs(t) / l) * ((((k * abs(t)) / l) * abs(t)) * ((((k / (abs(t) * abs(t))) * k) - -2.0) * tan(k)))); end tmp_2 = (sign(t) * abs(1.0)) * tmp; end
code[t_, l_, k_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[t], $MachinePrecision], 3455165794209175/7198262071269114212496861612297570974191515389283066612961208916178940129074380592510465097766225371439873457013633432197133225688790879502413624289384262168215552], N[(N[(N[(l * l), $MachinePrecision] / N[(N[(N[(N[(k * N[(1 + N[(-1/6 * N[Power[k, 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2 / N[(k + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2 / N[(N[(N[Abs[t], $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(k * N[Abs[t], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(k / N[(N[Abs[t], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] - -2), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, t\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|t\right| \leq \frac{3455165794209175}{7198262071269114212496861612297570974191515389283066612961208916178940129074380592510465097766225371439873457013633432197133225688790879502413624289384262168215552}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\left(\left(\left(k \cdot \left(1 + \frac{-1}{6} \cdot {k}^{2}\right)\right) \cdot \left|t\right|\right) \cdot \left|t\right|\right) \cdot \left|t\right|} \cdot \frac{2}{k + k}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\left|t\right|}{\ell} \cdot \left(\left(\frac{k \cdot \left|t\right|}{\ell} \cdot \left|t\right|\right) \cdot \left(\left(\frac{k}{\left|t\right| \cdot \left|t\right|} \cdot k - -2\right) \cdot \tan k\right)\right)}\\
\end{array}
if t < 4.8000000000000002e-148Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites56.4%
Taylor expanded in k around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6462.2%
Applied rewrites62.2%
if 4.8000000000000002e-148 < t Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites64.1%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (+ (fabs k) (fabs k))))
(if (<=
(fabs k)
3334007216439927/1667003608219963568519962947680314449286189580578977040099064452941009309454408017880358050217888572685732477648358310111472200413529841270090839013082707511523789394878503639615769571477953506182241254033971650495422687009369115322790969344)
(/ (* (* l (/ l (* (* (sin (fabs k)) t) t))) 2) (* t t_1))
(if (<= (fabs k) 28000000000000000)
(/
2
(*
(* (* (* (/ t l) t) (/ (* (fabs k) t) l)) (tan (fabs k)))
(+ 1 1)))
(*
(/
(* l l)
(*
(* (* (* (fabs k) (+ 1 (* -1/6 (pow (fabs k) 2)))) t) t)
t))
(/ 2 t_1))))))double code(double t, double l, double k) {
double t_1 = fabs(k) + fabs(k);
double tmp;
if (fabs(k) <= 2e-225) {
tmp = ((l * (l / ((sin(fabs(k)) * t) * t))) * 2.0) / (t * t_1);
} else if (fabs(k) <= 2.8e+16) {
tmp = 2.0 / (((((t / l) * t) * ((fabs(k) * t) / l)) * tan(fabs(k))) * (1.0 + 1.0));
} else {
tmp = ((l * l) / ((((fabs(k) * (1.0 + (-0.16666666666666666 * pow(fabs(k), 2.0)))) * t) * t) * t)) * (2.0 / t_1);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = abs(k) + abs(k)
if (abs(k) <= 2d-225) then
tmp = ((l * (l / ((sin(abs(k)) * t) * t))) * 2.0d0) / (t * t_1)
else if (abs(k) <= 2.8d+16) then
tmp = 2.0d0 / (((((t / l) * t) * ((abs(k) * t) / l)) * tan(abs(k))) * (1.0d0 + 1.0d0))
else
tmp = ((l * l) / ((((abs(k) * (1.0d0 + ((-0.16666666666666666d0) * (abs(k) ** 2.0d0)))) * t) * t) * t)) * (2.0d0 / t_1)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.abs(k) + Math.abs(k);
double tmp;
if (Math.abs(k) <= 2e-225) {
tmp = ((l * (l / ((Math.sin(Math.abs(k)) * t) * t))) * 2.0) / (t * t_1);
} else if (Math.abs(k) <= 2.8e+16) {
tmp = 2.0 / (((((t / l) * t) * ((Math.abs(k) * t) / l)) * Math.tan(Math.abs(k))) * (1.0 + 1.0));
} else {
tmp = ((l * l) / ((((Math.abs(k) * (1.0 + (-0.16666666666666666 * Math.pow(Math.abs(k), 2.0)))) * t) * t) * t)) * (2.0 / t_1);
}
return tmp;
}
def code(t, l, k): t_1 = math.fabs(k) + math.fabs(k) tmp = 0 if math.fabs(k) <= 2e-225: tmp = ((l * (l / ((math.sin(math.fabs(k)) * t) * t))) * 2.0) / (t * t_1) elif math.fabs(k) <= 2.8e+16: tmp = 2.0 / (((((t / l) * t) * ((math.fabs(k) * t) / l)) * math.tan(math.fabs(k))) * (1.0 + 1.0)) else: tmp = ((l * l) / ((((math.fabs(k) * (1.0 + (-0.16666666666666666 * math.pow(math.fabs(k), 2.0)))) * t) * t) * t)) * (2.0 / t_1) return tmp
function code(t, l, k) t_1 = Float64(abs(k) + abs(k)) tmp = 0.0 if (abs(k) <= 2e-225) tmp = Float64(Float64(Float64(l * Float64(l / Float64(Float64(sin(abs(k)) * t) * t))) * 2.0) / Float64(t * t_1)); elseif (abs(k) <= 2.8e+16) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(t / l) * t) * Float64(Float64(abs(k) * t) / l)) * tan(abs(k))) * Float64(1.0 + 1.0))); else tmp = Float64(Float64(Float64(l * l) / Float64(Float64(Float64(Float64(abs(k) * Float64(1.0 + Float64(-0.16666666666666666 * (abs(k) ^ 2.0)))) * t) * t) * t)) * Float64(2.0 / t_1)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = abs(k) + abs(k); tmp = 0.0; if (abs(k) <= 2e-225) tmp = ((l * (l / ((sin(abs(k)) * t) * t))) * 2.0) / (t * t_1); elseif (abs(k) <= 2.8e+16) tmp = 2.0 / (((((t / l) * t) * ((abs(k) * t) / l)) * tan(abs(k))) * (1.0 + 1.0)); else tmp = ((l * l) / ((((abs(k) * (1.0 + (-0.16666666666666666 * (abs(k) ^ 2.0)))) * t) * t) * t)) * (2.0 / t_1); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 3334007216439927/1667003608219963568519962947680314449286189580578977040099064452941009309454408017880358050217888572685732477648358310111472200413529841270090839013082707511523789394878503639615769571477953506182241254033971650495422687009369115322790969344], N[(N[(N[(l * N[(l / N[(N[(N[Sin[N[Abs[k], $MachinePrecision]], $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision] / N[(t * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[k], $MachinePrecision], 28000000000000000], N[(2 / N[(N[(N[(N[(N[(t / l), $MachinePrecision] * t), $MachinePrecision] * N[(N[(N[Abs[k], $MachinePrecision] * t), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Tan[N[Abs[k], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1 + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l * l), $MachinePrecision] / N[(N[(N[(N[(N[Abs[k], $MachinePrecision] * N[(1 + N[(-1/6 * N[Power[N[Abs[k], $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(2 / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left|k\right| + \left|k\right|\\
\mathbf{if}\;\left|k\right| \leq \frac{3334007216439927}{1667003608219963568519962947680314449286189580578977040099064452941009309454408017880358050217888572685732477648358310111472200413529841270090839013082707511523789394878503639615769571477953506182241254033971650495422687009369115322790969344}:\\
\;\;\;\;\frac{\left(\ell \cdot \frac{\ell}{\left(\sin \left(\left|k\right|\right) \cdot t\right) \cdot t}\right) \cdot 2}{t \cdot t\_1}\\
\mathbf{elif}\;\left|k\right| \leq 28000000000000000:\\
\;\;\;\;\frac{2}{\left(\left(\left(\frac{t}{\ell} \cdot t\right) \cdot \frac{\left|k\right| \cdot t}{\ell}\right) \cdot \tan \left(\left|k\right|\right)\right) \cdot \left(1 + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\left(\left(\left(\left|k\right| \cdot \left(1 + \frac{-1}{6} \cdot {\left(\left|k\right|\right)}^{2}\right)\right) \cdot t\right) \cdot t\right) \cdot t} \cdot \frac{2}{t\_1}\\
\end{array}
if k < 1.9999999999999999e-225Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites56.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites65.7%
if 1.9999999999999999e-225 < k < 2.8e16Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
Taylor expanded in t around inf
Applied rewrites65.1%
if 2.8e16 < k Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites56.4%
Taylor expanded in k around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6462.2%
Applied rewrites62.2%
(FPCore (t l k)
:precision binary64
(if (<=
(* l l)
5159126280621731/515912628062173092140956821207535748553561841832149923953086629908861232965551620580485601452790222553392963860602664725471042538576841344971229471155214430574596371092778402508526872730885196340843977449424988675925808879640197010584371971452184059071815020407947264)
(* (/ l (* (* k t) (* t t))) (* (/ l (+ k k)) 2))
(if (<=
(* l l)
999999999999999965084388885482519417592855130626093842171043595190833186399051537317196816706799625297221478016185520727674168639944850288849622355474122345476546392575499689981548348018063279122228410984187505225498624)
(/ (* (* l (/ l (* (* (sin k) t) t))) 2) (* t (+ k k)))
(/ 2 (* (* (* (* (/ t l) t) (/ (* k t) l)) (tan k)) (+ 1 1))))))double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e-251) {
tmp = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0);
} else if ((l * l) <= 1e+219) {
tmp = ((l * (l / ((sin(k) * t) * t))) * 2.0) / (t * (k + k));
} else {
tmp = 2.0 / (((((t / l) * t) * ((k * t) / l)) * tan(k)) * (1.0 + 1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if ((l * l) <= 1d-251) then
tmp = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0d0)
else if ((l * l) <= 1d+219) then
tmp = ((l * (l / ((sin(k) * t) * t))) * 2.0d0) / (t * (k + k))
else
tmp = 2.0d0 / (((((t / l) * t) * ((k * t) / l)) * tan(k)) * (1.0d0 + 1.0d0))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e-251) {
tmp = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0);
} else if ((l * l) <= 1e+219) {
tmp = ((l * (l / ((Math.sin(k) * t) * t))) * 2.0) / (t * (k + k));
} else {
tmp = 2.0 / (((((t / l) * t) * ((k * t) / l)) * Math.tan(k)) * (1.0 + 1.0));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 1e-251: tmp = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0) elif (l * l) <= 1e+219: tmp = ((l * (l / ((math.sin(k) * t) * t))) * 2.0) / (t * (k + k)) else: tmp = 2.0 / (((((t / l) * t) * ((k * t) / l)) * math.tan(k)) * (1.0 + 1.0)) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 1e-251) tmp = Float64(Float64(l / Float64(Float64(k * t) * Float64(t * t))) * Float64(Float64(l / Float64(k + k)) * 2.0)); elseif (Float64(l * l) <= 1e+219) tmp = Float64(Float64(Float64(l * Float64(l / Float64(Float64(sin(k) * t) * t))) * 2.0) / Float64(t * Float64(k + k))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(t / l) * t) * Float64(Float64(k * t) / l)) * tan(k)) * Float64(1.0 + 1.0))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 1e-251) tmp = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0); elseif ((l * l) <= 1e+219) tmp = ((l * (l / ((sin(k) * t) * t))) * 2.0) / (t * (k + k)); else tmp = 2.0 / (((((t / l) * t) * ((k * t) / l)) * tan(k)) * (1.0 + 1.0)); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 5159126280621731/515912628062173092140956821207535748553561841832149923953086629908861232965551620580485601452790222553392963860602664725471042538576841344971229471155214430574596371092778402508526872730885196340843977449424988675925808879640197010584371971452184059071815020407947264], N[(N[(l / N[(N[(k * t), $MachinePrecision] * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l / N[(k + k), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * l), $MachinePrecision], 999999999999999965084388885482519417592855130626093842171043595190833186399051537317196816706799625297221478016185520727674168639944850288849622355474122345476546392575499689981548348018063279122228410984187505225498624], N[(N[(N[(l * N[(l / N[(N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision] / N[(t * N[(k + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2 / N[(N[(N[(N[(N[(t / l), $MachinePrecision] * t), $MachinePrecision] * N[(N[(k * t), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(1 + 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq \frac{5159126280621731}{515912628062173092140956821207535748553561841832149923953086629908861232965551620580485601452790222553392963860602664725471042538576841344971229471155214430574596371092778402508526872730885196340843977449424988675925808879640197010584371971452184059071815020407947264}:\\
\;\;\;\;\frac{\ell}{\left(k \cdot t\right) \cdot \left(t \cdot t\right)} \cdot \left(\frac{\ell}{k + k} \cdot 2\right)\\
\mathbf{elif}\;\ell \cdot \ell \leq 999999999999999965084388885482519417592855130626093842171043595190833186399051537317196816706799625297221478016185520727674168639944850288849622355474122345476546392575499689981548348018063279122228410984187505225498624:\\
\;\;\;\;\frac{\left(\ell \cdot \frac{\ell}{\left(\sin k \cdot t\right) \cdot t}\right) \cdot 2}{t \cdot \left(k + k\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\left(\left(\left(\frac{t}{\ell} \cdot t\right) \cdot \frac{k \cdot t}{\ell}\right) \cdot \tan k\right) \cdot \left(1 + 1\right)}\\
\end{array}
if (*.f64 l l) < 1e-251Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.2%
if 1e-251 < (*.f64 l l) < 9.9999999999999997e218Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites56.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites65.7%
if 9.9999999999999997e218 < (*.f64 l l) Initial program 55.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-pow.f64N/A
unpow3N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6468.0%
Applied rewrites68.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.0%
Applied rewrites75.0%
Taylor expanded in k around 0
lower-*.f6468.6%
Applied rewrites68.6%
Taylor expanded in t around inf
Applied rewrites65.1%
(FPCore (t l k)
:precision binary64
(*
(copysign 1 t)
(if (<=
(fabs t)
8742010015015781/971334446112864535459730953411759453321203419526069760625906204869452142602604249088)
(*
(/ 1 (* (* (* (/ (fabs t) (* l l)) (fabs t)) (fabs t)) (sin k)))
(/ 2 (+ k k)))
(if (<=
(fabs t)
19499999999999998414092620530282440361043467030448022129590792332144947096303360161971506580700578568994816)
(*
(/ l (* (* k (fabs t)) (* (fabs t) (fabs t))))
(* (/ l (+ k k)) 2))
(/
(* (* l (/ l (* (* (sin k) (fabs t)) (fabs t)))) 2)
(* (fabs t) (+ k k)))))))double code(double t, double l, double k) {
double tmp;
if (fabs(t) <= 9e-69) {
tmp = (1.0 / ((((fabs(t) / (l * l)) * fabs(t)) * fabs(t)) * sin(k))) * (2.0 / (k + k));
} else if (fabs(t) <= 1.95e+106) {
tmp = (l / ((k * fabs(t)) * (fabs(t) * fabs(t)))) * ((l / (k + k)) * 2.0);
} else {
tmp = ((l * (l / ((sin(k) * fabs(t)) * fabs(t)))) * 2.0) / (fabs(t) * (k + k));
}
return copysign(1.0, t) * tmp;
}
public static double code(double t, double l, double k) {
double tmp;
if (Math.abs(t) <= 9e-69) {
tmp = (1.0 / ((((Math.abs(t) / (l * l)) * Math.abs(t)) * Math.abs(t)) * Math.sin(k))) * (2.0 / (k + k));
} else if (Math.abs(t) <= 1.95e+106) {
tmp = (l / ((k * Math.abs(t)) * (Math.abs(t) * Math.abs(t)))) * ((l / (k + k)) * 2.0);
} else {
tmp = ((l * (l / ((Math.sin(k) * Math.abs(t)) * Math.abs(t)))) * 2.0) / (Math.abs(t) * (k + k));
}
return Math.copySign(1.0, t) * tmp;
}
def code(t, l, k): tmp = 0 if math.fabs(t) <= 9e-69: tmp = (1.0 / ((((math.fabs(t) / (l * l)) * math.fabs(t)) * math.fabs(t)) * math.sin(k))) * (2.0 / (k + k)) elif math.fabs(t) <= 1.95e+106: tmp = (l / ((k * math.fabs(t)) * (math.fabs(t) * math.fabs(t)))) * ((l / (k + k)) * 2.0) else: tmp = ((l * (l / ((math.sin(k) * math.fabs(t)) * math.fabs(t)))) * 2.0) / (math.fabs(t) * (k + k)) return math.copysign(1.0, t) * tmp
function code(t, l, k) tmp = 0.0 if (abs(t) <= 9e-69) tmp = Float64(Float64(1.0 / Float64(Float64(Float64(Float64(abs(t) / Float64(l * l)) * abs(t)) * abs(t)) * sin(k))) * Float64(2.0 / Float64(k + k))); elseif (abs(t) <= 1.95e+106) tmp = Float64(Float64(l / Float64(Float64(k * abs(t)) * Float64(abs(t) * abs(t)))) * Float64(Float64(l / Float64(k + k)) * 2.0)); else tmp = Float64(Float64(Float64(l * Float64(l / Float64(Float64(sin(k) * abs(t)) * abs(t)))) * 2.0) / Float64(abs(t) * Float64(k + k))); end return Float64(copysign(1.0, t) * tmp) end
function tmp_2 = code(t, l, k) tmp = 0.0; if (abs(t) <= 9e-69) tmp = (1.0 / ((((abs(t) / (l * l)) * abs(t)) * abs(t)) * sin(k))) * (2.0 / (k + k)); elseif (abs(t) <= 1.95e+106) tmp = (l / ((k * abs(t)) * (abs(t) * abs(t)))) * ((l / (k + k)) * 2.0); else tmp = ((l * (l / ((sin(k) * abs(t)) * abs(t)))) * 2.0) / (abs(t) * (k + k)); end tmp_2 = (sign(t) * abs(1.0)) * tmp; end
code[t_, l_, k_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[t], $MachinePrecision], 8742010015015781/971334446112864535459730953411759453321203419526069760625906204869452142602604249088], N[(N[(1 / N[(N[(N[(N[(N[Abs[t], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2 / N[(k + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 19499999999999998414092620530282440361043467030448022129590792332144947096303360161971506580700578568994816], N[(N[(l / N[(N[(k * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[t], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l / N[(k + k), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l * N[(l / N[(N[(N[Sin[k], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision] / N[(N[Abs[t], $MachinePrecision] * N[(k + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\mathsf{copysign}\left(1, t\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|t\right| \leq \frac{8742010015015781}{971334446112864535459730953411759453321203419526069760625906204869452142602604249088}:\\
\;\;\;\;\frac{1}{\left(\left(\frac{\left|t\right|}{\ell \cdot \ell} \cdot \left|t\right|\right) \cdot \left|t\right|\right) \cdot \sin k} \cdot \frac{2}{k + k}\\
\mathbf{elif}\;\left|t\right| \leq 19499999999999998414092620530282440361043467030448022129590792332144947096303360161971506580700578568994816:\\
\;\;\;\;\frac{\ell}{\left(k \cdot \left|t\right|\right) \cdot \left(\left|t\right| \cdot \left|t\right|\right)} \cdot \left(\frac{\ell}{k + k} \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\ell \cdot \frac{\ell}{\left(\sin k \cdot \left|t\right|\right) \cdot \left|t\right|}\right) \cdot 2}{\left|t\right| \cdot \left(k + k\right)}\\
\end{array}
if t < 9.0000000000000002e-69Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites56.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f32N/A
lower-/.f32N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites59.2%
if 9.0000000000000002e-69 < t < 1.9499999999999998e106Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.2%
if 1.9499999999999998e106 < t Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites56.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites65.7%
(FPCore (t l k)
:precision binary64
(*
(copysign 1 t)
(if (<=
(fabs t)
19499999999999998414092620530282440361043467030448022129590792332144947096303360161971506580700578568994816)
(*
(/ l (* (* k (fabs t)) (* (fabs t) (fabs t))))
(* (/ l (+ k k)) 2))
(/
(* (* l (/ l (* (* (sin k) (fabs t)) (fabs t)))) 2)
(* (fabs t) (+ k k))))))double code(double t, double l, double k) {
double tmp;
if (fabs(t) <= 1.95e+106) {
tmp = (l / ((k * fabs(t)) * (fabs(t) * fabs(t)))) * ((l / (k + k)) * 2.0);
} else {
tmp = ((l * (l / ((sin(k) * fabs(t)) * fabs(t)))) * 2.0) / (fabs(t) * (k + k));
}
return copysign(1.0, t) * tmp;
}
public static double code(double t, double l, double k) {
double tmp;
if (Math.abs(t) <= 1.95e+106) {
tmp = (l / ((k * Math.abs(t)) * (Math.abs(t) * Math.abs(t)))) * ((l / (k + k)) * 2.0);
} else {
tmp = ((l * (l / ((Math.sin(k) * Math.abs(t)) * Math.abs(t)))) * 2.0) / (Math.abs(t) * (k + k));
}
return Math.copySign(1.0, t) * tmp;
}
def code(t, l, k): tmp = 0 if math.fabs(t) <= 1.95e+106: tmp = (l / ((k * math.fabs(t)) * (math.fabs(t) * math.fabs(t)))) * ((l / (k + k)) * 2.0) else: tmp = ((l * (l / ((math.sin(k) * math.fabs(t)) * math.fabs(t)))) * 2.0) / (math.fabs(t) * (k + k)) return math.copysign(1.0, t) * tmp
function code(t, l, k) tmp = 0.0 if (abs(t) <= 1.95e+106) tmp = Float64(Float64(l / Float64(Float64(k * abs(t)) * Float64(abs(t) * abs(t)))) * Float64(Float64(l / Float64(k + k)) * 2.0)); else tmp = Float64(Float64(Float64(l * Float64(l / Float64(Float64(sin(k) * abs(t)) * abs(t)))) * 2.0) / Float64(abs(t) * Float64(k + k))); end return Float64(copysign(1.0, t) * tmp) end
function tmp_2 = code(t, l, k) tmp = 0.0; if (abs(t) <= 1.95e+106) tmp = (l / ((k * abs(t)) * (abs(t) * abs(t)))) * ((l / (k + k)) * 2.0); else tmp = ((l * (l / ((sin(k) * abs(t)) * abs(t)))) * 2.0) / (abs(t) * (k + k)); end tmp_2 = (sign(t) * abs(1.0)) * tmp; end
code[t_, l_, k_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[t], $MachinePrecision], 19499999999999998414092620530282440361043467030448022129590792332144947096303360161971506580700578568994816], N[(N[(l / N[(N[(k * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[t], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l / N[(k + k), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l * N[(l / N[(N[(N[Sin[k], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision] / N[(N[Abs[t], $MachinePrecision] * N[(k + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, t\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|t\right| \leq 19499999999999998414092620530282440361043467030448022129590792332144947096303360161971506580700578568994816:\\
\;\;\;\;\frac{\ell}{\left(k \cdot \left|t\right|\right) \cdot \left(\left|t\right| \cdot \left|t\right|\right)} \cdot \left(\frac{\ell}{k + k} \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\ell \cdot \frac{\ell}{\left(\sin k \cdot \left|t\right|\right) \cdot \left|t\right|}\right) \cdot 2}{\left|t\right| \cdot \left(k + k\right)}\\
\end{array}
if t < 1.9499999999999998e106Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.2%
if 1.9499999999999998e106 < t Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites56.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites65.7%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (+ (fabs k) (fabs k))))
(if (<=
(fabs k)
1499999999999999989831423011542441964692562662916096)
(* (/ l (* (* (* (sin (fabs k)) t) t) t)) (/ (* l 2) t_1))
(* (* (/ l (* t t)) (/ l (* t_1 (* (fabs k) t)))) 2))))double code(double t, double l, double k) {
double t_1 = fabs(k) + fabs(k);
double tmp;
if (fabs(k) <= 1.5e+51) {
tmp = (l / (((sin(fabs(k)) * t) * t) * t)) * ((l * 2.0) / t_1);
} else {
tmp = ((l / (t * t)) * (l / (t_1 * (fabs(k) * t)))) * 2.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = abs(k) + abs(k)
if (abs(k) <= 1.5d+51) then
tmp = (l / (((sin(abs(k)) * t) * t) * t)) * ((l * 2.0d0) / t_1)
else
tmp = ((l / (t * t)) * (l / (t_1 * (abs(k) * t)))) * 2.0d0
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.abs(k) + Math.abs(k);
double tmp;
if (Math.abs(k) <= 1.5e+51) {
tmp = (l / (((Math.sin(Math.abs(k)) * t) * t) * t)) * ((l * 2.0) / t_1);
} else {
tmp = ((l / (t * t)) * (l / (t_1 * (Math.abs(k) * t)))) * 2.0;
}
return tmp;
}
def code(t, l, k): t_1 = math.fabs(k) + math.fabs(k) tmp = 0 if math.fabs(k) <= 1.5e+51: tmp = (l / (((math.sin(math.fabs(k)) * t) * t) * t)) * ((l * 2.0) / t_1) else: tmp = ((l / (t * t)) * (l / (t_1 * (math.fabs(k) * t)))) * 2.0 return tmp
function code(t, l, k) t_1 = Float64(abs(k) + abs(k)) tmp = 0.0 if (abs(k) <= 1.5e+51) tmp = Float64(Float64(l / Float64(Float64(Float64(sin(abs(k)) * t) * t) * t)) * Float64(Float64(l * 2.0) / t_1)); else tmp = Float64(Float64(Float64(l / Float64(t * t)) * Float64(l / Float64(t_1 * Float64(abs(k) * t)))) * 2.0); end return tmp end
function tmp_2 = code(t, l, k) t_1 = abs(k) + abs(k); tmp = 0.0; if (abs(k) <= 1.5e+51) tmp = (l / (((sin(abs(k)) * t) * t) * t)) * ((l * 2.0) / t_1); else tmp = ((l / (t * t)) * (l / (t_1 * (abs(k) * t)))) * 2.0; end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 1499999999999999989831423011542441964692562662916096], N[(N[(l / N[(N[(N[(N[Sin[N[Abs[k], $MachinePrecision]], $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(N[(l * 2), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l / N[(t * t), $MachinePrecision]), $MachinePrecision] * N[(l / N[(t$95$1 * N[(N[Abs[k], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]]]
\begin{array}{l}
t_1 := \left|k\right| + \left|k\right|\\
\mathbf{if}\;\left|k\right| \leq 1499999999999999989831423011542441964692562662916096:\\
\;\;\;\;\frac{\ell}{\left(\left(\sin \left(\left|k\right|\right) \cdot t\right) \cdot t\right) \cdot t} \cdot \frac{\ell \cdot 2}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\ell}{t \cdot t} \cdot \frac{\ell}{t\_1 \cdot \left(\left|k\right| \cdot t\right)}\right) \cdot 2\\
\end{array}
if k < 1.5e51Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites62.1%
if 1.5e51 < k Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
Applied rewrites62.1%
(FPCore (t l k)
:precision binary64
(if (<=
(* l l)
4856672230564323/485667223056432267729865476705879726660601709763034880312953102434726071301302124544)
(* (/ l (* (* k t) (* t t))) (* (/ l (+ k k)) 2))
(* (* (- l) (/ l (* (* (* (* (sin k) t) t) (- t)) (+ k k)))) 2)))double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e-68) {
tmp = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0);
} else {
tmp = (-l * (l / ((((sin(k) * t) * t) * -t) * (k + k)))) * 2.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if ((l * l) <= 1d-68) then
tmp = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0d0)
else
tmp = (-l * (l / ((((sin(k) * t) * t) * -t) * (k + k)))) * 2.0d0
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e-68) {
tmp = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0);
} else {
tmp = (-l * (l / ((((Math.sin(k) * t) * t) * -t) * (k + k)))) * 2.0;
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 1e-68: tmp = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0) else: tmp = (-l * (l / ((((math.sin(k) * t) * t) * -t) * (k + k)))) * 2.0 return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 1e-68) tmp = Float64(Float64(l / Float64(Float64(k * t) * Float64(t * t))) * Float64(Float64(l / Float64(k + k)) * 2.0)); else tmp = Float64(Float64(Float64(-l) * Float64(l / Float64(Float64(Float64(Float64(sin(k) * t) * t) * Float64(-t)) * Float64(k + k)))) * 2.0); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 1e-68) tmp = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0); else tmp = (-l * (l / ((((sin(k) * t) * t) * -t) * (k + k)))) * 2.0; end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 4856672230564323/485667223056432267729865476705879726660601709763034880312953102434726071301302124544], N[(N[(l / N[(N[(k * t), $MachinePrecision] * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l / N[(k + k), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision], N[(N[((-l) * N[(l / N[(N[(N[(N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision] * t), $MachinePrecision] * (-t)), $MachinePrecision] * N[(k + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq \frac{4856672230564323}{485667223056432267729865476705879726660601709763034880312953102434726071301302124544}:\\
\;\;\;\;\frac{\ell}{\left(k \cdot t\right) \cdot \left(t \cdot t\right)} \cdot \left(\frac{\ell}{k + k} \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-\ell\right) \cdot \frac{\ell}{\left(\left(\left(\sin k \cdot t\right) \cdot t\right) \cdot \left(-t\right)\right) \cdot \left(k + k\right)}\right) \cdot 2\\
\end{array}
if (*.f64 l l) < 1.0000000000000001e-68Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.2%
if 1.0000000000000001e-68 < (*.f64 l l) Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
Applied rewrites61.0%
(FPCore (t l k) :precision binary64 (* (/ l (* (* k t) (* t t))) (* (/ l (+ k k)) 2)))
double code(double t, double l, double k) {
return (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.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 = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0d0)
end function
public static double code(double t, double l, double k) {
return (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0);
}
def code(t, l, k): return (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0)
function code(t, l, k) return Float64(Float64(l / Float64(Float64(k * t) * Float64(t * t))) * Float64(Float64(l / Float64(k + k)) * 2.0)) end
function tmp = code(t, l, k) tmp = (l / ((k * t) * (t * t))) * ((l / (k + k)) * 2.0); end
code[t_, l_, k_] := N[(N[(l / N[(N[(k * t), $MachinePrecision] * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l / N[(k + k), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision]), $MachinePrecision]
\frac{\ell}{\left(k \cdot t\right) \cdot \left(t \cdot t\right)} \cdot \left(\frac{\ell}{k + k} \cdot 2\right)
Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.2%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (fabs k) t)) (t_2 (+ (fabs k) (fabs k))))
(if (<=
(fabs k)
4904977144712527/20437404769635530871361256581497226916530700906859085224986083762557049772738192033637969566644589579154866655684531151298277765001150399085969119214436673744076858091019117327539586267590276988750370373064129781691707499060437712782221877948907972172872918086407741866417750991158722661661540352)
(* (/ (* l l) (* (* t_2 t) (* t_1 t))) 2)
(* (* (/ l (* (* t_2 (* t t)) t_1)) l) 2))))double code(double t, double l, double k) {
double t_1 = fabs(k) * t;
double t_2 = fabs(k) + fabs(k);
double tmp;
if (fabs(k) <= 2.4e-280) {
tmp = ((l * l) / ((t_2 * t) * (t_1 * t))) * 2.0;
} else {
tmp = ((l / ((t_2 * (t * t)) * t_1)) * l) * 2.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = abs(k) * t
t_2 = abs(k) + abs(k)
if (abs(k) <= 2.4d-280) then
tmp = ((l * l) / ((t_2 * t) * (t_1 * t))) * 2.0d0
else
tmp = ((l / ((t_2 * (t * t)) * t_1)) * l) * 2.0d0
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.abs(k) * t;
double t_2 = Math.abs(k) + Math.abs(k);
double tmp;
if (Math.abs(k) <= 2.4e-280) {
tmp = ((l * l) / ((t_2 * t) * (t_1 * t))) * 2.0;
} else {
tmp = ((l / ((t_2 * (t * t)) * t_1)) * l) * 2.0;
}
return tmp;
}
def code(t, l, k): t_1 = math.fabs(k) * t t_2 = math.fabs(k) + math.fabs(k) tmp = 0 if math.fabs(k) <= 2.4e-280: tmp = ((l * l) / ((t_2 * t) * (t_1 * t))) * 2.0 else: tmp = ((l / ((t_2 * (t * t)) * t_1)) * l) * 2.0 return tmp
function code(t, l, k) t_1 = Float64(abs(k) * t) t_2 = Float64(abs(k) + abs(k)) tmp = 0.0 if (abs(k) <= 2.4e-280) tmp = Float64(Float64(Float64(l * l) / Float64(Float64(t_2 * t) * Float64(t_1 * t))) * 2.0); else tmp = Float64(Float64(Float64(l / Float64(Float64(t_2 * Float64(t * t)) * t_1)) * l) * 2.0); end return tmp end
function tmp_2 = code(t, l, k) t_1 = abs(k) * t; t_2 = abs(k) + abs(k); tmp = 0.0; if (abs(k) <= 2.4e-280) tmp = ((l * l) / ((t_2 * t) * (t_1 * t))) * 2.0; else tmp = ((l / ((t_2 * (t * t)) * t_1)) * l) * 2.0; end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Abs[k], $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 4904977144712527/20437404769635530871361256581497226916530700906859085224986083762557049772738192033637969566644589579154866655684531151298277765001150399085969119214436673744076858091019117327539586267590276988750370373064129781691707499060437712782221877948907972172872918086407741866417750991158722661661540352], N[(N[(N[(l * l), $MachinePrecision] / N[(N[(t$95$2 * t), $MachinePrecision] * N[(t$95$1 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2), $MachinePrecision], N[(N[(N[(l / N[(N[(t$95$2 * N[(t * t), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * 2), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \left|k\right| \cdot t\\
t_2 := \left|k\right| + \left|k\right|\\
\mathbf{if}\;\left|k\right| \leq \frac{4904977144712527}{20437404769635530871361256581497226916530700906859085224986083762557049772738192033637969566644589579154866655684531151298277765001150399085969119214436673744076858091019117327539586267590276988750370373064129781691707499060437712782221877948907972172872918086407741866417750991158722661661540352}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\left(t\_2 \cdot t\right) \cdot \left(t\_1 \cdot t\right)} \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\ell}{\left(t\_2 \cdot \left(t \cdot t\right)\right) \cdot t\_1} \cdot \ell\right) \cdot 2\\
\end{array}
if k < 2.3999999999999998e-280Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6462.2%
Applied rewrites62.2%
if 2.3999999999999998e-280 < k Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites63.2%
(FPCore (t l k) :precision binary64 (* (* (/ l (* (* (+ k k) (* t t)) (* k t))) l) 2))
double code(double t, double l, double k) {
return ((l / (((k + k) * (t * t)) * (k * t))) * l) * 2.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 = ((l / (((k + k) * (t * t)) * (k * t))) * l) * 2.0d0
end function
public static double code(double t, double l, double k) {
return ((l / (((k + k) * (t * t)) * (k * t))) * l) * 2.0;
}
def code(t, l, k): return ((l / (((k + k) * (t * t)) * (k * t))) * l) * 2.0
function code(t, l, k) return Float64(Float64(Float64(l / Float64(Float64(Float64(k + k) * Float64(t * t)) * Float64(k * t))) * l) * 2.0) end
function tmp = code(t, l, k) tmp = ((l / (((k + k) * (t * t)) * (k * t))) * l) * 2.0; end
code[t_, l_, k_] := N[(N[(N[(l / N[(N[(N[(k + k), $MachinePrecision] * N[(t * t), $MachinePrecision]), $MachinePrecision] * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision] * 2), $MachinePrecision]
\left(\frac{\ell}{\left(\left(k + k\right) \cdot \left(t \cdot t\right)\right) \cdot \left(k \cdot t\right)} \cdot \ell\right) \cdot 2
Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites63.2%
(FPCore (t l k) :precision binary64 (* (* l l) (/ 2 (* (* (+ k k) (* t t)) (* k t)))))
double code(double t, double l, double k) {
return (l * l) * (2.0 / (((k + k) * (t * t)) * (k * t)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (l * l) * (2.0d0 / (((k + k) * (t * t)) * (k * t)))
end function
public static double code(double t, double l, double k) {
return (l * l) * (2.0 / (((k + k) * (t * t)) * (k * t)));
}
def code(t, l, k): return (l * l) * (2.0 / (((k + k) * (t * t)) * (k * t)))
function code(t, l, k) return Float64(Float64(l * l) * Float64(2.0 / Float64(Float64(Float64(k + k) * Float64(t * t)) * Float64(k * t)))) end
function tmp = code(t, l, k) tmp = (l * l) * (2.0 / (((k + k) * (t * t)) * (k * t))); end
code[t_, l_, k_] := N[(N[(l * l), $MachinePrecision] * N[(2 / N[(N[(N[(k + k), $MachinePrecision] * N[(t * t), $MachinePrecision]), $MachinePrecision] * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\ell \cdot \ell\right) \cdot \frac{2}{\left(\left(k + k\right) \cdot \left(t \cdot t\right)\right) \cdot \left(k \cdot t\right)}
Initial program 55.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.1%
Taylor expanded in k around 0
lower-*.f6455.8%
Applied rewrites55.8%
Taylor expanded in k around 0
lower-*.f6458.4%
Applied rewrites58.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6458.3%
lift-*.f64N/A
Applied rewrites58.7%
herbie shell --seed 2025285 -o generate:evaluate
(FPCore (t l k)
:name "Toniolo and Linder, Equation (10+)"
:precision binary64
(/ 2 (* (* (* (/ (pow t 3) (* l l)) (sin k)) (tan k)) (+ (+ 1 (pow (/ k t) 2)) 1))))