
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / 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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / 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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))))
(t_1 (/ D (+ d d))))
(if (<= t_0 5e+110)
(* w0 t_0)
(* w0 (sqrt (- 1.0 (* (* t_1 M) (/ (* (* t_1 h) M) l))))))))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
double t_1 = D / (d + d);
double tmp;
if (t_0 <= 5e+110) {
tmp = w0 * t_0;
} else {
tmp = w0 * sqrt((1.0 - ((t_1 * M) * (((t_1 * h) * M) / 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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
t_1 = d / (d_1 + d_1)
if (t_0 <= 5d+110) then
tmp = w0 * t_0
else
tmp = w0 * sqrt((1.0d0 - ((t_1 * m) * (((t_1 * h) * m) / l))))
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
double t_1 = D / (d + d);
double tmp;
if (t_0 <= 5e+110) {
tmp = w0 * t_0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((t_1 * M) * (((t_1 * h) * M) / l))));
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)))) t_1 = D / (d + d) tmp = 0 if t_0 <= 5e+110: tmp = w0 * t_0 else: tmp = w0 * math.sqrt((1.0 - ((t_1 * M) * (((t_1 * h) * M) / l)))) return tmp
function code(w0, M, D, h, l, d) t_0 = sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))) t_1 = Float64(D / Float64(d + d)) tmp = 0.0 if (t_0 <= 5e+110) tmp = Float64(w0 * t_0); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(t_1 * M) * Float64(Float64(Float64(t_1 * h) * M) / l))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); t_1 = D / (d + d); tmp = 0.0; if (t_0 <= 5e+110) tmp = w0 * t_0; else tmp = w0 * sqrt((1.0 - ((t_1 * M) * (((t_1 * h) * M) / l)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+110], N[(w0 * t$95$0), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(t$95$1 * M), $MachinePrecision] * N[(N[(N[(t$95$1 * h), $MachinePrecision] * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\\
t_1 := \frac{D}{d + d}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+110}:\\
\;\;\;\;w0 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(t\_1 \cdot M\right) \cdot \frac{\left(t\_1 \cdot h\right) \cdot M}{\ell}}\\
\end{array}
\end{array}
if (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))) < 4.99999999999999978e110Initial program 99.8%
if 4.99999999999999978e110 < (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))) Initial program 44.8%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites62.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lower-*.f6467.5
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f6467.5
Applied rewrites67.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.9
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
*-commutativeN/A
lower-*.f6466.2
Applied rewrites66.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6467.9
Applied rewrites67.9%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (/ D (+ d d)))
(t_1 (* M t_0))
(t_2 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
(if (<= t_2 1.0)
w0
(if (<= t_2 5e+110)
(* (sqrt (- 1.0 (* (* t_1 t_1) (/ h l)))) w0)
(* w0 (sqrt (- 1.0 (* (* t_0 M) (/ (* (* t_0 h) M) l)))))))))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D / (d + d);
double t_1 = M * t_0;
double t_2 = sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
double tmp;
if (t_2 <= 1.0) {
tmp = w0;
} else if (t_2 <= 5e+110) {
tmp = sqrt((1.0 - ((t_1 * t_1) * (h / l)))) * w0;
} else {
tmp = w0 * sqrt((1.0 - ((t_0 * M) * (((t_0 * h) * M) / 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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d / (d_1 + d_1)
t_1 = m * t_0
t_2 = sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
if (t_2 <= 1.0d0) then
tmp = w0
else if (t_2 <= 5d+110) then
tmp = sqrt((1.0d0 - ((t_1 * t_1) * (h / l)))) * w0
else
tmp = w0 * sqrt((1.0d0 - ((t_0 * m) * (((t_0 * h) * m) / l))))
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D / (d + d);
double t_1 = M * t_0;
double t_2 = Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
double tmp;
if (t_2 <= 1.0) {
tmp = w0;
} else if (t_2 <= 5e+110) {
tmp = Math.sqrt((1.0 - ((t_1 * t_1) * (h / l)))) * w0;
} else {
tmp = w0 * Math.sqrt((1.0 - ((t_0 * M) * (((t_0 * h) * M) / l))));
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = D / (d + d) t_1 = M * t_0 t_2 = math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)))) tmp = 0 if t_2 <= 1.0: tmp = w0 elif t_2 <= 5e+110: tmp = math.sqrt((1.0 - ((t_1 * t_1) * (h / l)))) * w0 else: tmp = w0 * math.sqrt((1.0 - ((t_0 * M) * (((t_0 * h) * M) / l)))) return tmp
function code(w0, M, D, h, l, d) t_0 = Float64(D / Float64(d + d)) t_1 = Float64(M * t_0) t_2 = sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))) tmp = 0.0 if (t_2 <= 1.0) tmp = w0; elseif (t_2 <= 5e+110) tmp = Float64(sqrt(Float64(1.0 - Float64(Float64(t_1 * t_1) * Float64(h / l)))) * w0); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(t_0 * M) * Float64(Float64(Float64(t_0 * h) * M) / l))))); end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = D / (d + d); t_1 = M * t_0; t_2 = sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); tmp = 0.0; if (t_2 <= 1.0) tmp = w0; elseif (t_2 <= 5e+110) tmp = sqrt((1.0 - ((t_1 * t_1) * (h / l)))) * w0; else tmp = w0 * sqrt((1.0 - ((t_0 * M) * (((t_0 * h) * M) / l)))); end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 1.0], w0, If[LessEqual[t$95$2, 5e+110], N[(N[Sqrt[N[(1.0 - N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(t$95$0 * M), $MachinePrecision] * N[(N[(N[(t$95$0 * h), $MachinePrecision] * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{D}{d + d}\\
t_1 := M \cdot t\_0\\
t_2 := \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathbf{if}\;t\_2 \leq 1:\\
\;\;\;\;w0\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+110}:\\
\;\;\;\;\sqrt{1 - \left(t\_1 \cdot t\_1\right) \cdot \frac{h}{\ell}} \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(t\_0 \cdot M\right) \cdot \frac{\left(t\_0 \cdot h\right) \cdot M}{\ell}}\\
\end{array}
\end{array}
if (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))) < 1Initial program 99.9%
Taylor expanded in M around 0
Applied rewrites99.6%
if 1 < (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))) < 4.99999999999999978e110Initial program 99.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.2%
if 4.99999999999999978e110 < (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))) Initial program 44.8%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites62.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lower-*.f6467.5
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f6467.5
Applied rewrites67.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.9
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
*-commutativeN/A
lower-*.f6466.2
Applied rewrites66.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6467.9
Applied rewrites67.9%
(FPCore (w0 M D h l d) :precision binary64 (let* ((t_0 (/ D (+ d d)))) (* w0 (sqrt (- 1.0 (* (* t_0 M) (/ (* t_0 (* h M)) l)))))))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D / (d + d);
return w0 * sqrt((1.0 - ((t_0 * M) * ((t_0 * (h * M)) / 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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
t_0 = d / (d_1 + d_1)
code = w0 * sqrt((1.0d0 - ((t_0 * m) * ((t_0 * (h * m)) / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = D / (d + d);
return w0 * Math.sqrt((1.0 - ((t_0 * M) * ((t_0 * (h * M)) / l))));
}
def code(w0, M, D, h, l, d): t_0 = D / (d + d) return w0 * math.sqrt((1.0 - ((t_0 * M) * ((t_0 * (h * M)) / l))))
function code(w0, M, D, h, l, d) t_0 = Float64(D / Float64(d + d)) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(t_0 * M) * Float64(Float64(t_0 * Float64(h * M)) / l))))) end
function tmp = code(w0, M, D, h, l, d) t_0 = D / (d + d); tmp = w0 * sqrt((1.0 - ((t_0 * M) * ((t_0 * (h * M)) / l)))); end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(t$95$0 * M), $MachinePrecision] * N[(N[(t$95$0 * N[(h * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{D}{d + d}\\
w0 \cdot \sqrt{1 - \left(t\_0 \cdot M\right) \cdot \frac{t\_0 \cdot \left(h \cdot M\right)}{\ell}}
\end{array}
\end{array}
Initial program 81.4%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites86.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lower-*.f6487.8
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f6487.8
Applied rewrites87.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6488.6
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
*-commutativeN/A
lower-*.f6485.0
Applied rewrites85.0%
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (* M (/ D (+ d d)))))
(if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e-13)
(* (sqrt (- 1.0 (* (* t_0 t_0) (/ h l)))) w0)
w0)))
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = M * (D / (d + d));
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13) {
tmp = sqrt((1.0 - ((t_0 * t_0) * (h / l)))) * w0;
} else {
tmp = w0;
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = m * (d / (d_1 + d_1))
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-2d-13)) then
tmp = sqrt((1.0d0 - ((t_0 * t_0) * (h / l)))) * w0
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = M * (D / (d + d));
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13) {
tmp = Math.sqrt((1.0 - ((t_0 * t_0) * (h / l)))) * w0;
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): t_0 = M * (D / (d + d)) tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13: tmp = math.sqrt((1.0 - ((t_0 * t_0) * (h / l)))) * w0 else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) t_0 = Float64(M * Float64(D / Float64(d + d))) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e-13) tmp = Float64(sqrt(Float64(1.0 - Float64(Float64(t_0 * t_0) * Float64(h / l)))) * w0); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = M * (D / (d + d)); tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -2e-13) tmp = sqrt((1.0 - ((t_0 * t_0) * (h / l)))) * w0; else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(M * N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-13], N[(N[Sqrt[N[(1.0 - N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], w0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := M \cdot \frac{D}{d + d}\\
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-13}:\\
\;\;\;\;\sqrt{1 - \left(t\_0 \cdot t\_0\right) \cdot \frac{h}{\ell}} \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2.0000000000000001e-13Initial program 65.3%
lift-*.f64N/A
lift-sqrt.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites65.4%
if -2.0000000000000001e-13 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.8%
Taylor expanded in M around 0
Applied rewrites96.2%
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e-12)
(*
w0
(sqrt (- 1.0 (* (* (/ D (+ d d)) M) (/ (* 0.5 (* (* M D) h)) (* l d))))))
w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e-12) {
tmp = w0 * sqrt((1.0 - (((D / (d + d)) * M) * ((0.5 * ((M * D) * h)) / (l * d)))));
} else {
tmp = w0;
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-5d-12)) then
tmp = w0 * sqrt((1.0d0 - (((d / (d_1 + d_1)) * m) * ((0.5d0 * ((m * d) * h)) / (l * d_1)))))
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e-12) {
tmp = w0 * Math.sqrt((1.0 - (((D / (d + d)) * M) * ((0.5 * ((M * D) * h)) / (l * d)))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e-12: tmp = w0 * math.sqrt((1.0 - (((D / (d + d)) * M) * ((0.5 * ((M * D) * h)) / (l * d))))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e-12) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(D / Float64(d + d)) * M) * Float64(Float64(0.5 * Float64(Float64(M * D) * h)) / Float64(l * d)))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -5e-12) tmp = w0 * sqrt((1.0 - (((D / (d + d)) * M) * ((0.5 * ((M * D) * h)) / (l * d))))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e-12], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * N[(N[(0.5 * N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{-12}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{D}{d + d} \cdot M\right) \cdot \frac{0.5 \cdot \left(\left(M \cdot D\right) \cdot h\right)}{\ell \cdot d}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.9999999999999997e-12Initial program 65.3%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lower-*.f6466.3
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f6466.3
Applied rewrites66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6468.7
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
*-commutativeN/A
lower-*.f6464.7
Applied rewrites64.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.4
Applied rewrites62.4%
if -4.9999999999999997e-12 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.8%
Taylor expanded in M around 0
Applied rewrites96.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e-13) (* w0 (sqrt (- 1.0 (* (* (/ (/ (* (* M (* M D)) D) d) d) 0.25) (/ h l))))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13) {
tmp = w0 * sqrt((1.0 - ((((((M * (M * D)) * D) / d) / d) * 0.25) * (h / l))));
} else {
tmp = w0;
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-2d-13)) then
tmp = w0 * sqrt((1.0d0 - ((((((m * (m * d)) * d) / d_1) / d_1) * 0.25d0) * (h / l))))
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13) {
tmp = w0 * Math.sqrt((1.0 - ((((((M * (M * D)) * D) / d) / d) * 0.25) * (h / l))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13: tmp = w0 * math.sqrt((1.0 - ((((((M * (M * D)) * D) / d) / d) * 0.25) * (h / l)))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e-13) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * Float64(M * D)) * D) / d) / d) * 0.25) * Float64(h / l))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -2e-13) tmp = w0 * sqrt((1.0 - ((((((M * (M * D)) * D) / d) / d) * 0.25) * (h / l)))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-13], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(N[(M * N[(M * D), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-13}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{\frac{\left(M \cdot \left(M \cdot D\right)\right) \cdot D}{d}}{d} \cdot 0.25\right) \cdot \frac{h}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2.0000000000000001e-13Initial program 65.3%
Taylor expanded in M around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6440.7
Applied rewrites40.7%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6450.9
Applied rewrites50.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6456.7
Applied rewrites56.7%
if -2.0000000000000001e-13 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.8%
Taylor expanded in M around 0
Applied rewrites96.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e-13) (* w0 (sqrt (- 1.0 (* (* (/ (* (* (* M D) M) (/ D d)) d) 0.25) (/ h l))))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13) {
tmp = w0 * sqrt((1.0 - ((((((M * D) * M) * (D / d)) / d) * 0.25) * (h / l))));
} else {
tmp = w0;
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-2d-13)) then
tmp = w0 * sqrt((1.0d0 - ((((((m * d) * m) * (d / d_1)) / d_1) * 0.25d0) * (h / l))))
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13) {
tmp = w0 * Math.sqrt((1.0 - ((((((M * D) * M) * (D / d)) / d) * 0.25) * (h / l))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13: tmp = w0 * math.sqrt((1.0 - ((((((M * D) * M) * (D / d)) / d) * 0.25) * (h / l)))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e-13) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * D) * M) * Float64(D / d)) / d) * 0.25) * Float64(h / l))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -2e-13) tmp = w0 * sqrt((1.0 - ((((((M * D) * M) * (D / d)) / d) * 0.25) * (h / l)))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-13], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-13}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{\left(\left(M \cdot D\right) \cdot M\right) \cdot \frac{D}{d}}{d} \cdot 0.25\right) \cdot \frac{h}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2.0000000000000001e-13Initial program 65.3%
Taylor expanded in M around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6440.7
Applied rewrites40.7%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6450.9
Applied rewrites50.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6456.7
Applied rewrites56.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6459.0
Applied rewrites59.0%
if -2.0000000000000001e-13 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.8%
Taylor expanded in M around 0
Applied rewrites96.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e-13) (* w0 (sqrt (- 1.0 (* (* (/ (* (* D M) (* D M)) (* d d)) 0.25) (/ h l))))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13) {
tmp = w0 * sqrt((1.0 - (((((D * M) * (D * M)) / (d * d)) * 0.25) * (h / l))));
} else {
tmp = w0;
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-2d-13)) then
tmp = w0 * sqrt((1.0d0 - (((((d * m) * (d * m)) / (d_1 * d_1)) * 0.25d0) * (h / l))))
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13) {
tmp = w0 * Math.sqrt((1.0 - (((((D * M) * (D * M)) / (d * d)) * 0.25) * (h / l))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13: tmp = w0 * math.sqrt((1.0 - (((((D * M) * (D * M)) / (d * d)) * 0.25) * (h / l)))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e-13) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D * M) * Float64(D * M)) / Float64(d * d)) * 0.25) * Float64(h / l))))); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -2e-13) tmp = w0 * sqrt((1.0 - (((((D * M) * (D * M)) / (d * d)) * 0.25) * (h / l)))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-13], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-13}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d \cdot d} \cdot 0.25\right) \cdot \frac{h}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2.0000000000000001e-13Initial program 65.3%
Taylor expanded in M around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6440.7
Applied rewrites40.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6452.4
Applied rewrites52.4%
if -2.0000000000000001e-13 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.8%
Taylor expanded in M around 0
Applied rewrites96.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e-13) (* w0 (sqrt (/ (fma (* (* (* M D) (* M D)) (/ h (* d d))) -0.25 l) l))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-13) {
tmp = w0 * sqrt((fma((((M * D) * (M * D)) * (h / (d * d))), -0.25, l) / l));
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e-13) tmp = Float64(w0 * sqrt(Float64(fma(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(h / Float64(d * d))), -0.25, l) / l))); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-13], N[(w0 * N[Sqrt[N[(N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.25 + l), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-13}:\\
\;\;\;\;w0 \cdot \sqrt{\frac{\mathsf{fma}\left(\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{h}{d \cdot d}, -0.25, \ell\right)}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2.0000000000000001e-13Initial program 65.3%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites65.2%
Taylor expanded in l around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-/.f64N/A
Applied rewrites44.0%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
pow2N/A
*-commutativeN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6439.4
Applied rewrites39.4%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f6450.7
Applied rewrites50.7%
if -2.0000000000000001e-13 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.8%
Taylor expanded in M around 0
Applied rewrites96.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e-12) (* w0 (sqrt (fma (* (/ (* (* M D) (* M D)) (* (* d d) l)) -0.25) h 1.0))) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e-12) {
tmp = w0 * sqrt(fma(((((M * D) * (M * D)) / ((d * d) * l)) * -0.25), h, 1.0));
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e-12) tmp = Float64(w0 * sqrt(fma(Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) / Float64(Float64(d * d) * l)) * -0.25), h, 1.0))); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e-12], N[(w0 * N[Sqrt[N[(N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision] * h + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{-12}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\left(d \cdot d\right) \cdot \ell} \cdot -0.25, h, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.9999999999999997e-12Initial program 65.3%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites65.2%
Taylor expanded in l around 0
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-/.f64N/A
Applied rewrites44.0%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
pow2N/A
*-commutativeN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6439.4
Applied rewrites39.4%
Taylor expanded in h around inf
distribute-rgt-inN/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites50.9%
if -4.9999999999999997e-12 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.8%
Taylor expanded in M around 0
Applied rewrites96.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+229) (* w0 (fma (/ (* (* M (* M h)) (* D D)) (* d (* d l))) -0.125 1.0)) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+229) {
tmp = w0 * fma((((M * (M * h)) * (D * D)) / (d * (d * l))), -0.125, 1.0);
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+229) tmp = Float64(w0 * fma(Float64(Float64(Float64(M * Float64(M * h)) * Float64(D * D)) / Float64(d * Float64(d * l))), -0.125, 1.0)); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+229], N[(w0 * N[(N[(N[(N[(M * N[(M * h), $MachinePrecision]), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+229}:\\
\;\;\;\;w0 \cdot \mathsf{fma}\left(\frac{\left(M \cdot \left(M \cdot h\right)\right) \cdot \left(D \cdot D\right)}{d \cdot \left(d \cdot \ell\right)}, -0.125, 1\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000005e229Initial program 57.6%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6442.2
Applied rewrites42.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6443.5
Applied rewrites43.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6445.5
Applied rewrites45.5%
if -5.0000000000000005e229 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.6%
Taylor expanded in M around 0
Applied rewrites89.5%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e-12) (* (fma (* (/ (* (* M D) (* M D)) (* (* d d) l)) -0.125) h 1.0) w0) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e-12) {
tmp = fma(((((M * D) * (M * D)) / ((d * d) * l)) * -0.125), h, 1.0) * w0;
} else {
tmp = w0;
}
return tmp;
}
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e-12) tmp = Float64(fma(Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) / Float64(Float64(d * d) * l)) * -0.125), h, 1.0) * w0); else tmp = w0; end return tmp end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e-12], N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * h + 1.0), $MachinePrecision] * w0), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, 1\right) \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.9999999999999997e-12Initial program 65.3%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6435.7
Applied rewrites35.7%
Taylor expanded in M around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites38.7%
Applied rewrites35.2%
Taylor expanded in h around inf
associate-*l/N/A
associate-*r*N/A
associate-*l/N/A
distribute-rgt-inN/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites42.5%
if -4.9999999999999997e-12 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 88.8%
Taylor expanded in M around 0
Applied rewrites96.2%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+229) (* (* (/ (* (* (* M D) (* M D)) h) (* (* d d) l)) -0.125) w0) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+229) {
tmp = (((((M * D) * (M * D)) * h) / ((d * d) * l)) * -0.125) * w0;
} else {
tmp = w0;
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-5d+229)) then
tmp = (((((m * d) * (m * d)) * h) / ((d_1 * d_1) * l)) * (-0.125d0)) * w0
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+229) {
tmp = (((((M * D) * (M * D)) * h) / ((d * d) * l)) * -0.125) * w0;
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+229: tmp = (((((M * D) * (M * D)) * h) / ((d * d) * l)) * -0.125) * w0 else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+229) tmp = Float64(Float64(Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * h) / Float64(Float64(d * d) * l)) * -0.125) * w0); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -5e+229) tmp = (((((M * D) * (M * D)) * h) / ((d * d) * l)) * -0.125) * w0; else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+229], N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * w0), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+229}:\\
\;\;\;\;\left(\frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot h}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125\right) \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000005e229Initial program 57.6%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6442.2
Applied rewrites42.2%
Taylor expanded in M around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites45.6%
Applied rewrites41.9%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6448.7
Applied rewrites48.7%
if -5.0000000000000005e229 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.6%
Taylor expanded in M around 0
Applied rewrites89.5%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+270) (* (* (/ (* (* M M) (* (* D D) h)) (* d (* l d))) -0.125) w0) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+270) {
tmp = ((((M * M) * ((D * D) * h)) / (d * (l * d))) * -0.125) * w0;
} else {
tmp = w0;
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-5d+270)) then
tmp = ((((m * m) * ((d * d) * h)) / (d_1 * (l * d_1))) * (-0.125d0)) * w0
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+270) {
tmp = ((((M * M) * ((D * D) * h)) / (d * (l * d))) * -0.125) * w0;
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+270: tmp = ((((M * M) * ((D * D) * h)) / (d * (l * d))) * -0.125) * w0 else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+270) tmp = Float64(Float64(Float64(Float64(Float64(M * M) * Float64(Float64(D * D) * h)) / Float64(d * Float64(l * d))) * -0.125) * w0); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -5e+270) tmp = ((((M * M) * ((D * D) * h)) / (d * (l * d))) * -0.125) * w0; else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+270], N[(N[(N[(N[(N[(M * M), $MachinePrecision] * N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * w0), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+270}:\\
\;\;\;\;\left(\frac{\left(M \cdot M\right) \cdot \left(\left(D \cdot D\right) \cdot h\right)}{d \cdot \left(\ell \cdot d\right)} \cdot -0.125\right) \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.99999999999999976e270Initial program 56.2%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6443.3
Applied rewrites43.3%
Taylor expanded in M around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.6%
Applied rewrites42.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6444.9
Applied rewrites44.9%
if -4.99999999999999976e270 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.7%
Taylor expanded in M around 0
Applied rewrites88.6%
(FPCore (w0 M D h l d) :precision binary64 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+270) (* (* (* (* M M) (* (* D D) (/ h (* (* d d) l)))) -0.125) w0) w0))
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+270) {
tmp = (((M * M) * ((D * D) * (h / ((d * d) * l)))) * -0.125) * w0;
} else {
tmp = w0;
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: tmp
if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-5d+270)) then
tmp = (((m * m) * ((d * d) * (h / ((d_1 * d_1) * l)))) * (-0.125d0)) * w0
else
tmp = w0
end if
code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+270) {
tmp = (((M * M) * ((D * D) * (h / ((d * d) * l)))) * -0.125) * w0;
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): tmp = 0 if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+270: tmp = (((M * M) * ((D * D) * (h / ((d * d) * l)))) * -0.125) * w0 else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+270) tmp = Float64(Float64(Float64(Float64(M * M) * Float64(Float64(D * D) * Float64(h / Float64(Float64(d * d) * l)))) * -0.125) * w0); else tmp = w0; end return tmp end
function tmp_2 = code(w0, M, D, h, l, d) tmp = 0.0; if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -5e+270) tmp = (((M * M) * ((D * D) * (h / ((d * d) * l)))) * -0.125) * w0; else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+270], N[(N[(N[(N[(M * M), $MachinePrecision] * N[(N[(D * D), $MachinePrecision] * N[(h / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * w0), $MachinePrecision], w0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+270}:\\
\;\;\;\;\left(\left(\left(M \cdot M\right) \cdot \left(\left(D \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot -0.125\right) \cdot w0\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.99999999999999976e270Initial program 56.2%
Taylor expanded in M around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6443.3
Applied rewrites43.3%
Taylor expanded in M around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites46.6%
Applied rewrites42.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
pow2N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6443.4
Applied rewrites43.4%
if -4.99999999999999976e270 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) Initial program 89.7%
Taylor expanded in M around 0
Applied rewrites88.6%
(FPCore (w0 M D h l d) :precision binary64 w0)
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
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(w0, m, d, h, l, d_1)
use fmin_fmax_functions
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
def code(w0, M, D, h, l, d): return w0
function code(w0, M, D, h, l, d) return w0 end
function tmp = code(w0, M, D, h, l, d) tmp = w0; end
code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
\\
w0
\end{array}
Initial program 81.4%
Taylor expanded in M around 0
Applied rewrites68.0%
herbie shell --seed 2025108
(FPCore (w0 M D h l d)
:name "Henrywood and Agarwal, Equation (9a)"
:precision binary64
(* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))