
(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}
Sampling outcomes in binary64 precision:
Herbie found 14 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 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<=
(* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))
INFINITY)
(* (/ c0 (+ w w)) (/ (* 2.0 (* (* d c0) d)) (* (* (* h w) D) D)))
(* (/ (* (pow (* D M) 2.0) h) (* d d)) -0.25))))
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))))) <= ((double) INFINITY)) {
tmp = (c0 / (w + w)) * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D));
} else {
tmp = ((pow((D * M), 2.0) * h) / (d * d)) * -0.25;
}
return tmp;
}
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))))) <= Double.POSITIVE_INFINITY) {
tmp = (c0 / (w + w)) * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D));
} else {
tmp = ((Math.pow((D * M), 2.0) * h) / (d * d)) * -0.25;
}
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))))) <= math.inf: tmp = (c0 / (w + w)) * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D)) else: tmp = ((math.pow((D * M), 2.0) * h) / (d * d)) * -0.25 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))))) <= Inf) tmp = Float64(Float64(c0 / Float64(w + w)) * Float64(Float64(2.0 * Float64(Float64(d * c0) * d)) / Float64(Float64(Float64(h * w) * D) * D))); else tmp = Float64(Float64(Float64((Float64(D * M) ^ 2.0) * h) / Float64(d * d)) * -0.25); 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))))) <= Inf) tmp = (c0 / (w + w)) * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D)); else tmp = ((((D * M) ^ 2.0) * h) / (d * d)) * -0.25; 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], Infinity], N[(N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision] * 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 * M), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * -0.25), $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 \infty:\\
\;\;\;\;\frac{c0}{w + w} \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{{\left(D \cdot M\right)}^{2} \cdot h}{d \cdot d} \cdot -0.25\\
\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 73.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-*.f6476.3
Applied rewrites76.3%
lift-*.f64N/A
count-2-revN/A
lower-+.f6476.3
Applied rewrites76.3%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6477.6
Applied rewrites77.6%
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 D around 0
lower-/.f64N/A
Applied rewrites3.2%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6439.3
Applied rewrites39.3%
Final simplification50.8%
(FPCore (c0 w h D d M)
:precision binary64
(if (<= D 1.12e-75)
(/ (* c0 (* (/ 2.0 (* h (* w D))) (/ (* (* d d) c0) D))) (* w 2.0))
(if (<= D 4.1e+142)
(/ (/ (/ (* (* d c0) (* d c0)) h) (* w w)) (* D D))
(* (/ c0 (* 2.0 w)) (/ (* (* 2.0 (* d d)) (/ c0 (* (* h w) D))) D)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (D <= 1.12e-75) {
tmp = (c0 * ((2.0 / (h * (w * D))) * (((d * d) * c0) / D))) / (w * 2.0);
} else if (D <= 4.1e+142) {
tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D);
} else {
tmp = (c0 / (2.0 * w)) * (((2.0 * (d * d)) * (c0 / ((h * w) * D))) / D);
}
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.12d-75) then
tmp = (c0 * ((2.0d0 / (h * (w * d))) * (((d_1 * d_1) * c0) / d))) / (w * 2.0d0)
else if (d <= 4.1d+142) then
tmp = ((((d_1 * c0) * (d_1 * c0)) / h) / (w * w)) / (d * d)
else
tmp = (c0 / (2.0d0 * w)) * (((2.0d0 * (d_1 * d_1)) * (c0 / ((h * w) * d))) / d)
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.12e-75) {
tmp = (c0 * ((2.0 / (h * (w * D))) * (((d * d) * c0) / D))) / (w * 2.0);
} else if (D <= 4.1e+142) {
tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D);
} else {
tmp = (c0 / (2.0 * w)) * (((2.0 * (d * d)) * (c0 / ((h * w) * D))) / D);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if D <= 1.12e-75: tmp = (c0 * ((2.0 / (h * (w * D))) * (((d * d) * c0) / D))) / (w * 2.0) elif D <= 4.1e+142: tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D) else: tmp = (c0 / (2.0 * w)) * (((2.0 * (d * d)) * (c0 / ((h * w) * D))) / D) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (D <= 1.12e-75) tmp = Float64(Float64(c0 * Float64(Float64(2.0 / Float64(h * Float64(w * D))) * Float64(Float64(Float64(d * d) * c0) / D))) / Float64(w * 2.0)); elseif (D <= 4.1e+142) tmp = Float64(Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / h) / Float64(w * w)) / Float64(D * D)); else tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(2.0 * Float64(d * d)) * Float64(c0 / Float64(Float64(h * w) * D))) / D)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (D <= 1.12e-75) tmp = (c0 * ((2.0 / (h * (w * D))) * (((d * d) * c0) / D))) / (w * 2.0); elseif (D <= 4.1e+142) tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D); else tmp = (c0 / (2.0 * w)) * (((2.0 * (d * d)) * (c0 / ((h * w) * D))) / D); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[D, 1.12e-75], N[(N[(c0 * N[(N[(2.0 / N[(h * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 4.1e+142], N[(N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(2.0 * N[(d * d), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 1.12 \cdot 10^{-75}:\\
\;\;\;\;\frac{c0 \cdot \left(\frac{2}{h \cdot \left(w \cdot D\right)} \cdot \frac{\left(d \cdot d\right) \cdot c0}{D}\right)}{w \cdot 2}\\
\mathbf{elif}\;D \leq 4.1 \cdot 10^{+142}:\\
\;\;\;\;\frac{\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}}{w \cdot w}}{D \cdot D}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{\left(2 \cdot \left(d \cdot d\right)\right) \cdot \frac{c0}{\left(h \cdot w\right) \cdot D}}{D}\\
\end{array}
\end{array}
if D < 1.12000000000000004e-75Initial program 24.0%
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-*.f6438.1
Applied rewrites38.1%
Applied rewrites38.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6442.0
Applied rewrites42.0%
if 1.12000000000000004e-75 < D < 4.09999999999999982e142Initial program 20.6%
Taylor expanded in D around 0
lower-/.f64N/A
Applied rewrites19.2%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6441.7
Applied rewrites41.7%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6441.7
Applied rewrites41.7%
if 4.09999999999999982e142 < D Initial program 0.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-*.f6415.5
Applied rewrites15.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6423.3
Applied rewrites23.3%
lift-/.f64N/A
lift-*.f64N/A
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
lower-/.f64N/A
lift-*.f64N/A
lift-*.f6423.6
Applied rewrites23.6%
Final simplification40.8%
(FPCore (c0 w h D d M) :precision binary64 (if (<= D 8e-111) (* (/ c0 (+ w w)) (/ (/ (/ (* (* 2.0 (* d d)) c0) (* h w)) D) D)) (* (/ c0 (* 2.0 w)) (* (* (/ c0 D) (* (/ d (* h w)) (/ d D))) 2.0))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (D <= 8e-111) {
tmp = (c0 / (w + w)) * (((((2.0 * (d * d)) * c0) / (h * w)) / D) / D);
} else {
tmp = (c0 / (2.0 * w)) * (((c0 / D) * ((d / (h * w)) * (d / D))) * 2.0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 <= 8d-111) then
tmp = (c0 / (w + w)) * (((((2.0d0 * (d_1 * d_1)) * c0) / (h * w)) / d) / d)
else
tmp = (c0 / (2.0d0 * w)) * (((c0 / d) * ((d_1 / (h * w)) * (d_1 / d))) * 2.0d0)
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 <= 8e-111) {
tmp = (c0 / (w + w)) * (((((2.0 * (d * d)) * c0) / (h * w)) / D) / D);
} else {
tmp = (c0 / (2.0 * w)) * (((c0 / D) * ((d / (h * w)) * (d / D))) * 2.0);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if D <= 8e-111: tmp = (c0 / (w + w)) * (((((2.0 * (d * d)) * c0) / (h * w)) / D) / D) else: tmp = (c0 / (2.0 * w)) * (((c0 / D) * ((d / (h * w)) * (d / D))) * 2.0) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (D <= 8e-111) tmp = Float64(Float64(c0 / Float64(w + w)) * Float64(Float64(Float64(Float64(Float64(2.0 * Float64(d * d)) * c0) / Float64(h * w)) / D) / D)); else tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(c0 / D) * Float64(Float64(d / Float64(h * w)) * Float64(d / D))) * 2.0)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (D <= 8e-111) tmp = (c0 / (w + w)) * (((((2.0 * (d * d)) * c0) / (h * w)) / D) / D); else tmp = (c0 / (2.0 * w)) * (((c0 / D) * ((d / (h * w)) * (d / D))) * 2.0); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[D, 8e-111], N[(N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(2.0 * N[(d * d), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] / N[(h * w), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c0 / D), $MachinePrecision] * N[(N[(d / N[(h * w), $MachinePrecision]), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 8 \cdot 10^{-111}:\\
\;\;\;\;\frac{c0}{w + w} \cdot \frac{\frac{\frac{\left(2 \cdot \left(d \cdot d\right)\right) \cdot c0}{h \cdot w}}{D}}{D}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\left(\frac{c0}{D} \cdot \left(\frac{d}{h \cdot w} \cdot \frac{d}{D}\right)\right) \cdot 2\right)\\
\end{array}
\end{array}
if D < 8.00000000000000071e-111Initial program 23.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-*.f6438.0
Applied rewrites38.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6440.6
Applied rewrites40.6%
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
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6442.7
Applied rewrites42.7%
lift-*.f64N/A
count-2-revN/A
lift-+.f6442.7
Applied rewrites42.7%
if 8.00000000000000071e-111 < D Initial program 16.9%
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-*.f6429.6
Applied rewrites29.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6431.6
Applied rewrites31.6%
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
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6431.6
Applied rewrites31.6%
Applied rewrites36.8%
Final simplification41.4%
(FPCore (c0 w h D d M) :precision binary64 (if (<= D 5.4e-77) (* (/ c0 (+ w w)) (/ (/ (/ (* (* 2.0 (* d d)) c0) (* h w)) D) D)) (/ (* c0 (* (/ 2.0 (* (* h w) D)) (/ (* d (* d c0)) D))) (* w 2.0))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (D <= 5.4e-77) {
tmp = (c0 / (w + w)) * (((((2.0 * (d * d)) * c0) / (h * w)) / D) / D);
} else {
tmp = (c0 * ((2.0 / ((h * w) * D)) * ((d * (d * c0)) / D))) / (w * 2.0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 <= 5.4d-77) then
tmp = (c0 / (w + w)) * (((((2.0d0 * (d_1 * d_1)) * c0) / (h * w)) / d) / d)
else
tmp = (c0 * ((2.0d0 / ((h * w) * d)) * ((d_1 * (d_1 * c0)) / d))) / (w * 2.0d0)
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 <= 5.4e-77) {
tmp = (c0 / (w + w)) * (((((2.0 * (d * d)) * c0) / (h * w)) / D) / D);
} else {
tmp = (c0 * ((2.0 / ((h * w) * D)) * ((d * (d * c0)) / D))) / (w * 2.0);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if D <= 5.4e-77: tmp = (c0 / (w + w)) * (((((2.0 * (d * d)) * c0) / (h * w)) / D) / D) else: tmp = (c0 * ((2.0 / ((h * w) * D)) * ((d * (d * c0)) / D))) / (w * 2.0) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (D <= 5.4e-77) tmp = Float64(Float64(c0 / Float64(w + w)) * Float64(Float64(Float64(Float64(Float64(2.0 * Float64(d * d)) * c0) / Float64(h * w)) / D) / D)); else tmp = Float64(Float64(c0 * Float64(Float64(2.0 / Float64(Float64(h * w) * D)) * Float64(Float64(d * Float64(d * c0)) / D))) / Float64(w * 2.0)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (D <= 5.4e-77) tmp = (c0 / (w + w)) * (((((2.0 * (d * d)) * c0) / (h * w)) / D) / D); else tmp = (c0 * ((2.0 / ((h * w) * D)) * ((d * (d * c0)) / D))) / (w * 2.0); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[D, 5.4e-77], N[(N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(2.0 * N[(d * d), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] / N[(h * w), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], N[(N[(c0 * N[(N[(2.0 / N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(N[(d * N[(d * c0), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 5.4 \cdot 10^{-77}:\\
\;\;\;\;\frac{c0}{w + w} \cdot \frac{\frac{\frac{\left(2 \cdot \left(d \cdot d\right)\right) \cdot c0}{h \cdot w}}{D}}{D}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(\frac{2}{\left(h \cdot w\right) \cdot D} \cdot \frac{d \cdot \left(d \cdot c0\right)}{D}\right)}{w \cdot 2}\\
\end{array}
\end{array}
if D < 5.4000000000000001e-77Initial program 23.6%
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-*.f6437.8
Applied rewrites37.8%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6440.3
Applied rewrites40.3%
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
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6442.4
Applied rewrites42.4%
lift-*.f64N/A
count-2-revN/A
lift-+.f6442.4
Applied rewrites42.4%
if 5.4000000000000001e-77 < D Initial program 15.9%
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-*.f6428.7
Applied rewrites28.7%
Applied rewrites31.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6433.2
Applied rewrites33.2%
Final simplification40.6%
(FPCore (c0 w h D d M) :precision binary64 (if (<= D 5e-108) (/ (* c0 (* (/ 2.0 (* h (* w D))) (/ (* (* d d) c0) D))) (* w 2.0)) (/ (* c0 (* (/ 2.0 (* (* h w) D)) (/ (* d (* d c0)) D))) (* w 2.0))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (D <= 5e-108) {
tmp = (c0 * ((2.0 / (h * (w * D))) * (((d * d) * c0) / D))) / (w * 2.0);
} else {
tmp = (c0 * ((2.0 / ((h * w) * D)) * ((d * (d * c0)) / D))) / (w * 2.0);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 <= 5d-108) then
tmp = (c0 * ((2.0d0 / (h * (w * d))) * (((d_1 * d_1) * c0) / d))) / (w * 2.0d0)
else
tmp = (c0 * ((2.0d0 / ((h * w) * d)) * ((d_1 * (d_1 * c0)) / d))) / (w * 2.0d0)
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 <= 5e-108) {
tmp = (c0 * ((2.0 / (h * (w * D))) * (((d * d) * c0) / D))) / (w * 2.0);
} else {
tmp = (c0 * ((2.0 / ((h * w) * D)) * ((d * (d * c0)) / D))) / (w * 2.0);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if D <= 5e-108: tmp = (c0 * ((2.0 / (h * (w * D))) * (((d * d) * c0) / D))) / (w * 2.0) else: tmp = (c0 * ((2.0 / ((h * w) * D)) * ((d * (d * c0)) / D))) / (w * 2.0) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (D <= 5e-108) tmp = Float64(Float64(c0 * Float64(Float64(2.0 / Float64(h * Float64(w * D))) * Float64(Float64(Float64(d * d) * c0) / D))) / Float64(w * 2.0)); else tmp = Float64(Float64(c0 * Float64(Float64(2.0 / Float64(Float64(h * w) * D)) * Float64(Float64(d * Float64(d * c0)) / D))) / Float64(w * 2.0)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (D <= 5e-108) tmp = (c0 * ((2.0 / (h * (w * D))) * (((d * d) * c0) / D))) / (w * 2.0); else tmp = (c0 * ((2.0 / ((h * w) * D)) * ((d * (d * c0)) / D))) / (w * 2.0); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[D, 5e-108], N[(N[(c0 * N[(N[(2.0 / N[(h * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c0 * N[(N[(2.0 / N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(N[(d * N[(d * c0), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;D \leq 5 \cdot 10^{-108}:\\
\;\;\;\;\frac{c0 \cdot \left(\frac{2}{h \cdot \left(w \cdot D\right)} \cdot \frac{\left(d \cdot d\right) \cdot c0}{D}\right)}{w \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(\frac{2}{\left(h \cdot w\right) \cdot D} \cdot \frac{d \cdot \left(d \cdot c0\right)}{D}\right)}{w \cdot 2}\\
\end{array}
\end{array}
if D < 5e-108Initial program 23.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-*.f6438.0
Applied rewrites38.0%
Applied rewrites38.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6442.0
Applied rewrites42.0%
if 5e-108 < D Initial program 16.9%
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-*.f6429.6
Applied rewrites29.6%
Applied rewrites31.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6433.4
Applied rewrites33.4%
(FPCore (c0 w h D d M) :precision binary64 (if (<= d 5.9e-159) (/ (/ (/ (* (* d c0) (* d c0)) h) (* w w)) (* D D)) (* (/ c0 (* 2.0 w)) (/ (* (* (* d d) 2.0) (/ c0 (* (* D h) w))) D))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (d <= 5.9e-159) {
tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D);
} else {
tmp = (c0 / (2.0 * w)) * ((((d * d) * 2.0) * (c0 / ((D * h) * w))) / D);
}
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 <= 5.9d-159) then
tmp = ((((d_1 * c0) * (d_1 * c0)) / h) / (w * w)) / (d * d)
else
tmp = (c0 / (2.0d0 * w)) * ((((d_1 * d_1) * 2.0d0) * (c0 / ((d * h) * w))) / d)
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 <= 5.9e-159) {
tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D);
} else {
tmp = (c0 / (2.0 * w)) * ((((d * d) * 2.0) * (c0 / ((D * h) * w))) / D);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if d <= 5.9e-159: tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D) else: tmp = (c0 / (2.0 * w)) * ((((d * d) * 2.0) * (c0 / ((D * h) * w))) / D) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (d <= 5.9e-159) tmp = Float64(Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / h) / Float64(w * w)) / Float64(D * D)); else tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(Float64(d * d) * 2.0) * Float64(c0 / Float64(Float64(D * h) * w))) / D)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (d <= 5.9e-159) tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D); else tmp = (c0 / (2.0 * w)) * ((((d * d) * 2.0) * (c0 / ((D * h) * w))) / D); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[d, 5.9e-159], N[(N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(d * d), $MachinePrecision] * 2.0), $MachinePrecision] * N[(c0 / N[(N[(D * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 5.9 \cdot 10^{-159}:\\
\;\;\;\;\frac{\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}}{w \cdot w}}{D \cdot D}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{\left(\left(d \cdot d\right) \cdot 2\right) \cdot \frac{c0}{\left(D \cdot h\right) \cdot w}}{D}\\
\end{array}
\end{array}
if d < 5.9e-159Initial program 18.1%
Taylor expanded in D around 0
lower-/.f64N/A
Applied rewrites18.5%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6435.2
Applied rewrites35.2%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6435.2
Applied rewrites35.2%
if 5.9e-159 < d Initial program 26.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-*.f6435.2
Applied rewrites35.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6436.9
Applied rewrites36.9%
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
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6438.5
Applied rewrites38.5%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f6435.9
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6439.7
Applied rewrites39.7%
Final simplification37.4%
(FPCore (c0 w h D d M) :precision binary64 (if (<= d 6.3e-158) (/ (/ (/ (* (* d c0) (* d c0)) h) (* w w)) (* D D)) (* (/ c0 (* 2.0 w)) (* (/ 2.0 (* (* D h) w)) (/ (* (* d d) c0) D)))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (d <= 6.3e-158) {
tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D);
} else {
tmp = (c0 / (2.0 * w)) * ((2.0 / ((D * h) * w)) * (((d * d) * c0) / D));
}
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 <= 6.3d-158) then
tmp = ((((d_1 * c0) * (d_1 * c0)) / h) / (w * w)) / (d * d)
else
tmp = (c0 / (2.0d0 * w)) * ((2.0d0 / ((d * h) * w)) * (((d_1 * d_1) * c0) / d))
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 <= 6.3e-158) {
tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D);
} else {
tmp = (c0 / (2.0 * w)) * ((2.0 / ((D * h) * w)) * (((d * d) * c0) / D));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if d <= 6.3e-158: tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D) else: tmp = (c0 / (2.0 * w)) * ((2.0 / ((D * h) * w)) * (((d * d) * c0) / D)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (d <= 6.3e-158) tmp = Float64(Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / h) / Float64(w * w)) / Float64(D * D)); else tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 / Float64(Float64(D * h) * w)) * Float64(Float64(Float64(d * d) * c0) / D))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (d <= 6.3e-158) tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D); else tmp = (c0 / (2.0 * w)) * ((2.0 / ((D * h) * w)) * (((d * d) * c0) / D)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[d, 6.3e-158], N[(N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 / N[(N[(D * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 6.3 \cdot 10^{-158}:\\
\;\;\;\;\frac{\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}}{w \cdot w}}{D \cdot D}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{2}{\left(D \cdot h\right) \cdot w} \cdot \frac{\left(d \cdot d\right) \cdot c0}{D}\right)\\
\end{array}
\end{array}
if d < 6.30000000000000014e-158Initial program 18.1%
Taylor expanded in D around 0
lower-/.f64N/A
Applied rewrites18.5%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6435.2
Applied rewrites35.2%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6435.2
Applied rewrites35.2%
if 6.30000000000000014e-158 < d Initial program 26.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-*.f6435.2
Applied rewrites35.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6436.9
Applied rewrites36.9%
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
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6438.5
Applied rewrites38.5%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
Applied rewrites40.0%
Final simplification37.6%
(FPCore (c0 w h D d M) :precision binary64 (if (<= c0 2.2e+188) (* (/ c0 (+ w w)) (/ (/ (* (* 2.0 (* d d)) c0) (* (* h w) D)) D)) (/ (/ (/ (* (* d c0) (* d c0)) h) (* w w)) (* D D))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (c0 <= 2.2e+188) {
tmp = (c0 / (w + w)) * ((((2.0 * (d * d)) * c0) / ((h * w) * D)) / D);
} else {
tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D);
}
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 (c0 <= 2.2d+188) then
tmp = (c0 / (w + w)) * ((((2.0d0 * (d_1 * d_1)) * c0) / ((h * w) * d)) / d)
else
tmp = ((((d_1 * c0) * (d_1 * c0)) / h) / (w * w)) / (d * d)
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 (c0 <= 2.2e+188) {
tmp = (c0 / (w + w)) * ((((2.0 * (d * d)) * c0) / ((h * w) * D)) / D);
} else {
tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if c0 <= 2.2e+188: tmp = (c0 / (w + w)) * ((((2.0 * (d * d)) * c0) / ((h * w) * D)) / D) else: tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (c0 <= 2.2e+188) tmp = Float64(Float64(c0 / Float64(w + w)) * Float64(Float64(Float64(Float64(2.0 * Float64(d * d)) * c0) / Float64(Float64(h * w) * D)) / D)); else tmp = Float64(Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / h) / Float64(w * w)) / Float64(D * D)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (c0 <= 2.2e+188) tmp = (c0 / (w + w)) * ((((2.0 * (d * d)) * c0) / ((h * w) * D)) / D); else tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[c0, 2.2e+188], N[(N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(2.0 * N[(d * d), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] / N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c0 \leq 2.2 \cdot 10^{+188}:\\
\;\;\;\;\frac{c0}{w + w} \cdot \frac{\frac{\left(2 \cdot \left(d \cdot d\right)\right) \cdot c0}{\left(h \cdot w\right) \cdot D}}{D}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}}{w \cdot w}}{D \cdot D}\\
\end{array}
\end{array}
if c0 < 2.19999999999999999e188Initial program 22.9%
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
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f6438.7
Applied rewrites38.7%
lift-*.f64N/A
count-2-revN/A
lift-+.f6438.7
Applied rewrites38.7%
if 2.19999999999999999e188 < c0 Initial program 16.7%
Taylor expanded in D around 0
lower-/.f64N/A
Applied rewrites13.6%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6454.3
Applied rewrites54.3%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6454.3
Applied rewrites54.3%
Final simplification40.5%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (+ w w))))
(if (<= D 7.6e-110)
(* t_0 (/ (* 2.0 (* (* d d) c0)) (* (* h (* w D)) D)))
(* t_0 (/ (* 2.0 (* (* d c0) d)) (* (* (* h w) D) D))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (w + w);
double tmp;
if (D <= 7.6e-110) {
tmp = t_0 * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D));
} else {
tmp = t_0 * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D));
}
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 / (w + w)
if (d <= 7.6d-110) then
tmp = t_0 * ((2.0d0 * ((d_1 * d_1) * c0)) / ((h * (w * d)) * d))
else
tmp = t_0 * ((2.0d0 * ((d_1 * c0) * d_1)) / (((h * w) * d) * d))
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 / (w + w);
double tmp;
if (D <= 7.6e-110) {
tmp = t_0 * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D));
} else {
tmp = t_0 * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 / (w + w) tmp = 0 if D <= 7.6e-110: tmp = t_0 * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D)) else: tmp = t_0 * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(w + w)) tmp = 0.0 if (D <= 7.6e-110) tmp = Float64(t_0 * Float64(Float64(2.0 * Float64(Float64(d * d) * c0)) / Float64(Float64(h * Float64(w * D)) * D))); else tmp = Float64(t_0 * Float64(Float64(2.0 * Float64(Float64(d * c0) * d)) / Float64(Float64(Float64(h * w) * D) * D))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (w + w); tmp = 0.0; if (D <= 7.6e-110) tmp = t_0 * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D)); else tmp = t_0 * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 7.6e-110], N[(t$95$0 * N[(N[(2.0 * N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(h * N[(w * D), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0}{w + w}\\
\mathbf{if}\;D \leq 7.6 \cdot 10^{-110}:\\
\;\;\;\;t\_0 \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(h \cdot \left(w \cdot D\right)\right) \cdot D}\\
\mathbf{else}:\\
\;\;\;\;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}\\
\end{array}
\end{array}
if D < 7.5999999999999996e-110Initial program 23.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-*.f6438.0
Applied rewrites38.0%
lift-*.f64N/A
count-2-revN/A
lower-+.f6438.0
Applied rewrites38.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6440.6
Applied rewrites40.6%
if 7.5999999999999996e-110 < D Initial program 16.9%
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-*.f6429.6
Applied rewrites29.6%
lift-*.f64N/A
count-2-revN/A
lower-+.f6429.6
Applied rewrites29.6%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6431.5
Applied rewrites31.5%
Final simplification38.6%
(FPCore (c0 w h D d M) :precision binary64 (* (/ c0 (+ w w)) (/ (* 2.0 (* (* d c0) d)) (* (* (* h w) D) D))))
double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (w + w)) * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D));
}
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)) * ((2.0d0 * ((d_1 * c0) * d_1)) / (((h * w) * d) * d))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (w + w)) * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D));
}
def code(c0, w, h, D, d, M): return (c0 / (w + w)) * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D))
function code(c0, w, h, D, d, M) return Float64(Float64(c0 / Float64(w + w)) * Float64(Float64(2.0 * Float64(Float64(d * c0) * d)) / Float64(Float64(Float64(h * w) * D) * D))) end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 / (w + w)) * ((2.0 * ((d * c0) * d)) / (((h * w) * D) * D)); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[(N[(d * c0), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{c0}{w + w} \cdot \frac{2 \cdot \left(\left(d \cdot c0\right) \cdot d\right)}{\left(\left(h \cdot w\right) \cdot D\right) \cdot D}
\end{array}
Initial program 22.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-*.f6436.1
Applied rewrites36.1%
lift-*.f64N/A
count-2-revN/A
lower-+.f6436.1
Applied rewrites36.1%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6437.8
Applied rewrites37.8%
Final simplification37.8%
(FPCore (c0 w h D d M) :precision binary64 (/ (/ (/ (* (* d c0) (* d c0)) h) (* w w)) (* D D)))
double code(double c0, double w, double h, double D, double d, double M) {
return ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D);
}
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)) / h) / (w * w)) / (d * d)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D);
}
def code(c0, w, h, D, d, M): return ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D)
function code(c0, w, h, D, d, M) return Float64(Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / h) / Float64(w * w)) / Float64(D * D)) end
function tmp = code(c0, w, h, D, d, M) tmp = ((((d * c0) * (d * c0)) / h) / (w * w)) / (D * D); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}}{w \cdot w}}{D \cdot D}
\end{array}
Initial program 22.2%
Taylor expanded in D around 0
lower-/.f64N/A
Applied rewrites18.7%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6433.5
Applied rewrites33.5%
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f6433.5
Applied rewrites33.5%
(FPCore (c0 w h D d M) :precision binary64 (/ (* (/ (* c0 c0) h) (/ (* d d) (* w w))) (* D D)))
double code(double c0, double w, double h, double D, double d, double M) {
return (((c0 * c0) / h) * ((d * d) / (w * w))) / (D * D);
}
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) / h) * ((d_1 * d_1) / (w * w))) / (d * d)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (((c0 * c0) / h) * ((d * d) / (w * w))) / (D * D);
}
def code(c0, w, h, D, d, M): return (((c0 * c0) / h) * ((d * d) / (w * w))) / (D * D)
function code(c0, w, h, D, d, M) return Float64(Float64(Float64(Float64(c0 * c0) / h) * Float64(Float64(d * d) / Float64(w * w))) / Float64(D * D)) end
function tmp = code(c0, w, h, D, d, M) tmp = (((c0 * c0) / h) * ((d * d) / (w * w))) / (D * D); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(N[(N[(c0 * c0), $MachinePrecision] / h), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{c0 \cdot c0}{h} \cdot \frac{d \cdot d}{w \cdot w}}{D \cdot D}
\end{array}
Initial program 22.2%
Taylor expanded in D around 0
lower-/.f64N/A
Applied rewrites18.7%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6433.5
Applied rewrites33.5%
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/l/N/A
unpow-prod-downN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6426.7
Applied rewrites26.7%
(FPCore (c0 w h D d M) :precision binary64 (/ (* (* c0 c0) (/ (/ (* d d) h) (* w w))) (* D D)))
double code(double c0, double w, double h, double D, double d, double M) {
return ((c0 * c0) * (((d * d) / h) / (w * w))) / (D * D);
}
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) / h) / (w * w))) / (d * d)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return ((c0 * c0) * (((d * d) / h) / (w * w))) / (D * D);
}
def code(c0, w, h, D, d, M): return ((c0 * c0) * (((d * d) / h) / (w * w))) / (D * D)
function code(c0, w, h, D, d, M) return Float64(Float64(Float64(c0 * c0) * Float64(Float64(Float64(d * d) / h) / Float64(w * w))) / Float64(D * D)) end
function tmp = code(c0, w, h, D, d, M) tmp = ((c0 * c0) * (((d * d) / h) / (w * w))) / (D * D); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(N[(c0 * c0), $MachinePrecision] * N[(N[(N[(d * d), $MachinePrecision] / h), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(c0 \cdot c0\right) \cdot \frac{\frac{d \cdot d}{h}}{w \cdot w}}{D \cdot D}
\end{array}
Initial program 22.2%
Taylor expanded in D around 0
lower-/.f64N/A
Applied rewrites18.7%
Taylor expanded in c0 around inf
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6433.5
Applied rewrites33.5%
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/l/N/A
unpow-prod-downN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6424.3
Applied rewrites24.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 22.2%
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%
Final simplification0.0%
herbie shell --seed 2025083
(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))))))