
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (+ (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) + 1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) + 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) + 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) + 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) + 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) + 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 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
(/
(*
(/ t l)
(/ (fma (pow (* (sin k) t) 2.0) 2.0 (pow (* (sin k) k) 2.0)) (cos k)))
l)))
double code(double t, double l, double k) {
return 2.0 / (((t / l) * (fma(pow((sin(k) * t), 2.0), 2.0, pow((sin(k) * k), 2.0)) / cos(k))) / l);
}
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(t / l) * Float64(fma((Float64(sin(k) * t) ^ 2.0), 2.0, (Float64(sin(k) * k) ^ 2.0)) / cos(k))) / l)) end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(t / l), $MachinePrecision] * N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0 + N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\frac{\frac{t}{\ell} \cdot \frac{\mathsf{fma}\left({\left(\sin k \cdot t\right)}^{2}, 2, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k}}{\ell}}
\end{array}
Initial program 60.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.3%
Applied rewrites77.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.7
Applied rewrites81.7%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
associate-*l/N/A
Applied rewrites84.2%
(FPCore (t l k)
:precision binary64
(if (<=
(*
(* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t) 2.0)) 1.0))
5e+302)
(/
(/ 2.0 (* (/ (/ (* (* t t) t) l) l) (* (sin k) (tan k))))
(fma (/ k t) (/ k t) 2.0))
(/ 2.0 (* (/ (/ t l) l) (/ (* (pow (* k t) 2.0) 2.0) (cos k))))))
double code(double t, double l, double k) {
double tmp;
if (((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) + 1.0)) <= 5e+302) {
tmp = (2.0 / (((((t * t) * t) / l) / l) * (sin(k) * tan(k)))) / fma((k / t), (k / t), 2.0);
} else {
tmp = 2.0 / (((t / l) / l) * ((pow((k * t), 2.0) * 2.0) / cos(k)));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (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)) <= 5e+302) tmp = Float64(Float64(2.0 / Float64(Float64(Float64(Float64(Float64(t * t) * t) / l) / l) * Float64(sin(k) * tan(k)))) / fma(Float64(k / t), Float64(k / t), 2.0)); else tmp = Float64(2.0 / Float64(Float64(Float64(t / l) / l) * Float64(Float64((Float64(k * t) ^ 2.0) * 2.0) / cos(k)))); end return tmp end
code[t_, l_, k_] := 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] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], 5e+302], N[(N[(2.0 / N[(N[(N[(N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * N[(N[Sin[k], $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(k / t), $MachinePrecision] * N[(k / t), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[Power[N[(k * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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) \leq 5 \cdot 10^{+302}:\\
\;\;\;\;\frac{\frac{2}{\frac{\frac{\left(t \cdot t\right) \cdot t}{\ell}}{\ell} \cdot \left(\sin k \cdot \tan k\right)}}{\mathsf{fma}\left(\frac{k}{t}, \frac{k}{t}, 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{t}{\ell}}{\ell} \cdot \frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k}}\\
\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))) < 5e302Initial program 84.8%
Applied rewrites82.1%
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-+l+N/A
unpow2N/A
metadata-evalN/A
lower-fma.f64N/A
lift-/.f64N/A
lift-/.f6482.1
Applied rewrites82.1%
lift-pow.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6482.1
Applied rewrites82.1%
if 5e302 < (*.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 34.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites63.1%
Applied rewrites63.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6471.3
Applied rewrites71.3%
Taylor expanded in k around 0
*-commutativeN/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f6460.2
Applied rewrites60.2%
Final simplification71.4%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (* (sin k) t) 2.0)))
(if (<= (* l l) 5e+232)
(/
2.0
(* (/ t (* l l)) (/ (fma t_1 2.0 (pow (* (sin k) k) 2.0)) (cos k))))
(/ 2.0 (* (/ (/ t l) l) (/ (* t_1 2.0) (cos k)))))))
double code(double t, double l, double k) {
double t_1 = pow((sin(k) * t), 2.0);
double tmp;
if ((l * l) <= 5e+232) {
tmp = 2.0 / ((t / (l * l)) * (fma(t_1, 2.0, pow((sin(k) * k), 2.0)) / cos(k)));
} else {
tmp = 2.0 / (((t / l) / l) * ((t_1 * 2.0) / cos(k)));
}
return tmp;
}
function code(t, l, k) t_1 = Float64(sin(k) * t) ^ 2.0 tmp = 0.0 if (Float64(l * l) <= 5e+232) tmp = Float64(2.0 / Float64(Float64(t / Float64(l * l)) * Float64(fma(t_1, 2.0, (Float64(sin(k) * k) ^ 2.0)) / cos(k)))); else tmp = Float64(2.0 / Float64(Float64(Float64(t / l) / l) * Float64(Float64(t_1 * 2.0) / cos(k)))); end return tmp end
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[N[(l * l), $MachinePrecision], 5e+232], N[(2.0 / N[(N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * 2.0 + N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision] * N[(N[(t$95$1 * 2.0), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\left(\sin k \cdot t\right)}^{2}\\
\mathbf{if}\;\ell \cdot \ell \leq 5 \cdot 10^{+232}:\\
\;\;\;\;\frac{2}{\frac{t}{\ell \cdot \ell} \cdot \frac{\mathsf{fma}\left(t\_1, 2, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{t}{\ell}}{\ell} \cdot \frac{t\_1 \cdot 2}{\cos k}}\\
\end{array}
\end{array}
if (*.f64 l l) < 4.99999999999999987e232Initial program 68.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites86.5%
Applied rewrites87.6%
if 4.99999999999999987e232 < (*.f64 l l) Initial program 41.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites52.7%
Applied rewrites55.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6465.5
Applied rewrites65.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow-prod-downN/A
lift-sin.f64N/A
lift-*.f64N/A
lift-pow.f6466.3
Applied rewrites66.3%
Final simplification81.2%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (* (sin k) t) 2.0)))
(if (<= (* l l) 1e+220)
(/
2.0
(* (/ (fma 2.0 t_1 (pow (* (sin k) k) 2.0)) (* (cos k) (* l l))) t))
(/ 2.0 (* (/ (/ t l) l) (/ (* t_1 2.0) (cos k)))))))
double code(double t, double l, double k) {
double t_1 = pow((sin(k) * t), 2.0);
double tmp;
if ((l * l) <= 1e+220) {
tmp = 2.0 / ((fma(2.0, t_1, pow((sin(k) * k), 2.0)) / (cos(k) * (l * l))) * t);
} else {
tmp = 2.0 / (((t / l) / l) * ((t_1 * 2.0) / cos(k)));
}
return tmp;
}
function code(t, l, k) t_1 = Float64(sin(k) * t) ^ 2.0 tmp = 0.0 if (Float64(l * l) <= 1e+220) tmp = Float64(2.0 / Float64(Float64(fma(2.0, t_1, (Float64(sin(k) * k) ^ 2.0)) / Float64(cos(k) * Float64(l * l))) * t)); else tmp = Float64(2.0 / Float64(Float64(Float64(t / l) / l) * Float64(Float64(t_1 * 2.0) / cos(k)))); end return tmp end
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[N[(l * l), $MachinePrecision], 1e+220], N[(2.0 / N[(N[(N[(2.0 * t$95$1 + N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision] * N[(N[(t$95$1 * 2.0), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\left(\sin k \cdot t\right)}^{2}\\
\mathbf{if}\;\ell \cdot \ell \leq 10^{+220}:\\
\;\;\;\;\frac{2}{\frac{\mathsf{fma}\left(2, t\_1, {\left(\sin k \cdot k\right)}^{2}\right)}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{t}{\ell}}{\ell} \cdot \frac{t\_1 \cdot 2}{\cos k}}\\
\end{array}
\end{array}
if (*.f64 l l) < 1e220Initial program 69.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites86.9%
if 1e220 < (*.f64 l l) Initial program 41.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites52.7%
Applied rewrites56.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6466.4
Applied rewrites66.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow-prod-downN/A
lift-sin.f64N/A
lift-*.f64N/A
lift-pow.f6466.0
Applied rewrites66.0%
Final simplification80.4%
(FPCore (t l k)
:precision binary64
(if (<= t 9.5e+100)
(/
2.0
(/
(* (fma (pow (* (sin k) t) 2.0) 2.0 (pow (* (sin k) k) 2.0)) t)
(* (* (cos k) l) l)))
(/ 2.0 (* (/ (/ t l) l) (/ (* (pow (* k t) 2.0) 2.0) (cos k))))))
double code(double t, double l, double k) {
double tmp;
if (t <= 9.5e+100) {
tmp = 2.0 / ((fma(pow((sin(k) * t), 2.0), 2.0, pow((sin(k) * k), 2.0)) * t) / ((cos(k) * l) * l));
} else {
tmp = 2.0 / (((t / l) / l) * ((pow((k * t), 2.0) * 2.0) / cos(k)));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (t <= 9.5e+100) tmp = Float64(2.0 / Float64(Float64(fma((Float64(sin(k) * t) ^ 2.0), 2.0, (Float64(sin(k) * k) ^ 2.0)) * t) / Float64(Float64(cos(k) * l) * l))); else tmp = Float64(2.0 / Float64(Float64(Float64(t / l) / l) * Float64(Float64((Float64(k * t) ^ 2.0) * 2.0) / cos(k)))); end return tmp end
code[t_, l_, k_] := If[LessEqual[t, 9.5e+100], N[(2.0 / N[(N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0 + N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] / N[(N[(N[Cos[k], $MachinePrecision] * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[Power[N[(k * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9.5 \cdot 10^{+100}:\\
\;\;\;\;\frac{2}{\frac{\mathsf{fma}\left({\left(\sin k \cdot t\right)}^{2}, 2, {\left(\sin k \cdot k\right)}^{2}\right) \cdot t}{\left(\cos k \cdot \ell\right) \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{t}{\ell}}{\ell} \cdot \frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k}}\\
\end{array}
\end{array}
if t < 9.4999999999999995e100Initial program 60.3%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.7%
Applied rewrites79.4%
if 9.4999999999999995e100 < t Initial program 60.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.9%
Applied rewrites75.7%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6485.0
Applied rewrites85.0%
Taylor expanded in k around 0
*-commutativeN/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f6481.6
Applied rewrites81.6%
Final simplification79.8%
(FPCore (t l k) :precision binary64 (/ 2.0 (/ (* (/ t l) (fma (pow (* (sin k) t) 2.0) 2.0 (pow (* (sin k) k) 2.0))) (* l (cos k)))))
double code(double t, double l, double k) {
return 2.0 / (((t / l) * fma(pow((sin(k) * t), 2.0), 2.0, pow((sin(k) * k), 2.0))) / (l * cos(k)));
}
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(t / l) * fma((Float64(sin(k) * t) ^ 2.0), 2.0, (Float64(sin(k) * k) ^ 2.0))) / Float64(l * cos(k)))) end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(t / l), $MachinePrecision] * N[(N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0 + N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\frac{\frac{t}{\ell} \cdot \mathsf{fma}\left({\left(\sin k \cdot t\right)}^{2}, 2, {\left(\sin k \cdot k\right)}^{2}\right)}{\ell \cdot \cos k}}
\end{array}
Initial program 60.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.3%
Applied rewrites77.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.7
Applied rewrites81.7%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-cos.f64N/A
frac-timesN/A
Applied rewrites84.2%
(FPCore (t l k)
:precision binary64
(if (<=
(*
(* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t) 2.0)) 1.0))
INFINITY)
(/ (* l l) (* (* k k) (* (* t t) t)))
(/ 2.0 (* (/ (* (* k k) (* k k)) (* l l)) t))))
double code(double t, double l, double k) {
double tmp;
if (((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) + 1.0)) <= ((double) INFINITY)) {
tmp = (l * l) / ((k * k) * ((t * t) * t));
} else {
tmp = 2.0 / ((((k * k) * (k * k)) / (l * l)) * t);
}
return tmp;
}
public static double code(double t, double l, double k) {
double tmp;
if (((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) + 1.0)) <= Double.POSITIVE_INFINITY) {
tmp = (l * l) / ((k * k) * ((t * t) * t));
} else {
tmp = 2.0 / ((((k * k) * (k * k)) / (l * l)) * t);
}
return tmp;
}
def code(t, l, k): tmp = 0 if ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) + 1.0)) <= math.inf: tmp = (l * l) / ((k * k) * ((t * t) * t)) else: tmp = 2.0 / ((((k * k) * (k * k)) / (l * l)) * t) return tmp
function code(t, l, k) tmp = 0.0 if (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)) <= Inf) tmp = Float64(Float64(l * l) / Float64(Float64(k * k) * Float64(Float64(t * t) * t))); else tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k * k) * Float64(k * k)) / Float64(l * l)) * t)); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) + 1.0)) <= Inf) tmp = (l * l) / ((k * k) * ((t * t) * t)); else tmp = 2.0 / ((((k * k) * (k * k)) / (l * l)) * t); end tmp_2 = tmp; end
code[t_, l_, k_] := 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] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(l * l), $MachinePrecision] / N[(N[(k * k), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(N[(k * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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) \leq \infty:\\
\;\;\;\;\frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\left(k \cdot k\right) \cdot \left(k \cdot k\right)}{\ell \cdot \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))) < +inf.0Initial program 83.1%
Taylor expanded in k around 0
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift-pow.f6476.2
Applied rewrites76.2%
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6476.2
Applied rewrites76.2%
if +inf.0 < (*.f64 (*.f64 (*.f64 (/.f64 (pow.f64 t #s(literal 3 binary64)) (*.f64 l l)) (sin.f64 k)) (tan.f64 k)) (+.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 k t) #s(literal 2 binary64))) #s(literal 1 binary64))) Initial program 0.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites38.2%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6428.1
Applied rewrites28.1%
Taylor expanded in k around 0
pow2N/A
lift-*.f6428.0
Applied rewrites28.0%
Taylor expanded in t around 0
pow2N/A
lift-*.f6429.9
Applied rewrites29.9%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (/ t l) l)))
(if (<= t 1.15e-60)
(/ 2.0 (* t_1 (/ (pow (* (sin k) k) 2.0) (cos k))))
(if (<= t 2.15e+80)
(/
2.0
(*
(* (/ (/ (pow t 3.0) l) l) (sin k))
(* (tan k) (+ (+ (pow (/ k t) 2.0) 1.0) 1.0))))
(/ 2.0 (* t_1 (/ (* (pow (* (sin k) t) 2.0) 2.0) (cos k))))))))
double code(double t, double l, double k) {
double t_1 = (t / l) / l;
double tmp;
if (t <= 1.15e-60) {
tmp = 2.0 / (t_1 * (pow((sin(k) * k), 2.0) / cos(k)));
} else if (t <= 2.15e+80) {
tmp = 2.0 / ((((pow(t, 3.0) / l) / l) * sin(k)) * (tan(k) * ((pow((k / t), 2.0) + 1.0) + 1.0)));
} else {
tmp = 2.0 / (t_1 * ((pow((sin(k) * t), 2.0) * 2.0) / cos(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) :: t_1
real(8) :: tmp
t_1 = (t / l) / l
if (t <= 1.15d-60) then
tmp = 2.0d0 / (t_1 * (((sin(k) * k) ** 2.0d0) / cos(k)))
else if (t <= 2.15d+80) then
tmp = 2.0d0 / (((((t ** 3.0d0) / l) / l) * sin(k)) * (tan(k) * ((((k / t) ** 2.0d0) + 1.0d0) + 1.0d0)))
else
tmp = 2.0d0 / (t_1 * ((((sin(k) * t) ** 2.0d0) * 2.0d0) / cos(k)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = (t / l) / l;
double tmp;
if (t <= 1.15e-60) {
tmp = 2.0 / (t_1 * (Math.pow((Math.sin(k) * k), 2.0) / Math.cos(k)));
} else if (t <= 2.15e+80) {
tmp = 2.0 / ((((Math.pow(t, 3.0) / l) / l) * Math.sin(k)) * (Math.tan(k) * ((Math.pow((k / t), 2.0) + 1.0) + 1.0)));
} else {
tmp = 2.0 / (t_1 * ((Math.pow((Math.sin(k) * t), 2.0) * 2.0) / Math.cos(k)));
}
return tmp;
}
def code(t, l, k): t_1 = (t / l) / l tmp = 0 if t <= 1.15e-60: tmp = 2.0 / (t_1 * (math.pow((math.sin(k) * k), 2.0) / math.cos(k))) elif t <= 2.15e+80: tmp = 2.0 / ((((math.pow(t, 3.0) / l) / l) * math.sin(k)) * (math.tan(k) * ((math.pow((k / t), 2.0) + 1.0) + 1.0))) else: tmp = 2.0 / (t_1 * ((math.pow((math.sin(k) * t), 2.0) * 2.0) / math.cos(k))) return tmp
function code(t, l, k) t_1 = Float64(Float64(t / l) / l) tmp = 0.0 if (t <= 1.15e-60) tmp = Float64(2.0 / Float64(t_1 * Float64((Float64(sin(k) * k) ^ 2.0) / cos(k)))); elseif (t <= 2.15e+80) tmp = Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / l) / l) * sin(k)) * Float64(tan(k) * Float64(Float64((Float64(k / t) ^ 2.0) + 1.0) + 1.0)))); else tmp = Float64(2.0 / Float64(t_1 * Float64(Float64((Float64(sin(k) * t) ^ 2.0) * 2.0) / cos(k)))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = (t / l) / l; tmp = 0.0; if (t <= 1.15e-60) tmp = 2.0 / (t_1 * (((sin(k) * k) ^ 2.0) / cos(k))); elseif (t <= 2.15e+80) tmp = 2.0 / (((((t ^ 3.0) / l) / l) * sin(k)) * (tan(k) * ((((k / t) ^ 2.0) + 1.0) + 1.0))); else tmp = 2.0 / (t_1 * ((((sin(k) * t) ^ 2.0) * 2.0) / cos(k))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[t, 1.15e-60], N[(2.0 / N[(t$95$1 * N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.15e+80], N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] * N[(N[(N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$1 * N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{t}{\ell}}{\ell}\\
\mathbf{if}\;t \leq 1.15 \cdot 10^{-60}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \frac{{\left(\sin k \cdot k\right)}^{2}}{\cos k}}\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+80}:\\
\;\;\;\;\frac{2}{\left(\frac{\frac{{t}^{3}}{\ell}}{\ell} \cdot \sin k\right) \cdot \left(\tan k \cdot \left(\left({\left(\frac{k}{t}\right)}^{2} + 1\right) + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \frac{{\left(\sin k \cdot t\right)}^{2} \cdot 2}{\cos k}}\\
\end{array}
\end{array}
if t < 1.1500000000000001e-60Initial program 57.5%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.4%
Applied rewrites78.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.2
Applied rewrites81.2%
Taylor expanded in t around 0
*-commutativeN/A
unpow-prod-downN/A
lift-sin.f64N/A
lift-*.f64N/A
lift-pow.f6467.4
Applied rewrites67.4%
if 1.1500000000000001e-60 < t < 2.15000000000000002e80Initial program 78.0%
Applied rewrites78.3%
if 2.15000000000000002e80 < t Initial program 62.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.9%
Applied rewrites77.7%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6486.2
Applied rewrites86.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow-prod-downN/A
lift-sin.f64N/A
lift-*.f64N/A
lift-pow.f6483.2
Applied rewrites83.2%
Final simplification72.0%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (/ t l) l)))
(if (<= t 1.8e-35)
(/ 2.0 (* t_1 (/ (pow (* (sin k) k) 2.0) (cos k))))
(if (<= t 8e+75)
(/
2.0
(*
(* (* (/ (* (* t t) t) (* l l)) (sin k)) (tan k))
(+ (+ 1.0 (pow (/ k t) 2.0)) 1.0)))
(/ 2.0 (* t_1 (/ (* (pow (* (sin k) t) 2.0) 2.0) (cos k))))))))
double code(double t, double l, double k) {
double t_1 = (t / l) / l;
double tmp;
if (t <= 1.8e-35) {
tmp = 2.0 / (t_1 * (pow((sin(k) * k), 2.0) / cos(k)));
} else if (t <= 8e+75) {
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 / (t_1 * ((pow((sin(k) * t), 2.0) * 2.0) / cos(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) :: t_1
real(8) :: tmp
t_1 = (t / l) / l
if (t <= 1.8d-35) then
tmp = 2.0d0 / (t_1 * (((sin(k) * k) ** 2.0d0) / cos(k)))
else if (t <= 8d+75) 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 / (t_1 * ((((sin(k) * t) ** 2.0d0) * 2.0d0) / cos(k)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = (t / l) / l;
double tmp;
if (t <= 1.8e-35) {
tmp = 2.0 / (t_1 * (Math.pow((Math.sin(k) * k), 2.0) / Math.cos(k)));
} else if (t <= 8e+75) {
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 / (t_1 * ((Math.pow((Math.sin(k) * t), 2.0) * 2.0) / Math.cos(k)));
}
return tmp;
}
def code(t, l, k): t_1 = (t / l) / l tmp = 0 if t <= 1.8e-35: tmp = 2.0 / (t_1 * (math.pow((math.sin(k) * k), 2.0) / math.cos(k))) elif t <= 8e+75: 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 / (t_1 * ((math.pow((math.sin(k) * t), 2.0) * 2.0) / math.cos(k))) return tmp
function code(t, l, k) t_1 = Float64(Float64(t / l) / l) tmp = 0.0 if (t <= 1.8e-35) tmp = Float64(2.0 / Float64(t_1 * Float64((Float64(sin(k) * k) ^ 2.0) / cos(k)))); elseif (t <= 8e+75) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(Float64(Float64(t * t) * t) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) + 1.0))); else tmp = Float64(2.0 / Float64(t_1 * Float64(Float64((Float64(sin(k) * t) ^ 2.0) * 2.0) / cos(k)))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = (t / l) / l; tmp = 0.0; if (t <= 1.8e-35) tmp = 2.0 / (t_1 * (((sin(k) * k) ^ 2.0) / cos(k))); elseif (t <= 8e+75) tmp = 2.0 / ((((((t * t) * t) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) + 1.0)); else tmp = 2.0 / (t_1 * ((((sin(k) * t) ^ 2.0) * 2.0) / cos(k))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[t, 1.8e-35], N[(2.0 / N[(t$95$1 * N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8e+75], N[(2.0 / N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] * t), $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], N[(2.0 / N[(t$95$1 * N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{t}{\ell}}{\ell}\\
\mathbf{if}\;t \leq 1.8 \cdot 10^{-35}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \frac{{\left(\sin k \cdot k\right)}^{2}}{\cos k}}\\
\mathbf{elif}\;t \leq 8 \cdot 10^{+75}:\\
\;\;\;\;\frac{2}{\left(\left(\frac{\left(t \cdot t\right) \cdot t}{\ell \cdot \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}{t\_1 \cdot \frac{{\left(\sin k \cdot t\right)}^{2} \cdot 2}{\cos k}}\\
\end{array}
\end{array}
if t < 1.80000000000000009e-35Initial program 57.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.3%
Applied rewrites78.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.0
Applied rewrites81.0%
Taylor expanded in t around 0
*-commutativeN/A
unpow-prod-downN/A
lift-sin.f64N/A
lift-*.f64N/A
lift-pow.f6467.5
Applied rewrites67.5%
if 1.80000000000000009e-35 < t < 7.99999999999999941e75Initial program 79.4%
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6479.4
Applied rewrites79.4%
if 7.99999999999999941e75 < t Initial program 62.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.9%
Applied rewrites77.7%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6486.2
Applied rewrites86.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow-prod-downN/A
lift-sin.f64N/A
lift-*.f64N/A
lift-pow.f6483.2
Applied rewrites83.2%
Final simplification72.0%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (/ t l) l)))
(if (<= t 4e-22)
(/ 2.0 (* t_1 (/ (pow (* (sin k) k) 2.0) (cos k))))
(/ 2.0 (* t_1 (/ (* (pow (* k t) 2.0) 2.0) (cos k)))))))
double code(double t, double l, double k) {
double t_1 = (t / l) / l;
double tmp;
if (t <= 4e-22) {
tmp = 2.0 / (t_1 * (pow((sin(k) * k), 2.0) / cos(k)));
} else {
tmp = 2.0 / (t_1 * ((pow((k * t), 2.0) * 2.0) / cos(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) :: t_1
real(8) :: tmp
t_1 = (t / l) / l
if (t <= 4d-22) then
tmp = 2.0d0 / (t_1 * (((sin(k) * k) ** 2.0d0) / cos(k)))
else
tmp = 2.0d0 / (t_1 * ((((k * t) ** 2.0d0) * 2.0d0) / cos(k)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = (t / l) / l;
double tmp;
if (t <= 4e-22) {
tmp = 2.0 / (t_1 * (Math.pow((Math.sin(k) * k), 2.0) / Math.cos(k)));
} else {
tmp = 2.0 / (t_1 * ((Math.pow((k * t), 2.0) * 2.0) / Math.cos(k)));
}
return tmp;
}
def code(t, l, k): t_1 = (t / l) / l tmp = 0 if t <= 4e-22: tmp = 2.0 / (t_1 * (math.pow((math.sin(k) * k), 2.0) / math.cos(k))) else: tmp = 2.0 / (t_1 * ((math.pow((k * t), 2.0) * 2.0) / math.cos(k))) return tmp
function code(t, l, k) t_1 = Float64(Float64(t / l) / l) tmp = 0.0 if (t <= 4e-22) tmp = Float64(2.0 / Float64(t_1 * Float64((Float64(sin(k) * k) ^ 2.0) / cos(k)))); else tmp = Float64(2.0 / Float64(t_1 * Float64(Float64((Float64(k * t) ^ 2.0) * 2.0) / cos(k)))); end return tmp end
function tmp_2 = code(t, l, k) t_1 = (t / l) / l; tmp = 0.0; if (t <= 4e-22) tmp = 2.0 / (t_1 * (((sin(k) * k) ^ 2.0) / cos(k))); else tmp = 2.0 / (t_1 * ((((k * t) ^ 2.0) * 2.0) / cos(k))); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[t, 4e-22], N[(2.0 / N[(t$95$1 * N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$1 * N[(N[(N[Power[N[(k * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{t}{\ell}}{\ell}\\
\mathbf{if}\;t \leq 4 \cdot 10^{-22}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \frac{{\left(\sin k \cdot k\right)}^{2}}{\cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k}}\\
\end{array}
\end{array}
if t < 4.0000000000000002e-22Initial program 58.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.0%
Applied rewrites78.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.2
Applied rewrites81.2%
Taylor expanded in t around 0
*-commutativeN/A
unpow-prod-downN/A
lift-sin.f64N/A
lift-*.f64N/A
lift-pow.f6467.3
Applied rewrites67.3%
if 4.0000000000000002e-22 < t Initial program 65.6%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.0%
Applied rewrites76.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6482.9
Applied rewrites82.9%
Taylor expanded in k around 0
*-commutativeN/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f6475.3
Applied rewrites75.3%
Final simplification69.7%
(FPCore (t l k) :precision binary64 (if (<= t 4e-22) (/ 2.0 (* (/ t (* l l)) (/ (pow (* (sin k) k) 2.0) (cos k)))) (/ 2.0 (* (/ (/ t l) l) (/ (* (pow (* k t) 2.0) 2.0) (cos k))))))
double code(double t, double l, double k) {
double tmp;
if (t <= 4e-22) {
tmp = 2.0 / ((t / (l * l)) * (pow((sin(k) * k), 2.0) / cos(k)));
} else {
tmp = 2.0 / (((t / l) / l) * ((pow((k * t), 2.0) * 2.0) / cos(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 (t <= 4d-22) then
tmp = 2.0d0 / ((t / (l * l)) * (((sin(k) * k) ** 2.0d0) / cos(k)))
else
tmp = 2.0d0 / (((t / l) / l) * ((((k * t) ** 2.0d0) * 2.0d0) / cos(k)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (t <= 4e-22) {
tmp = 2.0 / ((t / (l * l)) * (Math.pow((Math.sin(k) * k), 2.0) / Math.cos(k)));
} else {
tmp = 2.0 / (((t / l) / l) * ((Math.pow((k * t), 2.0) * 2.0) / Math.cos(k)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if t <= 4e-22: tmp = 2.0 / ((t / (l * l)) * (math.pow((math.sin(k) * k), 2.0) / math.cos(k))) else: tmp = 2.0 / (((t / l) / l) * ((math.pow((k * t), 2.0) * 2.0) / math.cos(k))) return tmp
function code(t, l, k) tmp = 0.0 if (t <= 4e-22) tmp = Float64(2.0 / Float64(Float64(t / Float64(l * l)) * Float64((Float64(sin(k) * k) ^ 2.0) / cos(k)))); else tmp = Float64(2.0 / Float64(Float64(Float64(t / l) / l) * Float64(Float64((Float64(k * t) ^ 2.0) * 2.0) / cos(k)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (t <= 4e-22) tmp = 2.0 / ((t / (l * l)) * (((sin(k) * k) ^ 2.0) / cos(k))); else tmp = 2.0 / (((t / l) / l) * ((((k * t) ^ 2.0) * 2.0) / cos(k))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[t, 4e-22], N[(2.0 / N[(N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[Power[N[(k * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4 \cdot 10^{-22}:\\
\;\;\;\;\frac{2}{\frac{t}{\ell \cdot \ell} \cdot \frac{{\left(\sin k \cdot k\right)}^{2}}{\cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{t}{\ell}}{\ell} \cdot \frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k}}\\
\end{array}
\end{array}
if t < 4.0000000000000002e-22Initial program 58.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.0%
Applied rewrites78.4%
Taylor expanded in t around 0
*-commutativeN/A
*-commutativeN/A
unpow-prod-downN/A
lift-sin.f64N/A
lift-*.f64N/A
lift-pow.f6466.1
Applied rewrites66.1%
if 4.0000000000000002e-22 < t Initial program 65.6%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.0%
Applied rewrites76.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6482.9
Applied rewrites82.9%
Taylor expanded in k around 0
*-commutativeN/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f6475.3
Applied rewrites75.3%
Final simplification68.9%
(FPCore (t l k) :precision binary64 (if (<= t 2.8e-35) (* (* (/ (* l l) (* k k)) (/ (cos k) (* (pow (sin k) 2.0) t))) 2.0) (/ 2.0 (* (/ (/ t l) l) (/ (* (pow (* k t) 2.0) 2.0) (cos k))))))
double code(double t, double l, double k) {
double tmp;
if (t <= 2.8e-35) {
tmp = (((l * l) / (k * k)) * (cos(k) / (pow(sin(k), 2.0) * t))) * 2.0;
} else {
tmp = 2.0 / (((t / l) / l) * ((pow((k * t), 2.0) * 2.0) / cos(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 (t <= 2.8d-35) then
tmp = (((l * l) / (k * k)) * (cos(k) / ((sin(k) ** 2.0d0) * t))) * 2.0d0
else
tmp = 2.0d0 / (((t / l) / l) * ((((k * t) ** 2.0d0) * 2.0d0) / cos(k)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (t <= 2.8e-35) {
tmp = (((l * l) / (k * k)) * (Math.cos(k) / (Math.pow(Math.sin(k), 2.0) * t))) * 2.0;
} else {
tmp = 2.0 / (((t / l) / l) * ((Math.pow((k * t), 2.0) * 2.0) / Math.cos(k)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if t <= 2.8e-35: tmp = (((l * l) / (k * k)) * (math.cos(k) / (math.pow(math.sin(k), 2.0) * t))) * 2.0 else: tmp = 2.0 / (((t / l) / l) * ((math.pow((k * t), 2.0) * 2.0) / math.cos(k))) return tmp
function code(t, l, k) tmp = 0.0 if (t <= 2.8e-35) tmp = Float64(Float64(Float64(Float64(l * l) / Float64(k * k)) * Float64(cos(k) / Float64((sin(k) ^ 2.0) * t))) * 2.0); else tmp = Float64(2.0 / Float64(Float64(Float64(t / l) / l) * Float64(Float64((Float64(k * t) ^ 2.0) * 2.0) / cos(k)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (t <= 2.8e-35) tmp = (((l * l) / (k * k)) * (cos(k) / ((sin(k) ^ 2.0) * t))) * 2.0; else tmp = 2.0 / (((t / l) / l) * ((((k * t) ^ 2.0) * 2.0) / cos(k))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[t, 2.8e-35], N[(N[(N[(N[(l * l), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(2.0 / N[(N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[Power[N[(k * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.8 \cdot 10^{-35}:\\
\;\;\;\;\left(\frac{\ell \cdot \ell}{k \cdot k} \cdot \frac{\cos k}{{\sin k}^{2} \cdot t}\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{t}{\ell}}{\ell} \cdot \frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k}}\\
\end{array}
\end{array}
if t < 2.8e-35Initial program 57.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites65.7%
if 2.8e-35 < t Initial program 66.5%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.4%
Applied rewrites76.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6483.3
Applied rewrites83.3%
Taylor expanded in k around 0
*-commutativeN/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f6474.8
Applied rewrites74.8%
Final simplification68.5%
(FPCore (t l k) :precision binary64 (if (<= t 2.8e-35) (/ 2.0 (* (/ (pow (* (sin k) k) 2.0) (* (cos k) (* l l))) t)) (/ 2.0 (* (/ (/ t l) l) (/ (* (pow (* k t) 2.0) 2.0) (cos k))))))
double code(double t, double l, double k) {
double tmp;
if (t <= 2.8e-35) {
tmp = 2.0 / ((pow((sin(k) * k), 2.0) / (cos(k) * (l * l))) * t);
} else {
tmp = 2.0 / (((t / l) / l) * ((pow((k * t), 2.0) * 2.0) / cos(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 (t <= 2.8d-35) then
tmp = 2.0d0 / ((((sin(k) * k) ** 2.0d0) / (cos(k) * (l * l))) * t)
else
tmp = 2.0d0 / (((t / l) / l) * ((((k * t) ** 2.0d0) * 2.0d0) / cos(k)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (t <= 2.8e-35) {
tmp = 2.0 / ((Math.pow((Math.sin(k) * k), 2.0) / (Math.cos(k) * (l * l))) * t);
} else {
tmp = 2.0 / (((t / l) / l) * ((Math.pow((k * t), 2.0) * 2.0) / Math.cos(k)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if t <= 2.8e-35: tmp = 2.0 / ((math.pow((math.sin(k) * k), 2.0) / (math.cos(k) * (l * l))) * t) else: tmp = 2.0 / (((t / l) / l) * ((math.pow((k * t), 2.0) * 2.0) / math.cos(k))) return tmp
function code(t, l, k) tmp = 0.0 if (t <= 2.8e-35) tmp = Float64(2.0 / Float64(Float64((Float64(sin(k) * k) ^ 2.0) / Float64(cos(k) * Float64(l * l))) * t)); else tmp = Float64(2.0 / Float64(Float64(Float64(t / l) / l) * Float64(Float64((Float64(k * t) ^ 2.0) * 2.0) / cos(k)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (t <= 2.8e-35) tmp = 2.0 / ((((sin(k) * k) ^ 2.0) / (cos(k) * (l * l))) * t); else tmp = 2.0 / (((t / l) / l) * ((((k * t) ^ 2.0) * 2.0) / cos(k))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[t, 2.8e-35], N[(2.0 / N[(N[(N[Power[N[(N[Sin[k], $MachinePrecision] * k), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[Power[N[(k * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.8 \cdot 10^{-35}:\\
\;\;\;\;\frac{2}{\frac{{\left(\sin k \cdot k\right)}^{2}}{\cos k \cdot \left(\ell \cdot \ell\right)} \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{\frac{t}{\ell}}{\ell} \cdot \frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k}}\\
\end{array}
\end{array}
if t < 2.8e-35Initial program 57.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.3%
Taylor expanded in t around 0
*-commutativeN/A
unpow-prod-downN/A
lift-sin.f64N/A
lift-*.f64N/A
lift-pow.f6464.9
Applied rewrites64.9%
if 2.8e-35 < t Initial program 66.5%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.4%
Applied rewrites76.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6483.3
Applied rewrites83.3%
Taylor expanded in k around 0
*-commutativeN/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f6474.8
Applied rewrites74.8%
Final simplification67.9%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (/ t l) l)))
(if (<= t 1.2e+14)
(/
2.0
(*
t_1
(*
(fma
(+ (fma (* t t) -0.6666666666666666 1.0) (* t t))
(* k k)
(* (* t t) 2.0))
(* k k))))
(/ 2.0 (* t_1 (/ (* (pow (* k t) 2.0) 2.0) (cos k)))))))
double code(double t, double l, double k) {
double t_1 = (t / l) / l;
double tmp;
if (t <= 1.2e+14) {
tmp = 2.0 / (t_1 * (fma((fma((t * t), -0.6666666666666666, 1.0) + (t * t)), (k * k), ((t * t) * 2.0)) * (k * k)));
} else {
tmp = 2.0 / (t_1 * ((pow((k * t), 2.0) * 2.0) / cos(k)));
}
return tmp;
}
function code(t, l, k) t_1 = Float64(Float64(t / l) / l) tmp = 0.0 if (t <= 1.2e+14) tmp = Float64(2.0 / Float64(t_1 * Float64(fma(Float64(fma(Float64(t * t), -0.6666666666666666, 1.0) + Float64(t * t)), Float64(k * k), Float64(Float64(t * t) * 2.0)) * Float64(k * k)))); else tmp = Float64(2.0 / Float64(t_1 * Float64(Float64((Float64(k * t) ^ 2.0) * 2.0) / cos(k)))); end return tmp end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[t, 1.2e+14], N[(2.0 / N[(t$95$1 * N[(N[(N[(N[(N[(t * t), $MachinePrecision] * -0.6666666666666666 + 1.0), $MachinePrecision] + N[(t * t), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$1 * N[(N[(N[Power[N[(k * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{t}{\ell}}{\ell}\\
\mathbf{if}\;t \leq 1.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(t \cdot t, -0.6666666666666666, 1\right) + t \cdot t, k \cdot k, \left(t \cdot t\right) \cdot 2\right) \cdot \left(k \cdot k\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \frac{{\left(k \cdot t\right)}^{2} \cdot 2}{\cos k}}\\
\end{array}
\end{array}
if t < 1.2e14Initial program 59.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.0%
Applied rewrites79.4%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6482.0
Applied rewrites82.0%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites57.8%
if 1.2e14 < t Initial program 61.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.3%
Applied rewrites73.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.0
Applied rewrites81.0%
Taylor expanded in k around 0
*-commutativeN/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f6472.9
Applied rewrites72.9%
Final simplification61.9%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (/ t l) l)))
(if (<= t 9.5e+14)
(/
2.0
(*
t_1
(*
(fma
(+ (fma (* t t) -0.6666666666666666 1.0) (* t t))
(* k k)
(* (* t t) 2.0))
(* k k))))
(/ 2.0 (* t_1 (* (pow (* k t) 2.0) 2.0))))))
double code(double t, double l, double k) {
double t_1 = (t / l) / l;
double tmp;
if (t <= 9.5e+14) {
tmp = 2.0 / (t_1 * (fma((fma((t * t), -0.6666666666666666, 1.0) + (t * t)), (k * k), ((t * t) * 2.0)) * (k * k)));
} else {
tmp = 2.0 / (t_1 * (pow((k * t), 2.0) * 2.0));
}
return tmp;
}
function code(t, l, k) t_1 = Float64(Float64(t / l) / l) tmp = 0.0 if (t <= 9.5e+14) tmp = Float64(2.0 / Float64(t_1 * Float64(fma(Float64(fma(Float64(t * t), -0.6666666666666666, 1.0) + Float64(t * t)), Float64(k * k), Float64(Float64(t * t) * 2.0)) * Float64(k * k)))); else tmp = Float64(2.0 / Float64(t_1 * Float64((Float64(k * t) ^ 2.0) * 2.0))); end return tmp end
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[t, 9.5e+14], N[(2.0 / N[(t$95$1 * N[(N[(N[(N[(N[(t * t), $MachinePrecision] * -0.6666666666666666 + 1.0), $MachinePrecision] + N[(t * t), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$1 * N[(N[Power[N[(k * t), $MachinePrecision], 2.0], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{t}{\ell}}{\ell}\\
\mathbf{if}\;t \leq 9.5 \cdot 10^{+14}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(t \cdot t, -0.6666666666666666, 1\right) + t \cdot t, k \cdot k, \left(t \cdot t\right) \cdot 2\right) \cdot \left(k \cdot k\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t\_1 \cdot \left({\left(k \cdot t\right)}^{2} \cdot 2\right)}\\
\end{array}
\end{array}
if t < 9.5e14Initial program 60.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.1%
Applied rewrites79.5%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6482.1
Applied rewrites82.1%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites57.5%
if 9.5e14 < t Initial program 61.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.0%
Applied rewrites73.3%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f6467.6
Applied rewrites67.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-/.f64N/A
lift-/.f6473.7
Applied rewrites73.7%
Final simplification61.8%
(FPCore (t l k)
:precision binary64
(if (<= t 9.2e+14)
(/
2.0
(*
(/ (/ t l) l)
(*
(fma
(+ (fma (* t t) -0.6666666666666666 1.0) (* t t))
(* k k)
(* (* t t) 2.0))
(* k k))))
(/ 2.0 (* (/ t (* l l)) (* (* (* k t) (* k t)) 2.0)))))
double code(double t, double l, double k) {
double tmp;
if (t <= 9.2e+14) {
tmp = 2.0 / (((t / l) / l) * (fma((fma((t * t), -0.6666666666666666, 1.0) + (t * t)), (k * k), ((t * t) * 2.0)) * (k * k)));
} else {
tmp = 2.0 / ((t / (l * l)) * (((k * t) * (k * t)) * 2.0));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (t <= 9.2e+14) tmp = Float64(2.0 / Float64(Float64(Float64(t / l) / l) * Float64(fma(Float64(fma(Float64(t * t), -0.6666666666666666, 1.0) + Float64(t * t)), Float64(k * k), Float64(Float64(t * t) * 2.0)) * Float64(k * k)))); else tmp = Float64(2.0 / Float64(Float64(t / Float64(l * l)) * Float64(Float64(Float64(k * t) * Float64(k * t)) * 2.0))); end return tmp end
code[t_, l_, k_] := If[LessEqual[t, 9.2e+14], N[(2.0 / N[(N[(N[(t / l), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(N[(t * t), $MachinePrecision] * -0.6666666666666666 + 1.0), $MachinePrecision] + N[(t * t), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(k * t), $MachinePrecision] * N[(k * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{2}{\frac{\frac{t}{\ell}}{\ell} \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(t \cdot t, -0.6666666666666666, 1\right) + t \cdot t, k \cdot k, \left(t \cdot t\right) \cdot 2\right) \cdot \left(k \cdot k\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t}{\ell \cdot \ell} \cdot \left(\left(\left(k \cdot t\right) \cdot \left(k \cdot t\right)\right) \cdot 2\right)}\\
\end{array}
\end{array}
if t < 9.2e14Initial program 60.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.1%
Applied rewrites79.5%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6482.1
Applied rewrites82.1%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites57.5%
if 9.2e14 < t Initial program 61.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.0%
Applied rewrites73.3%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f6467.6
Applied rewrites67.6%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6467.6
Applied rewrites67.6%
Final simplification60.2%
(FPCore (t l k)
:precision binary64
(if (<= t 4.5e+98)
(/
2.0
(*
(/
(*
(*
(fma (* (fma (* t t) -0.6666666666666666 1.0) k) k (* (* t t) 2.0))
k)
k)
(* l l))
t))
(/ 2.0 (* (/ t (* l l)) (* (* (* k t) (* k t)) 2.0)))))
double code(double t, double l, double k) {
double tmp;
if (t <= 4.5e+98) {
tmp = 2.0 / ((((fma((fma((t * t), -0.6666666666666666, 1.0) * k), k, ((t * t) * 2.0)) * k) * k) / (l * l)) * t);
} else {
tmp = 2.0 / ((t / (l * l)) * (((k * t) * (k * t)) * 2.0));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (t <= 4.5e+98) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(fma(Float64(fma(Float64(t * t), -0.6666666666666666, 1.0) * k), k, Float64(Float64(t * t) * 2.0)) * k) * k) / Float64(l * l)) * t)); else tmp = Float64(2.0 / Float64(Float64(t / Float64(l * l)) * Float64(Float64(Float64(k * t) * Float64(k * t)) * 2.0))); end return tmp end
code[t_, l_, k_] := If[LessEqual[t, 4.5e+98], N[(2.0 / N[(N[(N[(N[(N[(N[(N[(N[(t * t), $MachinePrecision] * -0.6666666666666666 + 1.0), $MachinePrecision] * k), $MachinePrecision] * k + N[(N[(t * t), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(k * t), $MachinePrecision] * N[(k * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 4.5 \cdot 10^{+98}:\\
\;\;\;\;\frac{2}{\frac{\left(\mathsf{fma}\left(\mathsf{fma}\left(t \cdot t, -0.6666666666666666, 1\right) \cdot k, k, \left(t \cdot t\right) \cdot 2\right) \cdot k\right) \cdot k}{\ell \cdot \ell} \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t}{\ell \cdot \ell} \cdot \left(\left(\left(k \cdot t\right) \cdot \left(k \cdot t\right)\right) \cdot 2\right)}\\
\end{array}
\end{array}
if t < 4.5000000000000002e98Initial program 60.3%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.7%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6455.1
Applied rewrites55.1%
Taylor expanded in k around 0
pow2N/A
lift-*.f6454.9
Applied rewrites54.9%
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites56.9%
if 4.5000000000000002e98 < t Initial program 60.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.9%
Applied rewrites75.7%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f6474.0
Applied rewrites74.0%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6474.0
Applied rewrites74.0%
(FPCore (t l k) :precision binary64 (if (<= t 1.3e-60) (/ 2.0 (* (/ (* (* k k) (* k k)) (* l l)) t)) (/ 2.0 (* (/ t (* l l)) (* (* (* k t) (* k t)) 2.0)))))
double code(double t, double l, double k) {
double tmp;
if (t <= 1.3e-60) {
tmp = 2.0 / ((((k * k) * (k * k)) / (l * l)) * t);
} else {
tmp = 2.0 / ((t / (l * l)) * (((k * t) * (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) :: tmp
if (t <= 1.3d-60) then
tmp = 2.0d0 / ((((k * k) * (k * k)) / (l * l)) * t)
else
tmp = 2.0d0 / ((t / (l * l)) * (((k * t) * (k * t)) * 2.0d0))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (t <= 1.3e-60) {
tmp = 2.0 / ((((k * k) * (k * k)) / (l * l)) * t);
} else {
tmp = 2.0 / ((t / (l * l)) * (((k * t) * (k * t)) * 2.0));
}
return tmp;
}
def code(t, l, k): tmp = 0 if t <= 1.3e-60: tmp = 2.0 / ((((k * k) * (k * k)) / (l * l)) * t) else: tmp = 2.0 / ((t / (l * l)) * (((k * t) * (k * t)) * 2.0)) return tmp
function code(t, l, k) tmp = 0.0 if (t <= 1.3e-60) tmp = Float64(2.0 / Float64(Float64(Float64(Float64(k * k) * Float64(k * k)) / Float64(l * l)) * t)); else tmp = Float64(2.0 / Float64(Float64(t / Float64(l * l)) * Float64(Float64(Float64(k * t) * Float64(k * t)) * 2.0))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (t <= 1.3e-60) tmp = 2.0 / ((((k * k) * (k * k)) / (l * l)) * t); else tmp = 2.0 / ((t / (l * l)) * (((k * t) * (k * t)) * 2.0)); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[t, 1.3e-60], N[(2.0 / N[(N[(N[(N[(k * k), $MachinePrecision] * N[(k * k), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(k * t), $MachinePrecision] * N[(k * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.3 \cdot 10^{-60}:\\
\;\;\;\;\frac{2}{\frac{\left(k \cdot k\right) \cdot \left(k \cdot k\right)}{\ell \cdot \ell} \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t}{\ell \cdot \ell} \cdot \left(\left(\left(k \cdot t\right) \cdot \left(k \cdot t\right)\right) \cdot 2\right)}\\
\end{array}
\end{array}
if t < 1.2999999999999999e-60Initial program 57.5%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.4%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6454.3
Applied rewrites54.3%
Taylor expanded in k around 0
pow2N/A
lift-*.f6454.2
Applied rewrites54.2%
Taylor expanded in t around 0
pow2N/A
lift-*.f6459.7
Applied rewrites59.7%
if 1.2999999999999999e-60 < t Initial program 66.6%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.2%
Applied rewrites76.6%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f6469.3
Applied rewrites69.3%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6469.3
Applied rewrites69.3%
(FPCore (t l k) :precision binary64 (/ (* l l) (* (* k k) (* (* t t) t))))
double code(double t, double l, double k) {
return (l * l) / ((k * k) * ((t * t) * 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) / ((k * k) * ((t * t) * t))
end function
public static double code(double t, double l, double k) {
return (l * l) / ((k * k) * ((t * t) * t));
}
def code(t, l, k): return (l * l) / ((k * k) * ((t * t) * t))
function code(t, l, k) return Float64(Float64(l * l) / Float64(Float64(k * k) * Float64(Float64(t * t) * t))) end
function tmp = code(t, l, k) tmp = (l * l) / ((k * k) * ((t * t) * t)); end
code[t_, l_, k_] := N[(N[(l * l), $MachinePrecision] / N[(N[(k * k), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\ell \cdot \ell}{\left(k \cdot k\right) \cdot \left(\left(t \cdot t\right) \cdot t\right)}
\end{array}
Initial program 60.4%
Taylor expanded in k around 0
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lift-pow.f6458.6
Applied rewrites58.6%
lift-pow.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6458.6
Applied rewrites58.6%
herbie shell --seed 2025060
(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))))