
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (+ (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) + 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) + 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) + 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) + 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) + 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) + 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)}
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (+ (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) + 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) + 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) + 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) + 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) + 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) + 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)}
\end{array}
(FPCore (t l k)
:precision binary64
(/
2.0
(*
(/
(/
(fma
2.0
(/ (pow (* (sin k) t) 2.0) (cos k))
(/ (pow (* (sin k) k) 2.0) (cos k)))
l)
l)
t)))
double code(double t, double l, double k) {
return 2.0 / (((fma(2.0, (pow((sin(k) * t), 2.0) / cos(k)), (pow((sin(k) * k), 2.0) / cos(k))) / l) / l) * t);
}
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(fma(2.0, Float64((Float64(sin(k) * t) ^ 2.0) / cos(k)), Float64((Float64(sin(k) * k) ^ 2.0) / cos(k))) / l) / l) * t)) end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(2.0 * N[(N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\frac{\frac{\mathsf{fma}\left(2, \frac{{\left(\sin k \cdot t\right)}^{2}}{\cos k}, \frac{{\left(\sin k \cdot k\right)}^{2}}{\cos k}\right)}{\ell}}{\ell} \cdot t}
\end{array}
Initial program 54.6%
Taylor expanded in t around 0
Applied rewrites68.4%
Taylor expanded in l around 0
Applied rewrites74.1%
Applied rewrites82.0%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (+ (+ 1.0 (pow (/ k t) 2.0)) 1.0)))
(if (<= (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) t_1) 4e+27)
(/ 2.0 (* (* (* (/ (/ (* (* t t) t) l) l) (sin k)) (tan k)) t_1))
(/
2.0
(*
(/
(/
(fma
2.0
(/
(pow (* (fma (* (* k k) t) -0.16666666666666666 t) k) 2.0)
(cos k))
(/ (pow (* (sin k) k) 2.0) (cos k)))
l)
l)
t)))))
double code(double t, double l, double k) {
double t_1 = (1.0 + pow((k / t), 2.0)) + 1.0;
double tmp;
if (((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * t_1) <= 4e+27) {
tmp = 2.0 / (((((((t * t) * t) / l) / l) * sin(k)) * tan(k)) * t_1);
} else {
tmp = 2.0 / (((fma(2.0, (pow((fma(((k * k) * t), -0.16666666666666666, t) * k), 2.0) / cos(k)), (pow((sin(k) * k), 2.0) / cos(k))) / l) / l) * t);
}
return tmp;
}
function code(t, l, k) t_1 = Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) + 1.0) tmp = 0.0 if (Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * t_1) <= 4e+27) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(Float64(t * t) * t) / l) / l) * sin(k)) * tan(k)) * t_1)); else tmp = Float64(2.0 / Float64(Float64(Float64(fma(2.0, Float64((Float64(fma(Float64(Float64(k * k) * t), -0.16666666666666666, t) * k) ^ 2.0) / cos(k)), Float64((Float64(sin(k) * k) ^ 2.0) / cos(k))) / l) / l) * t)); end return tmp end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], 4e+27], N[(2.0 / N[(N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(2.0 * N[(N[Power[N[(N[(N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision] * -0.16666666666666666 + t), $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\\
\mathbf{if}\;\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot t\_1 \leq 4 \cdot 10^{+27}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\frac{\left(t \cdot t\right) \cdot t}{\ell}}{\ell} \cdot \sin k\right) \cdot \tan k\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{\mathsf{fma}\left(2, \frac{{\left(\mathsf{fma}\left(\left(k \cdot k\right) \cdot t, -0.16666666666666666, t\right) \cdot k\right)}^{2}}{\cos k}, \frac{{\left(\sin k \cdot k\right)}^{2}}{\cos k}\right)}{\ell}}{\ell} \cdot t}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64))) < 4.0000000000000001e27Initial program 84.1%
Applied rewrites87.0%
if 4.0000000000000001e27 < (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64))) Initial program 30.7%
Taylor expanded in t around 0
Applied rewrites54.0%
Taylor expanded in l around 0
Applied rewrites61.5%
Applied rewrites73.4%
Taylor expanded in k around 0
Applied rewrites67.4%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (cos k) l)))
(if (<= t 3.6e-39)
(/ 2.0 (* (/ (/ (pow (* (sin k) k) 2.0) t_1) l) t))
(if (<= t 2.1e+139)
(/
2.0
(*
(* (* (/ (/ (* (* t t) t) l) l) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t) 2.0)) 1.0)))
(/ 2.0 (* (/ (/ (* (pow (* (sin k) t) 2.0) 2.0) t_1) l) t))))))
double code(double t, double l, double k) {
double t_1 = cos(k) * l;
double tmp;
if (t <= 3.6e-39) {
tmp = 2.0 / (((pow((sin(k) * k), 2.0) / t_1) / l) * t);
} else if (t <= 2.1e+139) {
tmp = 2.0 / (((((((t * t) * t) / l) / l) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) + 1.0));
} else {
tmp = 2.0 / ((((pow((sin(k) * t), 2.0) * 2.0) / t_1) / l) * t);
}
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 = cos(k) * l
if (t <= 3.6d-39) then
tmp = 2.0d0 / (((((sin(k) * k) ** 2.0d0) / t_1) / l) * t)
else if (t <= 2.1d+139) then
tmp = 2.0d0 / (((((((t * t) * t) / l) / l) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) + 1.0d0))
else
tmp = 2.0d0 / ((((((sin(k) * t) ** 2.0d0) * 2.0d0) / t_1) / l) * t)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(k) * l;
double tmp;
if (t <= 3.6e-39) {
tmp = 2.0 / (((Math.pow((Math.sin(k) * k), 2.0) / t_1) / l) * t);
} else if (t <= 2.1e+139) {
tmp = 2.0 / (((((((t * t) * t) / l) / l) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) + 1.0));
} else {
tmp = 2.0 / ((((Math.pow((Math.sin(k) * t), 2.0) * 2.0) / t_1) / l) * t);
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(k) * l tmp = 0 if t <= 3.6e-39: tmp = 2.0 / (((math.pow((math.sin(k) * k), 2.0) / t_1) / l) * t) elif t <= 2.1e+139: tmp = 2.0 / (((((((t * t) * t) / l) / l) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) + 1.0)) else: tmp = 2.0 / ((((math.pow((math.sin(k) * t), 2.0) * 2.0) / t_1) / l) * t) return tmp
function code(t, l, k) t_1 = Float64(cos(k) * l) tmp = 0.0 if (t <= 3.6e-39) tmp = Float64(2.0 / Float64(Float64(Float64((Float64(sin(k) * k) ^ 2.0) / t_1) / l) * t)); elseif (t <= 2.1e+139) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(Float64(t * t) * t) / l) / l) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64((Float64(sin(k) * t) ^ 2.0) * 2.0) / t_1) / l) * t)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(k) * l; tmp = 0.0; if (t <= 3.6e-39) tmp = 2.0 / (((((sin(k) * k) ^ 2.0) / t_1) / l) * t); elseif (t <= 2.1e+139) tmp = 2.0 / (((((((t * t) * t) / l) / l) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) + 1.0)); else tmp = 2.0 / ((((((sin(k) * t) ^ 2.0) * 2.0) / t_1) / l) * t); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision]}, If[LessEqual[t, 3.6e-39], N[(2.0 / N[(N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / t$95$1), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.1e+139], N[(2.0 / N[(N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / t$95$1), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos k \cdot \ell\\
\mathbf{if}\;t \leq 3.6 \cdot 10^{-39}:\\
\;\;\;\;\frac{2}{\frac{\frac{{\left(\sin k \cdot k\right)}^{2}}{t\_1}}{\ell} \cdot t}\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{+139}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\frac{\left(t \cdot t\right) \cdot t}{\ell}}{\ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{{\left(\sin k \cdot t\right)}^{2} \cdot 2}{t\_1}}{\ell} \cdot t}\\
\end{array}
\end{array}
if t < 3.6000000000000001e-39Initial program 49.9%
Taylor expanded in t around 0
Applied rewrites67.8%
Taylor expanded in l around 0
Applied rewrites73.5%
Applied rewrites81.2%
Taylor expanded in t around 0
Applied rewrites68.0%
if 3.6000000000000001e-39 < t < 2.0999999999999999e139Initial program 70.1%
Applied rewrites73.9%
if 2.0999999999999999e139 < t Initial program 61.7%
Taylor expanded in t around 0
Applied rewrites65.5%
Taylor expanded in l around 0
Applied rewrites75.1%
Applied rewrites85.0%
Taylor expanded in t around inf
Applied rewrites84.7%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (cos k) l)))
(if (<= t 3.6e-39)
(/ 2.0 (* (/ (/ (pow (* (sin k) k) 2.0) t_1) l) t))
(if (<= t 2.1e+139)
(/
2.0
(*
(* (/ (* (* (* t t) t) (sin k)) (* l l)) (tan k))
(+ (+ 1.0 (pow (/ k t) 2.0)) 1.0)))
(/ 2.0 (* (/ (/ (* (pow (* (sin k) t) 2.0) 2.0) t_1) l) t))))))
double code(double t, double l, double k) {
double t_1 = cos(k) * l;
double tmp;
if (t <= 3.6e-39) {
tmp = 2.0 / (((pow((sin(k) * k), 2.0) / t_1) / l) * t);
} else if (t <= 2.1e+139) {
tmp = 2.0 / ((((((t * t) * t) * sin(k)) / (l * l)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) + 1.0));
} else {
tmp = 2.0 / ((((pow((sin(k) * t), 2.0) * 2.0) / t_1) / l) * t);
}
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 = cos(k) * l
if (t <= 3.6d-39) then
tmp = 2.0d0 / (((((sin(k) * k) ** 2.0d0) / t_1) / l) * t)
else if (t <= 2.1d+139) then
tmp = 2.0d0 / ((((((t * t) * t) * sin(k)) / (l * l)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) + 1.0d0))
else
tmp = 2.0d0 / ((((((sin(k) * t) ** 2.0d0) * 2.0d0) / t_1) / l) * t)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(k) * l;
double tmp;
if (t <= 3.6e-39) {
tmp = 2.0 / (((Math.pow((Math.sin(k) * k), 2.0) / t_1) / l) * t);
} else if (t <= 2.1e+139) {
tmp = 2.0 / ((((((t * t) * t) * Math.sin(k)) / (l * l)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) + 1.0));
} else {
tmp = 2.0 / ((((Math.pow((Math.sin(k) * t), 2.0) * 2.0) / t_1) / l) * t);
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(k) * l tmp = 0 if t <= 3.6e-39: tmp = 2.0 / (((math.pow((math.sin(k) * k), 2.0) / t_1) / l) * t) elif t <= 2.1e+139: tmp = 2.0 / ((((((t * t) * t) * math.sin(k)) / (l * l)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) + 1.0)) else: tmp = 2.0 / ((((math.pow((math.sin(k) * t), 2.0) * 2.0) / t_1) / l) * t) return tmp
function code(t, l, k) t_1 = Float64(cos(k) * l) tmp = 0.0 if (t <= 3.6e-39) tmp = Float64(2.0 / Float64(Float64(Float64((Float64(sin(k) * k) ^ 2.0) / t_1) / l) * t)); elseif (t <= 2.1e+139) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(t * t) * t) * sin(k)) / Float64(l * l)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) + 1.0))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64((Float64(sin(k) * t) ^ 2.0) * 2.0) / t_1) / l) * t)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(k) * l; tmp = 0.0; if (t <= 3.6e-39) tmp = 2.0 / (((((sin(k) * k) ^ 2.0) / t_1) / l) * t); elseif (t <= 2.1e+139) tmp = 2.0 / ((((((t * t) * t) * sin(k)) / (l * l)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) + 1.0)); else tmp = 2.0 / ((((((sin(k) * t) ^ 2.0) * 2.0) / t_1) / l) * t); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision]}, If[LessEqual[t, 3.6e-39], N[(2.0 / N[(N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / t$95$1), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.1e+139], N[(2.0 / N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / t$95$1), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos k \cdot \ell\\
\mathbf{if}\;t \leq 3.6 \cdot 10^{-39}:\\
\;\;\;\;\frac{2}{\frac{\frac{{\left(\sin k \cdot k\right)}^{2}}{t\_1}}{\ell} \cdot t}\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{+139}:\\
\;\;\;\;\frac{2}{\left(\frac{\left(\left(t \cdot t\right) \cdot t\right) \cdot \sin k}{\ell \cdot \ell} \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{{\left(\sin k \cdot t\right)}^{2} \cdot 2}{t\_1}}{\ell} \cdot t}\\
\end{array}
\end{array}
if t < 3.6000000000000001e-39Initial program 49.9%
Taylor expanded in t around 0
Applied rewrites67.8%
Taylor expanded in l around 0
Applied rewrites73.5%
Applied rewrites81.2%
Taylor expanded in t around 0
Applied rewrites68.0%
if 3.6000000000000001e-39 < t < 2.0999999999999999e139Initial program 70.1%
Applied rewrites72.3%
if 2.0999999999999999e139 < t Initial program 61.7%
Taylor expanded in t around 0
Applied rewrites65.5%
Taylor expanded in l around 0
Applied rewrites75.1%
Applied rewrites85.0%
Taylor expanded in t around inf
Applied rewrites84.7%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (cos k) l)))
(if (<= t 1.6e-28)
(/ 2.0 (* (/ (/ (pow (* (sin k) k) 2.0) t_1) l) t))
(if (<= t 2.1e+139)
(/ 2.0 (* (* (/ (/ (* (* (* t t) t) k) l) l) (tan k)) 2.0))
(/ 2.0 (* (/ (/ (* (pow (* (sin k) t) 2.0) 2.0) t_1) l) t))))))
double code(double t, double l, double k) {
double t_1 = cos(k) * l;
double tmp;
if (t <= 1.6e-28) {
tmp = 2.0 / (((pow((sin(k) * k), 2.0) / t_1) / l) * t);
} else if (t <= 2.1e+139) {
tmp = 2.0 / (((((((t * t) * t) * k) / l) / l) * tan(k)) * 2.0);
} else {
tmp = 2.0 / ((((pow((sin(k) * t), 2.0) * 2.0) / t_1) / l) * t);
}
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 = cos(k) * l
if (t <= 1.6d-28) then
tmp = 2.0d0 / (((((sin(k) * k) ** 2.0d0) / t_1) / l) * t)
else if (t <= 2.1d+139) then
tmp = 2.0d0 / (((((((t * t) * t) * k) / l) / l) * tan(k)) * 2.0d0)
else
tmp = 2.0d0 / ((((((sin(k) * t) ** 2.0d0) * 2.0d0) / t_1) / l) * t)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = Math.cos(k) * l;
double tmp;
if (t <= 1.6e-28) {
tmp = 2.0 / (((Math.pow((Math.sin(k) * k), 2.0) / t_1) / l) * t);
} else if (t <= 2.1e+139) {
tmp = 2.0 / (((((((t * t) * t) * k) / l) / l) * Math.tan(k)) * 2.0);
} else {
tmp = 2.0 / ((((Math.pow((Math.sin(k) * t), 2.0) * 2.0) / t_1) / l) * t);
}
return tmp;
}
def code(t, l, k): t_1 = math.cos(k) * l tmp = 0 if t <= 1.6e-28: tmp = 2.0 / (((math.pow((math.sin(k) * k), 2.0) / t_1) / l) * t) elif t <= 2.1e+139: tmp = 2.0 / (((((((t * t) * t) * k) / l) / l) * math.tan(k)) * 2.0) else: tmp = 2.0 / ((((math.pow((math.sin(k) * t), 2.0) * 2.0) / t_1) / l) * t) return tmp
function code(t, l, k) t_1 = Float64(cos(k) * l) tmp = 0.0 if (t <= 1.6e-28) tmp = Float64(2.0 / Float64(Float64(Float64((Float64(sin(k) * k) ^ 2.0) / t_1) / l) * t)); elseif (t <= 2.1e+139) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(Float64(t * t) * t) * k) / l) / l) * tan(k)) * 2.0)); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64((Float64(sin(k) * t) ^ 2.0) * 2.0) / t_1) / l) * t)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = cos(k) * l; tmp = 0.0; if (t <= 1.6e-28) tmp = 2.0 / (((((sin(k) * k) ^ 2.0) / t_1) / l) * t); elseif (t <= 2.1e+139) tmp = 2.0 / (((((((t * t) * t) * k) / l) / l) * tan(k)) * 2.0); else tmp = 2.0 / ((((((sin(k) * t) ^ 2.0) * 2.0) / t_1) / l) * t); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision]}, If[LessEqual[t, 1.6e-28], N[(2.0 / N[(N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / t$95$1), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.1e+139], N[(2.0 / N[(N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / t$95$1), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos k \cdot \ell\\
\mathbf{if}\;t \leq 1.6 \cdot 10^{-28}:\\
\;\;\;\;\frac{2}{\frac{\frac{{\left(\sin k \cdot k\right)}^{2}}{t\_1}}{\ell} \cdot t}\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{+139}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{\left(\left(t \cdot t\right) \cdot t\right) \cdot k}{\ell}}{\ell} \cdot \tan k\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{{\left(\sin k \cdot t\right)}^{2} \cdot 2}{t\_1}}{\ell} \cdot t}\\
\end{array}
\end{array}
if t < 1.59999999999999991e-28Initial program 50.2%
Taylor expanded in t around 0
Applied rewrites67.9%
Taylor expanded in l around 0
Applied rewrites73.5%
Applied rewrites81.2%
Taylor expanded in t around 0
Applied rewrites68.0%
if 1.59999999999999991e-28 < t < 2.0999999999999999e139Initial program 70.0%
Taylor expanded in t around 0
Applied rewrites55.7%
Applied rewrites57.2%
Taylor expanded in k around 0
Applied rewrites51.7%
Taylor expanded in t around inf
Applied rewrites67.0%
if 2.0999999999999999e139 < t Initial program 61.7%
Taylor expanded in t around 0
Applied rewrites65.5%
Taylor expanded in l around 0
Applied rewrites75.1%
Applied rewrites85.0%
Taylor expanded in t around inf
Applied rewrites84.7%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (* (* t t) t) k)))
(if (<= t 1.6e-28)
(/ 2.0 (* (/ (/ (pow (* (sin k) k) 2.0) (* (cos k) l)) l) t))
(if (<= t 9e+54)
(/ 2.0 (* (* (/ (/ t_1 l) l) (tan k)) 2.0))
(if (<= t 1.16e+240)
(/ (* (* l l) (cos k)) (* (pow (* (sin k) t) 2.0) t))
(* (/ l (* k t_1)) l))))))
double code(double t, double l, double k) {
double t_1 = ((t * t) * t) * k;
double tmp;
if (t <= 1.6e-28) {
tmp = 2.0 / (((pow((sin(k) * k), 2.0) / (cos(k) * l)) / l) * t);
} else if (t <= 9e+54) {
tmp = 2.0 / ((((t_1 / l) / l) * tan(k)) * 2.0);
} else if (t <= 1.16e+240) {
tmp = ((l * l) * cos(k)) / (pow((sin(k) * t), 2.0) * t);
} else {
tmp = (l / (k * t_1)) * l;
}
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 * t) * t) * k
if (t <= 1.6d-28) then
tmp = 2.0d0 / (((((sin(k) * k) ** 2.0d0) / (cos(k) * l)) / l) * t)
else if (t <= 9d+54) then
tmp = 2.0d0 / ((((t_1 / l) / l) * tan(k)) * 2.0d0)
else if (t <= 1.16d+240) then
tmp = ((l * l) * cos(k)) / (((sin(k) * t) ** 2.0d0) * t)
else
tmp = (l / (k * t_1)) * l
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = ((t * t) * t) * k;
double tmp;
if (t <= 1.6e-28) {
tmp = 2.0 / (((Math.pow((Math.sin(k) * k), 2.0) / (Math.cos(k) * l)) / l) * t);
} else if (t <= 9e+54) {
tmp = 2.0 / ((((t_1 / l) / l) * Math.tan(k)) * 2.0);
} else if (t <= 1.16e+240) {
tmp = ((l * l) * Math.cos(k)) / (Math.pow((Math.sin(k) * t), 2.0) * t);
} else {
tmp = (l / (k * t_1)) * l;
}
return tmp;
}
def code(t, l, k): t_1 = ((t * t) * t) * k tmp = 0 if t <= 1.6e-28: tmp = 2.0 / (((math.pow((math.sin(k) * k), 2.0) / (math.cos(k) * l)) / l) * t) elif t <= 9e+54: tmp = 2.0 / ((((t_1 / l) / l) * math.tan(k)) * 2.0) elif t <= 1.16e+240: tmp = ((l * l) * math.cos(k)) / (math.pow((math.sin(k) * t), 2.0) * t) else: tmp = (l / (k * t_1)) * l return tmp
function code(t, l, k) t_1 = Float64(Float64(Float64(t * t) * t) * k) tmp = 0.0 if (t <= 1.6e-28) tmp = Float64(2.0 / Float64(Float64(Float64((Float64(sin(k) * k) ^ 2.0) / Float64(cos(k) * l)) / l) * t)); elseif (t <= 9e+54) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(t_1 / l) / l) * tan(k)) * 2.0)); elseif (t <= 1.16e+240) tmp = Float64(Float64(Float64(l * l) * cos(k)) / Float64((Float64(sin(k) * t) ^ 2.0) * t)); else tmp = Float64(Float64(l / Float64(k * t_1)) * l); end return tmp end
function tmp_2 = code(t, l, k) t_1 = ((t * t) * t) * k; tmp = 0.0; if (t <= 1.6e-28) tmp = 2.0 / (((((sin(k) * k) ^ 2.0) / (cos(k) * l)) / l) * t); elseif (t <= 9e+54) tmp = 2.0 / ((((t_1 / l) / l) * tan(k)) * 2.0); elseif (t <= 1.16e+240) tmp = ((l * l) * cos(k)) / (((sin(k) * t) ^ 2.0) * t); else tmp = (l / (k * t_1)) * l; end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision]}, If[LessEqual[t, 1.6e-28], N[(2.0 / N[(N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9e+54], N[(2.0 / N[(N[(N[(N[(t$95$1 / l), $MachinePrecision] / l), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.16e+240], N[(N[(N[(l * l), $MachinePrecision] * N[Cos[k], $MachinePrecision]), $MachinePrecision] / N[(N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(l / N[(k * t$95$1), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(t \cdot t\right) \cdot t\right) \cdot k\\
\mathbf{if}\;t \leq 1.6 \cdot 10^{-28}:\\
\;\;\;\;\frac{2}{\frac{\frac{{\left(\sin k \cdot k\right)}^{2}}{\cos k \cdot \ell}}{\ell} \cdot t}\\
\mathbf{elif}\;t \leq 9 \cdot 10^{+54}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{t\_1}{\ell}}{\ell} \cdot \tan k\right) \cdot 2}\\
\mathbf{elif}\;t \leq 1.16 \cdot 10^{+240}:\\
\;\;\;\;\frac{\left(\ell \cdot \ell\right) \cdot \cos k}{{\left(\sin k \cdot t\right)}^{2} \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{k \cdot t\_1} \cdot \ell\\
\end{array}
\end{array}
if t < 1.59999999999999991e-28Initial program 50.2%
Taylor expanded in t around 0
Applied rewrites67.9%
Taylor expanded in l around 0
Applied rewrites73.5%
Applied rewrites81.2%
Taylor expanded in t around 0
Applied rewrites68.0%
if 1.59999999999999991e-28 < t < 8.99999999999999968e54Initial program 75.8%
Taylor expanded in t around 0
Applied rewrites63.1%
Applied rewrites64.8%
Taylor expanded in k around 0
Applied rewrites55.0%
Taylor expanded in t around inf
Applied rewrites67.3%
if 8.99999999999999968e54 < t < 1.1600000000000001e240Initial program 60.5%
Taylor expanded in t around inf
Applied rewrites52.5%
Applied rewrites73.2%
if 1.1600000000000001e240 < t Initial program 68.0%
Taylor expanded in k around 0
Applied rewrites56.0%
Applied rewrites65.4%
Applied rewrites65.4%
Applied rewrites77.6%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* (* (* t t) t) k)) (t_2 (* (* l l) (cos k))))
(if (<= t 1.6e-28)
(/ 2.0 (* (/ (pow (* (sin k) k) 2.0) t_2) t))
(if (<= t 9e+54)
(/ 2.0 (* (* (/ (/ t_1 l) l) (tan k)) 2.0))
(if (<= t 1.16e+240)
(/ t_2 (* (pow (* (sin k) t) 2.0) t))
(* (/ l (* k t_1)) l))))))
double code(double t, double l, double k) {
double t_1 = ((t * t) * t) * k;
double t_2 = (l * l) * cos(k);
double tmp;
if (t <= 1.6e-28) {
tmp = 2.0 / ((pow((sin(k) * k), 2.0) / t_2) * t);
} else if (t <= 9e+54) {
tmp = 2.0 / ((((t_1 / l) / l) * tan(k)) * 2.0);
} else if (t <= 1.16e+240) {
tmp = t_2 / (pow((sin(k) * t), 2.0) * t);
} else {
tmp = (l / (k * t_1)) * l;
}
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 = ((t * t) * t) * k
t_2 = (l * l) * cos(k)
if (t <= 1.6d-28) then
tmp = 2.0d0 / ((((sin(k) * k) ** 2.0d0) / t_2) * t)
else if (t <= 9d+54) then
tmp = 2.0d0 / ((((t_1 / l) / l) * tan(k)) * 2.0d0)
else if (t <= 1.16d+240) then
tmp = t_2 / (((sin(k) * t) ** 2.0d0) * t)
else
tmp = (l / (k * t_1)) * l
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = ((t * t) * t) * k;
double t_2 = (l * l) * Math.cos(k);
double tmp;
if (t <= 1.6e-28) {
tmp = 2.0 / ((Math.pow((Math.sin(k) * k), 2.0) / t_2) * t);
} else if (t <= 9e+54) {
tmp = 2.0 / ((((t_1 / l) / l) * Math.tan(k)) * 2.0);
} else if (t <= 1.16e+240) {
tmp = t_2 / (Math.pow((Math.sin(k) * t), 2.0) * t);
} else {
tmp = (l / (k * t_1)) * l;
}
return tmp;
}
def code(t, l, k): t_1 = ((t * t) * t) * k t_2 = (l * l) * math.cos(k) tmp = 0 if t <= 1.6e-28: tmp = 2.0 / ((math.pow((math.sin(k) * k), 2.0) / t_2) * t) elif t <= 9e+54: tmp = 2.0 / ((((t_1 / l) / l) * math.tan(k)) * 2.0) elif t <= 1.16e+240: tmp = t_2 / (math.pow((math.sin(k) * t), 2.0) * t) else: tmp = (l / (k * t_1)) * l return tmp
function code(t, l, k) t_1 = Float64(Float64(Float64(t * t) * t) * k) t_2 = Float64(Float64(l * l) * cos(k)) tmp = 0.0 if (t <= 1.6e-28) tmp = Float64(2.0 / Float64(Float64((Float64(sin(k) * k) ^ 2.0) / t_2) * t)); elseif (t <= 9e+54) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(t_1 / l) / l) * tan(k)) * 2.0)); elseif (t <= 1.16e+240) tmp = Float64(t_2 / Float64((Float64(sin(k) * t) ^ 2.0) * t)); else tmp = Float64(Float64(l / Float64(k * t_1)) * l); end return tmp end
function tmp_2 = code(t, l, k) t_1 = ((t * t) * t) * k; t_2 = (l * l) * cos(k); tmp = 0.0; if (t <= 1.6e-28) tmp = 2.0 / ((((sin(k) * k) ^ 2.0) / t_2) * t); elseif (t <= 9e+54) tmp = 2.0 / ((((t_1 / l) / l) * tan(k)) * 2.0); elseif (t <= 1.16e+240) tmp = t_2 / (((sin(k) * t) ^ 2.0) * t); else tmp = (l / (k * t_1)) * l; end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision]}, Block[{t$95$2 = N[(N[(l * l), $MachinePrecision] * N[Cos[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 1.6e-28], N[(2.0 / N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / t$95$2), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9e+54], N[(2.0 / N[(N[(N[(N[(t$95$1 / l), $MachinePrecision] / l), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.16e+240], N[(t$95$2 / N[(N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(l / N[(k * t$95$1), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(t \cdot t\right) \cdot t\right) \cdot k\\
t_2 := \left(\ell \cdot \ell\right) \cdot \cos k\\
\mathbf{if}\;t \leq 1.6 \cdot 10^{-28}:\\
\;\;\;\;\frac{2}{\frac{{\left(\sin k \cdot k\right)}^{2}}{t\_2} \cdot t}\\
\mathbf{elif}\;t \leq 9 \cdot 10^{+54}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{t\_1}{\ell}}{\ell} \cdot \tan k\right) \cdot 2}\\
\mathbf{elif}\;t \leq 1.16 \cdot 10^{+240}:\\
\;\;\;\;\frac{t\_2}{{\left(\sin k \cdot t\right)}^{2} \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{k \cdot t\_1} \cdot \ell\\
\end{array}
\end{array}
if t < 1.59999999999999991e-28Initial program 50.2%
Taylor expanded in t around 0
Applied rewrites67.9%
Taylor expanded in t around 0
Applied rewrites62.6%
if 1.59999999999999991e-28 < t < 8.99999999999999968e54Initial program 75.8%
Taylor expanded in t around 0
Applied rewrites63.1%
Applied rewrites64.8%
Taylor expanded in k around 0
Applied rewrites55.0%
Taylor expanded in t around inf
Applied rewrites67.3%
if 8.99999999999999968e54 < t < 1.1600000000000001e240Initial program 60.5%
Taylor expanded in t around inf
Applied rewrites52.5%
Applied rewrites73.2%
if 1.1600000000000001e240 < t Initial program 68.0%
Taylor expanded in k around 0
Applied rewrites56.0%
Applied rewrites65.4%
Applied rewrites65.4%
Applied rewrites77.6%
(FPCore (t l k)
:precision binary64
(if (<= k 8e+134)
(/ 2.0 (* (* (/ (/ (* (* (* t t) t) (sin k)) l) l) (tan k)) 2.0))
(/
2.0
(*
(/
(/
(*
(fma
(fma (* (* t t) (- -0.3333333333333333 -0.5)) 2.0 1.0)
(* k k)
(* (* t t) 2.0))
(* k k))
l)
l)
t))))
double code(double t, double l, double k) {
double tmp;
if (k <= 8e+134) {
tmp = 2.0 / (((((((t * t) * t) * sin(k)) / l) / l) * tan(k)) * 2.0);
} else {
tmp = 2.0 / ((((fma(fma(((t * t) * (-0.3333333333333333 - -0.5)), 2.0, 1.0), (k * k), ((t * t) * 2.0)) * (k * k)) / l) / l) * t);
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (k <= 8e+134) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(Float64(t * t) * t) * sin(k)) / l) / l) * tan(k)) * 2.0)); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(fma(fma(Float64(Float64(t * t) * Float64(-0.3333333333333333 - -0.5)), 2.0, 1.0), Float64(k * k), Float64(Float64(t * t) * 2.0)) * Float64(k * k)) / l) / l) * t)); end return tmp end
code[t_, l_, k_] := If[LessEqual[k, 8e+134], N[(2.0 / N[(N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] * N[(-0.3333333333333333 - -0.5), $MachinePrecision]), $MachinePrecision] * 2.0 + 1.0), $MachinePrecision] * N[(k * k), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 8 \cdot 10^{+134}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{\left(\left(t \cdot t\right) \cdot t\right) \cdot \sin k}{\ell}}{\ell} \cdot \tan k\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\left(t \cdot t\right) \cdot \left(-0.3333333333333333 - -0.5\right), 2, 1\right), k \cdot k, \left(t \cdot t\right) \cdot 2\right) \cdot \left(k \cdot k\right)}{\ell}}{\ell} \cdot t}\\
\end{array}
\end{array}
if k < 7.99999999999999937e134Initial program 55.9%
Taylor expanded in t around 0
Applied rewrites26.9%
Applied rewrites28.1%
Taylor expanded in t around inf
Applied rewrites62.0%
if 7.99999999999999937e134 < k Initial program 46.5%
Taylor expanded in t around 0
Applied rewrites57.8%
Taylor expanded in l around 0
Applied rewrites62.6%
Applied rewrites66.9%
Taylor expanded in k around 0
Applied rewrites63.0%
(FPCore (t l k)
:precision binary64
(if (<= k 3e-118)
(/ 2.0 (* (* (/ (/ (* (* (* t t) t) k) l) l) (tan k)) 2.0))
(/
2.0
(*
(/
(/
(*
(fma
(fma (* (* t t) (- -0.3333333333333333 -0.5)) 2.0 1.0)
(* k k)
(* (* t t) 2.0))
(* k k))
l)
l)
t))))
double code(double t, double l, double k) {
double tmp;
if (k <= 3e-118) {
tmp = 2.0 / (((((((t * t) * t) * k) / l) / l) * tan(k)) * 2.0);
} else {
tmp = 2.0 / ((((fma(fma(((t * t) * (-0.3333333333333333 - -0.5)), 2.0, 1.0), (k * k), ((t * t) * 2.0)) * (k * k)) / l) / l) * t);
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (k <= 3e-118) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(Float64(t * t) * t) * k) / l) / l) * tan(k)) * 2.0)); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(fma(fma(Float64(Float64(t * t) * Float64(-0.3333333333333333 - -0.5)), 2.0, 1.0), Float64(k * k), Float64(Float64(t * t) * 2.0)) * Float64(k * k)) / l) / l) * t)); end return tmp end
code[t_, l_, k_] := If[LessEqual[k, 3e-118], N[(2.0 / N[(N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] * N[(-0.3333333333333333 - -0.5), $MachinePrecision]), $MachinePrecision] * 2.0 + 1.0), $MachinePrecision] * N[(k * k), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3 \cdot 10^{-118}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{\left(\left(t \cdot t\right) \cdot t\right) \cdot k}{\ell}}{\ell} \cdot \tan k\right) \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\left(t \cdot t\right) \cdot \left(-0.3333333333333333 - -0.5\right), 2, 1\right), k \cdot k, \left(t \cdot t\right) \cdot 2\right) \cdot \left(k \cdot k\right)}{\ell}}{\ell} \cdot t}\\
\end{array}
\end{array}
if k < 3.00000000000000018e-118Initial program 56.0%
Taylor expanded in t around 0
Applied rewrites26.7%
Applied rewrites28.0%
Taylor expanded in k around 0
Applied rewrites26.5%
Taylor expanded in t around inf
Applied rewrites61.7%
if 3.00000000000000018e-118 < k Initial program 52.0%
Taylor expanded in t around 0
Applied rewrites69.2%
Taylor expanded in l around 0
Applied rewrites73.4%
Applied rewrites79.9%
Taylor expanded in k around 0
Applied rewrites65.2%
(FPCore (t l k)
:precision binary64
(if (<= k 2.5e-143)
(* (/ l (* k (* (* (* t t) t) k))) l)
(/
2.0
(*
(/
(/
(*
(fma
(fma (* (* t t) (- -0.3333333333333333 -0.5)) 2.0 1.0)
(* k k)
(* (* t t) 2.0))
(* k k))
l)
l)
t))))
double code(double t, double l, double k) {
double tmp;
if (k <= 2.5e-143) {
tmp = (l / (k * (((t * t) * t) * k))) * l;
} else {
tmp = 2.0 / ((((fma(fma(((t * t) * (-0.3333333333333333 - -0.5)), 2.0, 1.0), (k * k), ((t * t) * 2.0)) * (k * k)) / l) / l) * t);
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (k <= 2.5e-143) tmp = Float64(Float64(l / Float64(k * Float64(Float64(Float64(t * t) * t) * k))) * l); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(fma(fma(Float64(Float64(t * t) * Float64(-0.3333333333333333 - -0.5)), 2.0, 1.0), Float64(k * k), Float64(Float64(t * t) * 2.0)) * Float64(k * k)) / l) / l) * t)); end return tmp end
code[t_, l_, k_] := If[LessEqual[k, 2.5e-143], N[(N[(l / N[(k * N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] * N[(-0.3333333333333333 - -0.5), $MachinePrecision]), $MachinePrecision] * 2.0 + 1.0), $MachinePrecision] * N[(k * k), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.5 \cdot 10^{-143}:\\
\;\;\;\;\frac{\ell}{k \cdot \left(\left(\left(t \cdot t\right) \cdot t\right) \cdot k\right)} \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\left(t \cdot t\right) \cdot \left(-0.3333333333333333 - -0.5\right), 2, 1\right), k \cdot k, \left(t \cdot t\right) \cdot 2\right) \cdot \left(k \cdot k\right)}{\ell}}{\ell} \cdot t}\\
\end{array}
\end{array}
if k < 2.5000000000000001e-143Initial program 55.6%
Taylor expanded in k around 0
Applied rewrites49.6%
Applied rewrites54.6%
Applied rewrites54.6%
Applied rewrites61.3%
if 2.5000000000000001e-143 < k Initial program 52.9%
Taylor expanded in t around 0
Applied rewrites69.3%
Taylor expanded in l around 0
Applied rewrites73.9%
Applied rewrites80.4%
Taylor expanded in k around 0
Applied rewrites66.2%
(FPCore (t l k) :precision binary64 (if (<= k 2.2e+126) (* (/ l (* k (* (* (* t t) t) k))) l) (/ 2.0 (* (/ (* (* k k) t) (* l l)) (* k k)))))
double code(double t, double l, double k) {
double tmp;
if (k <= 2.2e+126) {
tmp = (l / (k * (((t * t) * t) * k))) * l;
} else {
tmp = 2.0 / ((((k * k) * t) / (l * l)) * (k * k));
}
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 (k <= 2.2d+126) then
tmp = (l / (k * (((t * t) * t) * k))) * l
else
tmp = 2.0d0 / ((((k * k) * t) / (l * l)) * (k * k))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 2.2e+126) {
tmp = (l / (k * (((t * t) * t) * k))) * l;
} else {
tmp = 2.0 / ((((k * k) * t) / (l * l)) * (k * k));
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 2.2e+126: tmp = (l / (k * (((t * t) * t) * k))) * l else: tmp = 2.0 / ((((k * k) * t) / (l * l)) * (k * k)) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 2.2e+126) tmp = Float64(Float64(l / Float64(k * Float64(Float64(Float64(t * t) * t) * k))) * l); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k * k) * t) / Float64(l * l)) * Float64(k * k))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 2.2e+126) tmp = (l / (k * (((t * t) * t) * k))) * l; else tmp = 2.0 / ((((k * k) * t) / (l * l)) * (k * k)); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 2.2e+126], N[(N[(l / N[(k * N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(k * k), $MachinePrecision] * t), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.2 \cdot 10^{+126}:\\
\;\;\;\;\frac{\ell}{k \cdot \left(\left(\left(t \cdot t\right) \cdot t\right) \cdot k\right)} \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\left(k \cdot k\right) \cdot t}{\ell \cdot \ell} \cdot \left(k \cdot k\right)}\\
\end{array}
\end{array}
if k < 2.19999999999999999e126Initial program 56.0%
Taylor expanded in k around 0
Applied rewrites51.6%
Applied rewrites55.9%
Applied rewrites55.9%
Applied rewrites60.9%
if 2.19999999999999999e126 < k Initial program 46.3%
Taylor expanded in k around 0
Applied rewrites45.6%
Taylor expanded in t around 0
Applied rewrites60.0%
(FPCore (t l k) :precision binary64 (* (/ l (* k (* (* (* t t) t) k))) l))
double code(double t, double l, double k) {
return (l / (k * (((t * t) * t) * k))) * l;
}
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) * k))) * l
end function
public static double code(double t, double l, double k) {
return (l / (k * (((t * t) * t) * k))) * l;
}
def code(t, l, k): return (l / (k * (((t * t) * t) * k))) * l
function code(t, l, k) return Float64(Float64(l / Float64(k * Float64(Float64(Float64(t * t) * t) * k))) * l) end
function tmp = code(t, l, k) tmp = (l / (k * (((t * t) * t) * k))) * l; end
code[t_, l_, k_] := N[(N[(l / N[(k * N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]
\begin{array}{l}
\\
\frac{\ell}{k \cdot \left(\left(\left(t \cdot t\right) \cdot t\right) \cdot k\right)} \cdot \ell
\end{array}
Initial program 54.6%
Taylor expanded in k around 0
Applied rewrites50.7%
Applied rewrites54.8%
Applied rewrites54.8%
Applied rewrites59.1%
herbie shell --seed 2025134
(FPCore (t l k)
:name "Toniolo and Linder, Equation (10+)"
:precision binary64
(/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (+ (+ 1.0 (pow (/ k t) 2.0)) 1.0))))