
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
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(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)
\end{array}
\end{array}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
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(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)
\end{array}
\end{array}
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (* d d) c0))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<= (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))) INFINITY)
(* t_1 (/ (/ (* t_0 2.0) (* (* h w) D)) D))
(* t_1 (* (/ (* (pow (* M D) 2.0) (* h w)) t_0) -0.5)))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (d * d) * c0;
double t_1 = c0 / (2.0 * w);
double t_2 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))))) <= ((double) INFINITY)) {
tmp = t_1 * (((t_0 * 2.0) / ((h * w) * D)) / D);
} else {
tmp = t_1 * (((pow((M * D), 2.0) * (h * w)) / t_0) * -0.5);
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (d * d) * c0;
double t_1 = c0 / (2.0 * w);
double t_2 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_1 * (t_2 + Math.sqrt(((t_2 * t_2) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = t_1 * (((t_0 * 2.0) / ((h * w) * D)) / D);
} else {
tmp = t_1 * (((Math.pow((M * D), 2.0) * (h * w)) / t_0) * -0.5);
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (d * d) * c0 t_1 = c0 / (2.0 * w) t_2 = (c0 * (d * d)) / ((w * h) * (D * D)) tmp = 0 if (t_1 * (t_2 + math.sqrt(((t_2 * t_2) - (M * M))))) <= math.inf: tmp = t_1 * (((t_0 * 2.0) / ((h * w) * D)) / D) else: tmp = t_1 * (((math.pow((M * D), 2.0) * (h * w)) / t_0) * -0.5) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(d * d) * c0) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) <= Inf) tmp = Float64(t_1 * Float64(Float64(Float64(t_0 * 2.0) / Float64(Float64(h * w) * D)) / D)); else tmp = Float64(t_1 * Float64(Float64(Float64((Float64(M * D) ^ 2.0) * Float64(h * w)) / t_0) * -0.5)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (d * d) * c0; t_1 = c0 / (2.0 * w); t_2 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = 0.0; if ((t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))))) <= Inf) tmp = t_1 * (((t_0 * 2.0) / ((h * w) * D)) / D); else tmp = t_1 * (((((M * D) ^ 2.0) * (h * w)) / t_0) * -0.5); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$1 * N[(N[(N[(t$95$0 * 2.0), $MachinePrecision] / N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(d \cdot d\right) \cdot c0\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t\_1 \cdot \frac{\frac{t\_0 \cdot 2}{\left(h \cdot w\right) \cdot D}}{D}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\frac{{\left(M \cdot D\right)}^{2} \cdot \left(h \cdot w\right)}{t\_0} \cdot -0.5\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 75.2%
Taylor expanded in c0 around inf
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6475.9
Applied rewrites75.9%
lift-*.f64N/A
pow2N/A
lower-*.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.4
Applied rewrites77.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites77.8%
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.0%
Taylor expanded in w around 0
lower-/.f64N/A
Applied rewrites6.2%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r*N/A
unpow-prod-downN/A
lower-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f6429.3
Applied rewrites29.3%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w))) (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) -1e-230)
(* t_0 (/ (* 2.0 (* (* d c0) d)) (* (* (* h w) D) D)))
(/ (/ (/ (pow (* d c0) 2.0) (* D w)) (* D w)) h))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= -1e-230) {
tmp = t_0 * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D));
} else {
tmp = ((pow((d * c0), 2.0) / (D * w)) / (D * w)) / h;
}
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(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = c0 / (2.0d0 * w)
t_1 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (m * m))))) <= (-1d-230)) then
tmp = t_0 * ((2.0d0 * ((d_1 * c0) * d_1)) / (((h * w) * d) * d))
else
tmp = ((((d_1 * c0) ** 2.0d0) / (d * w)) / (d * w)) / h
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= -1e-230) {
tmp = t_0 * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D));
} else {
tmp = ((Math.pow((d * c0), 2.0) / (D * w)) / (D * w)) / h;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) tmp = 0 if (t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= -1e-230: tmp = t_0 * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D)) else: tmp = ((math.pow((d * c0), 2.0) / (D * w)) / (D * w)) / h return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= -1e-230) tmp = Float64(t_0 * Float64(Float64(2.0 * Float64(Float64(d * c0) * d)) / Float64(Float64(Float64(h * w) * D) * D))); else tmp = Float64(Float64(Float64((Float64(d * c0) ^ 2.0) / Float64(D * w)) / Float64(D * w)) / h); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = 0.0; if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= -1e-230) tmp = t_0 * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D)); else tmp = ((((d * c0) ^ 2.0) / (D * w)) / (D * w)) / h; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-230], N[(t$95$0 * N[(N[(2.0 * N[(N[(d * c0), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Power[N[(d * c0), $MachinePrecision], 2.0], $MachinePrecision] / N[(D * w), $MachinePrecision]), $MachinePrecision] / N[(D * w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t\_0 \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M \cdot M}\right) \leq -1 \cdot 10^{-230}:\\
\;\;\;\;t\_0 \cdot \frac{2 \cdot \left(\left(d \cdot c0\right) \cdot d\right)}{\left(\left(h \cdot w\right) \cdot D\right) \cdot D}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{{\left(d \cdot c0\right)}^{2}}{D \cdot w}}{D \cdot w}}{h}\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -1.00000000000000005e-230Initial program 78.7%
Taylor expanded in c0 around inf
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.5
Applied rewrites82.5%
lift-*.f64N/A
pow2N/A
lower-*.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6484.1
Applied rewrites84.1%
if -1.00000000000000005e-230 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 16.0%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6426.7
Applied rewrites26.7%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-/r*N/A
unpow-prod-downN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites36.9%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6436.9
Applied rewrites36.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
unpow-prod-downN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
unpow-prod-downN/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f6440.4
Applied rewrites40.4%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<= (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M))))) -1e-230)
(* (/ c0 (+ w w)) (/ (* 2.0 (* (* d d) c0)) (* (* (* h w) D) D)))
(/ (/ (* (* d c0) (* d c0)) (* (* D w) (* D w))) h))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= -1e-230) {
tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D));
} else {
tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h;
}
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(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
if (((c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))) <= (-1d-230)) then
tmp = (c0 / (w + w)) * ((2.0d0 * ((d_1 * d_1) * c0)) / (((h * w) * d) * d))
else
tmp = (((d_1 * c0) * (d_1 * c0)) / ((d * w) * (d * w))) / h
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if (((c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))))) <= -1e-230) {
tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D));
} else {
tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) tmp = 0 if ((c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))) <= -1e-230: tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D)) else: tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) <= -1e-230) tmp = Float64(Float64(c0 / Float64(w + w)) * Float64(Float64(2.0 * Float64(Float64(d * d) * c0)) / Float64(Float64(Float64(h * w) * D) * D))); else tmp = Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / Float64(Float64(D * w) * Float64(D * w))) / h); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = 0.0; if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= -1e-230) tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D)); else tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-230], N[(N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(D * w), $MachinePrecision] * N[(D * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right) \leq -1 \cdot 10^{-230}:\\
\;\;\;\;\frac{c0}{w + w} \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(\left(h \cdot w\right) \cdot D\right) \cdot D}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(D \cdot w\right) \cdot \left(D \cdot w\right)}}{h}\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -1.00000000000000005e-230Initial program 78.7%
Taylor expanded in c0 around inf
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.5
Applied rewrites82.5%
lift-*.f64N/A
count-2-revN/A
lower-+.f6482.5
Applied rewrites82.5%
if -1.00000000000000005e-230 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 16.0%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6426.7
Applied rewrites26.7%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-/r*N/A
unpow-prod-downN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites36.9%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6436.9
Applied rewrites36.9%
lift-pow.f64N/A
unpow2N/A
lower-*.f6436.9
Applied rewrites36.9%
(FPCore (c0 w h D d M) :precision binary64 (if (<= w -1e-289) (* (/ c0 (* 2.0 w)) (/ (* 2.0 (* (* d c0) d)) (* (* (* D h) w) D))) (/ (/ (* (* d c0) (* d c0)) (* (* D w) (* D w))) h)))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (w <= -1e-289) {
tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * c0) * d)) / (((D * h) * w) * D));
} else {
tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h;
}
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(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if (w <= (-1d-289)) then
tmp = (c0 / (2.0d0 * w)) * ((2.0d0 * ((d_1 * c0) * d_1)) / (((d * h) * w) * d))
else
tmp = (((d_1 * c0) * (d_1 * c0)) / ((d * w) * (d * w))) / h
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (w <= -1e-289) {
tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * c0) * d)) / (((D * h) * w) * D));
} else {
tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h;
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if w <= -1e-289: tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * c0) * d)) / (((D * h) * w) * D)) else: tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (w <= -1e-289) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 * Float64(Float64(d * c0) * d)) / Float64(Float64(Float64(D * h) * w) * D))); else tmp = Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / Float64(Float64(D * w) * Float64(D * w))) / h); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (w <= -1e-289) tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * c0) * d)) / (((D * h) * w) * D)); else tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[w, -1e-289], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[(N[(d * c0), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(D * h), $MachinePrecision] * w), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(D * w), $MachinePrecision] * N[(D * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1 \cdot 10^{-289}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\left(d \cdot c0\right) \cdot d\right)}{\left(\left(D \cdot h\right) \cdot w\right) \cdot D}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(D \cdot w\right) \cdot \left(D \cdot w\right)}}{h}\\
\end{array}
\end{array}
if w < -1e-289Initial program 24.3%
Taylor expanded in c0 around inf
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6435.9
Applied rewrites35.9%
lift-*.f64N/A
pow2N/A
lower-*.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6439.6
Applied rewrites39.6%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6440.4
Applied rewrites40.4%
if -1e-289 < w Initial program 25.3%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6433.1
Applied rewrites33.1%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-/r*N/A
unpow-prod-downN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites43.0%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6443.0
Applied rewrites43.0%
lift-pow.f64N/A
unpow2N/A
lower-*.f6443.0
Applied rewrites43.0%
(FPCore (c0 w h D d M) :precision binary64 (if (<= D 1.1e+106) (/ (/ (* (* d c0) (* d c0)) (* (* D w) (* D w))) h) (/ (* (* c0 c0) (* (/ d D) (/ d D))) (* (* w w) h))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (D <= 1.1e+106) {
tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h;
} else {
tmp = ((c0 * c0) * ((d / D) * (d / D))) / ((w * w) * h);
}
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(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: tmp
if (d <= 1.1d+106) then
tmp = (((d_1 * c0) * (d_1 * c0)) / ((d * w) * (d * w))) / h
else
tmp = ((c0 * c0) * ((d_1 / d) * (d_1 / d))) / ((w * w) * h)
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (D <= 1.1e+106) {
tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h;
} else {
tmp = ((c0 * c0) * ((d / D) * (d / D))) / ((w * w) * h);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if D <= 1.1e+106: tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h else: tmp = ((c0 * c0) * ((d / D) * (d / D))) / ((w * w) * h) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (D <= 1.1e+106) tmp = Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / Float64(Float64(D * w) * Float64(D * w))) / h); else tmp = Float64(Float64(Float64(c0 * c0) * Float64(Float64(d / D) * Float64(d / D))) / Float64(Float64(w * w) * h)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (D <= 1.1e+106) tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h; else tmp = ((c0 * c0) * ((d / D) * (d / D))) / ((w * w) * h); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[D, 1.1e+106], N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(D * w), $MachinePrecision] * N[(D * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(c0 * c0), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(w * w), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 1.1 \cdot 10^{+106}:\\
\;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(D \cdot w\right) \cdot \left(D \cdot w\right)}}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(c0 \cdot c0\right) \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{\left(w \cdot w\right) \cdot h}\\
\end{array}
\end{array}
if D < 1.09999999999999996e106Initial program 25.6%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6433.5
Applied rewrites33.5%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-/r*N/A
unpow-prod-downN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites42.9%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6442.9
Applied rewrites42.9%
lift-pow.f64N/A
unpow2N/A
lower-*.f6442.9
Applied rewrites42.9%
if 1.09999999999999996e106 < D Initial program 14.7%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6419.7
Applied rewrites19.7%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow-prod-downN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6439.1
Applied rewrites39.1%
(FPCore (c0 w h D d M) :precision binary64 (/ (/ (* (* d c0) (* d c0)) (* (* D w) (* D w))) h))
double code(double c0, double w, double h, double D, double d, double M) {
return (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h;
}
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(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = (((d_1 * c0) * (d_1 * c0)) / ((d * w) * (d * w))) / h
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h;
}
def code(c0, w, h, D, d, M): return (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h
function code(c0, w, h, D, d, M) return Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / Float64(Float64(D * w) * Float64(D * w))) / h) end
function tmp = code(c0, w, h, D, d, M) tmp = (((d * c0) * (d * c0)) / ((D * w) * (D * w))) / h; end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(D * w), $MachinePrecision] * N[(D * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(D \cdot w\right) \cdot \left(D \cdot w\right)}}{h}
\end{array}
Initial program 24.8%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.5
Applied rewrites32.5%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-/r*N/A
unpow-prod-downN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites42.7%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6442.7
Applied rewrites42.7%
lift-pow.f64N/A
unpow2N/A
lower-*.f6442.7
Applied rewrites42.7%
(FPCore (c0 w h D d M) :precision binary64 (/ (/ (* (* d c0) (* d c0)) (* D D)) (* (* w w) h)))
double code(double c0, double w, double h, double D, double d, double M) {
return (((d * c0) * (d * c0)) / (D * D)) / ((w * w) * h);
}
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(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = (((d_1 * c0) * (d_1 * c0)) / (d * d)) / ((w * w) * h)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (((d * c0) * (d * c0)) / (D * D)) / ((w * w) * h);
}
def code(c0, w, h, D, d, M): return (((d * c0) * (d * c0)) / (D * D)) / ((w * w) * h)
function code(c0, w, h, D, d, M) return Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / Float64(D * D)) / Float64(Float64(w * w) * h)) end
function tmp = code(c0, w, h, D, d, M) tmp = (((d * c0) * (d * c0)) / (D * D)) / ((w * w) * h); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(N[(w * w), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{D \cdot D}}{\left(w \cdot w\right) \cdot h}
\end{array}
Initial program 24.8%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.5
Applied rewrites32.5%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6432.5
Applied rewrites32.5%
(FPCore (c0 w h D d M) :precision binary64 (* (* c0 c0) (/ (* d d) (* (* (* D D) h) (* w w)))))
double code(double c0, double w, double h, double D, double d, double M) {
return (c0 * c0) * ((d * d) / (((D * D) * h) * (w * w)));
}
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(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = (c0 * c0) * ((d_1 * d_1) / (((d * d) * h) * (w * w)))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 * c0) * ((d * d) / (((D * D) * h) * (w * w)));
}
def code(c0, w, h, D, d, M): return (c0 * c0) * ((d * d) / (((D * D) * h) * (w * w)))
function code(c0, w, h, D, d, M) return Float64(Float64(c0 * c0) * Float64(Float64(d * d) / Float64(Float64(Float64(D * D) * h) * Float64(w * w)))) end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 * c0) * ((d * d) / (((D * D) * h) * (w * w))); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 * c0), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(c0 \cdot c0\right) \cdot \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)}
\end{array}
Initial program 24.8%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.5
Applied rewrites32.5%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow-prod-downN/A
pow2N/A
associate-/l/N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites25.3%
(FPCore (c0 w h D d M) :precision binary64 (* (/ c0 (+ w w)) (* (sqrt -1.0) M)))
double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (w + w)) * (sqrt(-1.0) * M);
}
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(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = (c0 / (w + w)) * (sqrt((-1.0d0)) * m)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (w + w)) * (Math.sqrt(-1.0) * M);
}
def code(c0, w, h, D, d, M): return (c0 / (w + w)) * (math.sqrt(-1.0) * M)
function code(c0, w, h, D, d, M) return Float64(Float64(c0 / Float64(w + w)) * Float64(sqrt(-1.0) * M)) end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 / (w + w)) * (sqrt(-1.0) * M); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[-1.0], $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{c0}{w + w} \cdot \left(\sqrt{-1} \cdot M\right)
\end{array}
Initial program 24.8%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
count-2-revN/A
lower-+.f640.0
Applied rewrites0.0%
herbie shell --seed 2025091
(FPCore (c0 w h D d M)
:name "Henrywood and Agarwal, Equation (13)"
:precision binary64
(* (/ c0 (* 2.0 w)) (+ (/ (* c0 (* d d)) (* (* w h) (* D D))) (sqrt (- (* (/ (* c0 (* d d)) (* (* w h) (* D D))) (/ (* c0 (* d d)) (* (* w h) (* D D)))) (* M M))))))