
(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]
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
Herbie found 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]
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (fabs k) 2.0)) (t_2 (* (cos (fabs k)) l)))
(if (<= (fabs k) 260.0)
(*
2.0
(*
l
(/
(/
t_2
(*
(pow (fabs k) 3.0)
(+
t
(*
t_1
(fma -0.3333333333333333 t (* 0.044444444444444446 (* t_1 t)))))))
(fabs k))))
(*
(*
(/ -2.0 (* (fma (cos (+ (fabs k) (fabs k))) 0.5 -0.5) t))
(/ t_2 (fabs k)))
(/ l (fabs k))))))double code(double t, double l, double k) {
double t_1 = pow(fabs(k), 2.0);
double t_2 = cos(fabs(k)) * l;
double tmp;
if (fabs(k) <= 260.0) {
tmp = 2.0 * (l * ((t_2 / (pow(fabs(k), 3.0) * (t + (t_1 * fma(-0.3333333333333333, t, (0.044444444444444446 * (t_1 * t))))))) / fabs(k)));
} else {
tmp = ((-2.0 / (fma(cos((fabs(k) + fabs(k))), 0.5, -0.5) * t)) * (t_2 / fabs(k))) * (l / fabs(k));
}
return tmp;
}
function code(t, l, k) t_1 = abs(k) ^ 2.0 t_2 = Float64(cos(abs(k)) * l) tmp = 0.0 if (abs(k) <= 260.0) tmp = Float64(2.0 * Float64(l * Float64(Float64(t_2 / Float64((abs(k) ^ 3.0) * Float64(t + Float64(t_1 * fma(-0.3333333333333333, t, Float64(0.044444444444444446 * Float64(t_1 * t))))))) / abs(k)))); else tmp = Float64(Float64(Float64(-2.0 / Float64(fma(cos(Float64(abs(k) + abs(k))), 0.5, -0.5) * t)) * Float64(t_2 / abs(k))) * Float64(l / abs(k))); end return tmp end
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision]}, If[LessEqual[N[Abs[k], $MachinePrecision], 260.0], N[(2.0 * N[(l * N[(N[(t$95$2 / N[(N[Power[N[Abs[k], $MachinePrecision], 3.0], $MachinePrecision] * N[(t + N[(t$95$1 * N[(-0.3333333333333333 * t + N[(0.044444444444444446 * N[(t$95$1 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 / N[(N[(N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5 + -0.5), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 / N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := {\left(\left|k\right|\right)}^{2}\\
t_2 := \cos \left(\left|k\right|\right) \cdot \ell\\
\mathbf{if}\;\left|k\right| \leq 260:\\
\;\;\;\;2 \cdot \left(\ell \cdot \frac{\frac{t\_2}{{\left(\left|k\right|\right)}^{3} \cdot \left(t + t\_1 \cdot \mathsf{fma}\left(-0.3333333333333333, t, 0.044444444444444446 \cdot \left(t\_1 \cdot t\right)\right)\right)}}{\left|k\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{-2}{\mathsf{fma}\left(\cos \left(\left|k\right| + \left|k\right|\right), 0.5, -0.5\right) \cdot t} \cdot \frac{t\_2}{\left|k\right|}\right) \cdot \frac{\ell}{\left|k\right|}\\
\end{array}
if k < 260Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6482.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.9%
Taylor expanded in k around 0
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6470.8%
Applied rewrites70.8%
if 260 < k Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites75.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6482.7%
Applied rewrites82.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites50.4%
(FPCore (t l k)
:precision binary64
(if (<= (fabs k) 1.65e-6)
(* 2.0 (* l (/ (/ l (* (pow (fabs k) 3.0) t)) (fabs k))))
(*
(*
(/ -2.0 (* (fma (cos (+ (fabs k) (fabs k))) 0.5 -0.5) t))
(/ (* (cos (fabs k)) l) (fabs k)))
(/ l (fabs k)))))double code(double t, double l, double k) {
double tmp;
if (fabs(k) <= 1.65e-6) {
tmp = 2.0 * (l * ((l / (pow(fabs(k), 3.0) * t)) / fabs(k)));
} else {
tmp = ((-2.0 / (fma(cos((fabs(k) + fabs(k))), 0.5, -0.5) * t)) * ((cos(fabs(k)) * l) / fabs(k))) * (l / fabs(k));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (abs(k) <= 1.65e-6) tmp = Float64(2.0 * Float64(l * Float64(Float64(l / Float64((abs(k) ^ 3.0) * t)) / abs(k)))); else tmp = Float64(Float64(Float64(-2.0 / Float64(fma(cos(Float64(abs(k) + abs(k))), 0.5, -0.5) * t)) * Float64(Float64(cos(abs(k)) * l) / abs(k))) * Float64(l / abs(k))); end return tmp end
code[t_, l_, k_] := If[LessEqual[N[Abs[k], $MachinePrecision], 1.65e-6], N[(2.0 * N[(l * N[(N[(l / N[(N[Power[N[Abs[k], $MachinePrecision], 3.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 / N[(N[(N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5 + -0.5), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision] / N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l / N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|k\right| \leq 1.65 \cdot 10^{-6}:\\
\;\;\;\;2 \cdot \left(\ell \cdot \frac{\frac{\ell}{{\left(\left|k\right|\right)}^{3} \cdot t}}{\left|k\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{-2}{\mathsf{fma}\left(\cos \left(\left|k\right| + \left|k\right|\right), 0.5, -0.5\right) \cdot t} \cdot \frac{\cos \left(\left|k\right|\right) \cdot \ell}{\left|k\right|}\right) \cdot \frac{\ell}{\left|k\right|}\\
\end{array}
if k < 1.65000000000000008e-6Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6482.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.9%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6470.4%
Applied rewrites70.4%
if 1.65000000000000008e-6 < k Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites75.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6482.7%
Applied rewrites82.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites50.4%
(FPCore (t l k)
:precision binary64
(if (<= (fabs k) 1.3e-6)
(* 2.0 (* l (/ (/ l (* (pow (fabs k) 3.0) t)) (fabs k))))
(*
2.0
(*
l
(*
(cos (fabs k))
(/
(/ l (* (* (fma (cos (+ (fabs k) (fabs k))) -0.5 0.5) t) (fabs k)))
(fabs k)))))))double code(double t, double l, double k) {
double tmp;
if (fabs(k) <= 1.3e-6) {
tmp = 2.0 * (l * ((l / (pow(fabs(k), 3.0) * t)) / fabs(k)));
} else {
tmp = 2.0 * (l * (cos(fabs(k)) * ((l / ((fma(cos((fabs(k) + fabs(k))), -0.5, 0.5) * t) * fabs(k))) / fabs(k))));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (abs(k) <= 1.3e-6) tmp = Float64(2.0 * Float64(l * Float64(Float64(l / Float64((abs(k) ^ 3.0) * t)) / abs(k)))); else tmp = Float64(2.0 * Float64(l * Float64(cos(abs(k)) * Float64(Float64(l / Float64(Float64(fma(cos(Float64(abs(k) + abs(k))), -0.5, 0.5) * t) * abs(k))) / abs(k))))); end return tmp end
code[t_, l_, k_] := If[LessEqual[N[Abs[k], $MachinePrecision], 1.3e-6], N[(2.0 * N[(l * N[(N[(l / N[(N[Power[N[Abs[k], $MachinePrecision], 3.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(l * N[(N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision] * N[(N[(l / N[(N[(N[(N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision] * t), $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|k\right| \leq 1.3 \cdot 10^{-6}:\\
\;\;\;\;2 \cdot \left(\ell \cdot \frac{\frac{\ell}{{\left(\left|k\right|\right)}^{3} \cdot t}}{\left|k\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\ell \cdot \left(\cos \left(\left|k\right|\right) \cdot \frac{\frac{\ell}{\left(\mathsf{fma}\left(\cos \left(\left|k\right| + \left|k\right|\right), -0.5, 0.5\right) \cdot t\right) \cdot \left|k\right|}}{\left|k\right|}\right)\right)\\
\end{array}
if k < 1.30000000000000005e-6Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6482.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.9%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6470.4%
Applied rewrites70.4%
if 1.30000000000000005e-6 < k Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6482.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.9%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6482.9%
Applied rewrites82.9%
(FPCore (t l k)
:precision binary64
(if (<= (fabs k) 1.3e-6)
(* 2.0 (* l (/ (/ l (* (pow (fabs k) 3.0) t)) (fabs k))))
(/
(*
(+ l l)
(/
(* (cos (fabs k)) l)
(* (* (fma (cos (+ (fabs k) (fabs k))) -0.5 0.5) t) (fabs k))))
(fabs k))))double code(double t, double l, double k) {
double tmp;
if (fabs(k) <= 1.3e-6) {
tmp = 2.0 * (l * ((l / (pow(fabs(k), 3.0) * t)) / fabs(k)));
} else {
tmp = ((l + l) * ((cos(fabs(k)) * l) / ((fma(cos((fabs(k) + fabs(k))), -0.5, 0.5) * t) * fabs(k)))) / fabs(k);
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (abs(k) <= 1.3e-6) tmp = Float64(2.0 * Float64(l * Float64(Float64(l / Float64((abs(k) ^ 3.0) * t)) / abs(k)))); else tmp = Float64(Float64(Float64(l + l) * Float64(Float64(cos(abs(k)) * l) / Float64(Float64(fma(cos(Float64(abs(k) + abs(k))), -0.5, 0.5) * t) * abs(k)))) / abs(k)); end return tmp end
code[t_, l_, k_] := If[LessEqual[N[Abs[k], $MachinePrecision], 1.3e-6], N[(2.0 * N[(l * N[(N[(l / N[(N[Power[N[Abs[k], $MachinePrecision], 3.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(l + l), $MachinePrecision] * N[(N[(N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision] / N[(N[(N[(N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision] * t), $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[k], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|k\right| \leq 1.3 \cdot 10^{-6}:\\
\;\;\;\;2 \cdot \left(\ell \cdot \frac{\frac{\ell}{{\left(\left|k\right|\right)}^{3} \cdot t}}{\left|k\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\ell + \ell\right) \cdot \frac{\cos \left(\left|k\right|\right) \cdot \ell}{\left(\mathsf{fma}\left(\cos \left(\left|k\right| + \left|k\right|\right), -0.5, 0.5\right) \cdot t\right) \cdot \left|k\right|}}{\left|k\right|}\\
\end{array}
if k < 1.30000000000000005e-6Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6482.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.9%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6470.4%
Applied rewrites70.4%
if 1.30000000000000005e-6 < k Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6482.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
count-2N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6480.4%
Applied rewrites80.4%
(FPCore (t l k)
:precision binary64
(if (<= (fabs k) 0.00086)
(* 2.0 (* l (/ (/ l (* (pow (fabs k) 3.0) t)) (fabs k))))
(*
(*
(cos (fabs k))
(/
l
(*
(* (* (fma (cos (+ (fabs k) (fabs k))) -0.5 0.5) t) (fabs k))
(fabs k))))
(+ l l))))double code(double t, double l, double k) {
double tmp;
if (fabs(k) <= 0.00086) {
tmp = 2.0 * (l * ((l / (pow(fabs(k), 3.0) * t)) / fabs(k)));
} else {
tmp = (cos(fabs(k)) * (l / (((fma(cos((fabs(k) + fabs(k))), -0.5, 0.5) * t) * fabs(k)) * fabs(k)))) * (l + l);
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (abs(k) <= 0.00086) tmp = Float64(2.0 * Float64(l * Float64(Float64(l / Float64((abs(k) ^ 3.0) * t)) / abs(k)))); else tmp = Float64(Float64(cos(abs(k)) * Float64(l / Float64(Float64(Float64(fma(cos(Float64(abs(k) + abs(k))), -0.5, 0.5) * t) * abs(k)) * abs(k)))) * Float64(l + l)); end return tmp end
code[t_, l_, k_] := If[LessEqual[N[Abs[k], $MachinePrecision], 0.00086], N[(2.0 * N[(l * N[(N[(l / N[(N[Power[N[Abs[k], $MachinePrecision], 3.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[N[Abs[k], $MachinePrecision]], $MachinePrecision] * N[(l / N[(N[(N[(N[(N[Cos[N[(N[Abs[k], $MachinePrecision] + N[Abs[k], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision] * t), $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision] * N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l + l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|k\right| \leq 0.00086:\\
\;\;\;\;2 \cdot \left(\ell \cdot \frac{\frac{\ell}{{\left(\left|k\right|\right)}^{3} \cdot t}}{\left|k\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\cos \left(\left|k\right|\right) \cdot \frac{\ell}{\left(\left(\mathsf{fma}\left(\cos \left(\left|k\right| + \left|k\right|\right), -0.5, 0.5\right) \cdot t\right) \cdot \left|k\right|\right) \cdot \left|k\right|}\right) \cdot \left(\ell + \ell\right)\\
\end{array}
if k < 8.59999999999999979e-4Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6482.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.9%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6470.4%
Applied rewrites70.4%
if 8.59999999999999979e-4 < k Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6482.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.9%
lift-*.f64N/A
count-2-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
lift-+.f64N/A
lower-*.f6482.9%
Applied rewrites78.6%
(FPCore (t l k)
:precision binary64
(if (<= (* l l) 1e+244)
(*
(/
(fma -0.3333333333333333 (/ l t) (* 2.0 (/ l (* (pow k 2.0) t))))
(pow k 2.0))
l)
(* 2.0 (* l (* l (/ (cos k) (* (* (* (- 0.5 0.5) t) k) k)))))))double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+244) {
tmp = (fma(-0.3333333333333333, (l / t), (2.0 * (l / (pow(k, 2.0) * t)))) / pow(k, 2.0)) * l;
} else {
tmp = 2.0 * (l * (l * (cos(k) / ((((0.5 - 0.5) * t) * k) * k))));
}
return tmp;
}
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 1e+244) tmp = Float64(Float64(fma(-0.3333333333333333, Float64(l / t), Float64(2.0 * Float64(l / Float64((k ^ 2.0) * t)))) / (k ^ 2.0)) * l); else tmp = Float64(2.0 * Float64(l * Float64(l * Float64(cos(k) / Float64(Float64(Float64(Float64(0.5 - 0.5) * t) * k) * k))))); end return tmp end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 1e+244], N[(N[(N[(-0.3333333333333333 * N[(l / t), $MachinePrecision] + N[(2.0 * N[(l / N[(N[Power[k, 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision], N[(2.0 * N[(l * N[(l * N[(N[Cos[k], $MachinePrecision] / N[(N[(N[(N[(0.5 - 0.5), $MachinePrecision] * t), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 10^{+244}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{\ell}{t}, 2 \cdot \frac{\ell}{{k}^{2} \cdot t}\right)}{{k}^{2}} \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\ell \cdot \left(\ell \cdot \frac{\cos k}{\left(\left(\left(0.5 - 0.5\right) \cdot t\right) \cdot k\right) \cdot k}\right)\right)\\
\end{array}
if (*.f64 l l) < 1.00000000000000007e244Initial program 36.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
associate-/r/N/A
Applied rewrites38.4%
Taylor expanded in k around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6450.6%
Applied rewrites50.6%
Taylor expanded in k around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6467.0%
Applied rewrites67.0%
if 1.00000000000000007e244 < (*.f64 l l) Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6482.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites78.6%
Taylor expanded in k around 0
Applied rewrites41.9%
(FPCore (t l k)
:precision binary64
(*
(copysign 1.0 t)
(if (<= (fabs t) 5.5e-113)
(* (* l (/ (* l (pow k -4.0)) (fabs t))) 2.0)
(*
(/
(fma
-0.3333333333333333
(/ l (fabs t))
(* 2.0 (/ l (* (pow k 2.0) (fabs t)))))
(pow k 2.0))
l))))double code(double t, double l, double k) {
double tmp;
if (fabs(t) <= 5.5e-113) {
tmp = (l * ((l * pow(k, -4.0)) / fabs(t))) * 2.0;
} else {
tmp = (fma(-0.3333333333333333, (l / fabs(t)), (2.0 * (l / (pow(k, 2.0) * fabs(t))))) / pow(k, 2.0)) * l;
}
return copysign(1.0, t) * tmp;
}
function code(t, l, k) tmp = 0.0 if (abs(t) <= 5.5e-113) tmp = Float64(Float64(l * Float64(Float64(l * (k ^ -4.0)) / abs(t))) * 2.0); else tmp = Float64(Float64(fma(-0.3333333333333333, Float64(l / abs(t)), Float64(2.0 * Float64(l / Float64((k ^ 2.0) * abs(t))))) / (k ^ 2.0)) * l); end return Float64(copysign(1.0, t) * tmp) end
code[t_, l_, k_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[t], $MachinePrecision], 5.5e-113], N[(N[(l * N[(N[(l * N[Power[k, -4.0], $MachinePrecision]), $MachinePrecision] / N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(N[(-0.3333333333333333 * N[(l / N[Abs[t], $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l / N[(N[Power[k, 2.0], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, t\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|t\right| \leq 5.5 \cdot 10^{-113}:\\
\;\;\;\;\left(\ell \cdot \frac{\ell \cdot {k}^{-4}}{\left|t\right|}\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.3333333333333333, \frac{\ell}{\left|t\right|}, 2 \cdot \frac{\ell}{{k}^{2} \cdot \left|t\right|}\right)}{{k}^{2}} \cdot \ell\\
\end{array}
if t < 5.50000000000000053e-113Initial program 36.3%
Taylor expanded in k around 0
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f6462.4%
Applied rewrites62.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.4%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.4%
Applied rewrites68.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift-pow.f64N/A
pow-flipN/A
lower-pow.f64N/A
metadata-eval69.1%
Applied rewrites69.1%
if 5.50000000000000053e-113 < t Initial program 36.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
associate-/r/N/A
Applied rewrites38.4%
Taylor expanded in k around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6450.6%
Applied rewrites50.6%
Taylor expanded in k around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6467.0%
Applied rewrites67.0%
(FPCore (t l k) :precision binary64 (if (<= (fabs k) 2.7e+51) (* 2.0 (* l (/ (/ l (* (pow (fabs k) 3.0) t)) (fabs k)))) (* (* -0.3333333333333333 (/ l (* (pow (fabs k) 2.0) t))) l)))
double code(double t, double l, double k) {
double tmp;
if (fabs(k) <= 2.7e+51) {
tmp = 2.0 * (l * ((l / (pow(fabs(k), 3.0) * t)) / fabs(k)));
} else {
tmp = (-0.3333333333333333 * (l / (pow(fabs(k), 2.0) * t))) * 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) :: tmp
if (abs(k) <= 2.7d+51) then
tmp = 2.0d0 * (l * ((l / ((abs(k) ** 3.0d0) * t)) / abs(k)))
else
tmp = ((-0.3333333333333333d0) * (l / ((abs(k) ** 2.0d0) * t))) * l
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (Math.abs(k) <= 2.7e+51) {
tmp = 2.0 * (l * ((l / (Math.pow(Math.abs(k), 3.0) * t)) / Math.abs(k)));
} else {
tmp = (-0.3333333333333333 * (l / (Math.pow(Math.abs(k), 2.0) * t))) * l;
}
return tmp;
}
def code(t, l, k): tmp = 0 if math.fabs(k) <= 2.7e+51: tmp = 2.0 * (l * ((l / (math.pow(math.fabs(k), 3.0) * t)) / math.fabs(k))) else: tmp = (-0.3333333333333333 * (l / (math.pow(math.fabs(k), 2.0) * t))) * l return tmp
function code(t, l, k) tmp = 0.0 if (abs(k) <= 2.7e+51) tmp = Float64(2.0 * Float64(l * Float64(Float64(l / Float64((abs(k) ^ 3.0) * t)) / abs(k)))); else tmp = Float64(Float64(-0.3333333333333333 * Float64(l / Float64((abs(k) ^ 2.0) * t))) * l); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (abs(k) <= 2.7e+51) tmp = 2.0 * (l * ((l / ((abs(k) ^ 3.0) * t)) / abs(k))); else tmp = (-0.3333333333333333 * (l / ((abs(k) ^ 2.0) * t))) * l; end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[Abs[k], $MachinePrecision], 2.7e+51], N[(2.0 * N[(l * N[(N[(l / N[(N[Power[N[Abs[k], $MachinePrecision], 3.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[Abs[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.3333333333333333 * N[(l / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|k\right| \leq 2.7 \cdot 10^{+51}:\\
\;\;\;\;2 \cdot \left(\ell \cdot \frac{\frac{\ell}{{\left(\left|k\right|\right)}^{3} \cdot t}}{\left|k\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-0.3333333333333333 \cdot \frac{\ell}{{\left(\left|k\right|\right)}^{2} \cdot t}\right) \cdot \ell\\
\end{array}
if k < 2.69999999999999992e51Initial program 36.3%
Taylor expanded in t around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-sin.f6473.7%
Applied rewrites73.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-pow.f64N/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6482.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites78.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites82.9%
Taylor expanded in k around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6470.4%
Applied rewrites70.4%
if 2.69999999999999992e51 < k Initial program 36.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
associate-/r/N/A
Applied rewrites38.4%
Taylor expanded in k around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6450.6%
Applied rewrites50.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6430.1%
Applied rewrites30.1%
(FPCore (t l k) :precision binary64 (if (<= (fabs k) 2.1e+51) (* (/ (* (+ l l) (pow (fabs k) -4.0)) t) l) (* (* -0.3333333333333333 (/ l (* (pow (fabs k) 2.0) t))) l)))
double code(double t, double l, double k) {
double tmp;
if (fabs(k) <= 2.1e+51) {
tmp = (((l + l) * pow(fabs(k), -4.0)) / t) * l;
} else {
tmp = (-0.3333333333333333 * (l / (pow(fabs(k), 2.0) * t))) * 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) :: tmp
if (abs(k) <= 2.1d+51) then
tmp = (((l + l) * (abs(k) ** (-4.0d0))) / t) * l
else
tmp = ((-0.3333333333333333d0) * (l / ((abs(k) ** 2.0d0) * t))) * l
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (Math.abs(k) <= 2.1e+51) {
tmp = (((l + l) * Math.pow(Math.abs(k), -4.0)) / t) * l;
} else {
tmp = (-0.3333333333333333 * (l / (Math.pow(Math.abs(k), 2.0) * t))) * l;
}
return tmp;
}
def code(t, l, k): tmp = 0 if math.fabs(k) <= 2.1e+51: tmp = (((l + l) * math.pow(math.fabs(k), -4.0)) / t) * l else: tmp = (-0.3333333333333333 * (l / (math.pow(math.fabs(k), 2.0) * t))) * l return tmp
function code(t, l, k) tmp = 0.0 if (abs(k) <= 2.1e+51) tmp = Float64(Float64(Float64(Float64(l + l) * (abs(k) ^ -4.0)) / t) * l); else tmp = Float64(Float64(-0.3333333333333333 * Float64(l / Float64((abs(k) ^ 2.0) * t))) * l); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (abs(k) <= 2.1e+51) tmp = (((l + l) * (abs(k) ^ -4.0)) / t) * l; else tmp = (-0.3333333333333333 * (l / ((abs(k) ^ 2.0) * t))) * l; end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[Abs[k], $MachinePrecision], 2.1e+51], N[(N[(N[(N[(l + l), $MachinePrecision] * N[Power[N[Abs[k], $MachinePrecision], -4.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * l), $MachinePrecision], N[(N[(-0.3333333333333333 * N[(l / N[(N[Power[N[Abs[k], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|k\right| \leq 2.1 \cdot 10^{+51}:\\
\;\;\;\;\frac{\left(\ell + \ell\right) \cdot {\left(\left|k\right|\right)}^{-4}}{t} \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\left(-0.3333333333333333 \cdot \frac{\ell}{{\left(\left|k\right|\right)}^{2} \cdot t}\right) \cdot \ell\\
\end{array}
if k < 2.1000000000000001e51Initial program 36.3%
Taylor expanded in k around 0
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f6462.4%
Applied rewrites62.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.4%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.4%
Applied rewrites68.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
count-2-revN/A
lower-+.f6468.4%
Applied rewrites68.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift-pow.f64N/A
pow-flipN/A
lower-pow.f64N/A
metadata-eval69.1%
Applied rewrites69.1%
if 2.1000000000000001e51 < k Initial program 36.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
associate-/r/N/A
Applied rewrites38.4%
Taylor expanded in k around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6450.6%
Applied rewrites50.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6430.1%
Applied rewrites30.1%
(FPCore (t l k) :precision binary64 (* (* l (/ (* l (pow k -4.0)) t)) 2.0))
double code(double t, double l, double k) {
return (l * ((l * pow(k, -4.0)) / t)) * 2.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(t, l, k)
use fmin_fmax_functions
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (l * ((l * (k ** (-4.0d0))) / t)) * 2.0d0
end function
public static double code(double t, double l, double k) {
return (l * ((l * Math.pow(k, -4.0)) / t)) * 2.0;
}
def code(t, l, k): return (l * ((l * math.pow(k, -4.0)) / t)) * 2.0
function code(t, l, k) return Float64(Float64(l * Float64(Float64(l * (k ^ -4.0)) / t)) * 2.0) end
function tmp = code(t, l, k) tmp = (l * ((l * (k ^ -4.0)) / t)) * 2.0; end
code[t_, l_, k_] := N[(N[(l * N[(N[(l * N[Power[k, -4.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]
\left(\ell \cdot \frac{\ell \cdot {k}^{-4}}{t}\right) \cdot 2
Initial program 36.3%
Taylor expanded in k around 0
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f6462.4%
Applied rewrites62.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.4%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.4%
Applied rewrites68.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift-pow.f64N/A
pow-flipN/A
lower-pow.f64N/A
metadata-eval69.1%
Applied rewrites69.1%
(FPCore (t l k) :precision binary64 (* (/ (* (+ l l) (pow k -4.0)) t) l))
double code(double t, double l, double k) {
return (((l + l) * pow(k, -4.0)) / t) * 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 + l) * (k ** (-4.0d0))) / t) * l
end function
public static double code(double t, double l, double k) {
return (((l + l) * Math.pow(k, -4.0)) / t) * l;
}
def code(t, l, k): return (((l + l) * math.pow(k, -4.0)) / t) * l
function code(t, l, k) return Float64(Float64(Float64(Float64(l + l) * (k ^ -4.0)) / t) * l) end
function tmp = code(t, l, k) tmp = (((l + l) * (k ^ -4.0)) / t) * l; end
code[t_, l_, k_] := N[(N[(N[(N[(l + l), $MachinePrecision] * N[Power[k, -4.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * l), $MachinePrecision]
\frac{\left(\ell + \ell\right) \cdot {k}^{-4}}{t} \cdot \ell
Initial program 36.3%
Taylor expanded in k around 0
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f6462.4%
Applied rewrites62.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.4%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.4%
Applied rewrites68.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
count-2-revN/A
lower-+.f6468.4%
Applied rewrites68.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift-pow.f64N/A
pow-flipN/A
lower-pow.f64N/A
metadata-eval69.1%
Applied rewrites69.1%
(FPCore (t l k) :precision binary64 (* (* (+ l l) (pow k -4.0)) (/ l t)))
double code(double t, double l, double k) {
return ((l + l) * pow(k, -4.0)) * (l / 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 ** (-4.0d0))) * (l / t)
end function
public static double code(double t, double l, double k) {
return ((l + l) * Math.pow(k, -4.0)) * (l / t);
}
def code(t, l, k): return ((l + l) * math.pow(k, -4.0)) * (l / t)
function code(t, l, k) return Float64(Float64(Float64(l + l) * (k ^ -4.0)) * Float64(l / t)) end
function tmp = code(t, l, k) tmp = ((l + l) * (k ^ -4.0)) * (l / t); end
code[t_, l_, k_] := N[(N[(N[(l + l), $MachinePrecision] * N[Power[k, -4.0], $MachinePrecision]), $MachinePrecision] * N[(l / t), $MachinePrecision]), $MachinePrecision]
\left(\left(\ell + \ell\right) \cdot {k}^{-4}\right) \cdot \frac{\ell}{t}
Initial program 36.3%
Taylor expanded in k around 0
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
lower-pow.f6462.4%
Applied rewrites62.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.4%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.4%
Applied rewrites68.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
count-2-revN/A
lower-+.f6468.4%
Applied rewrites68.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
lower-*.f64N/A
mult-flipN/A
lower-*.f64N/A
lift-pow.f64N/A
pow-flipN/A
lower-pow.f64N/A
metadata-eval67.5%
Applied rewrites67.5%
herbie shell --seed 2025181
(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))))