
(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 15 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))))
(t_1 (+ t_0 (sqrt (- (* t_0 t_0) (* M M))))))
(if (<= (* (/ c0 (* 2.0 w)) t_1) INFINITY)
(* (/ c0 (+ w w)) t_1)
(/ (* -0.25 (* (pow (* D M) 2.0) h)) (* d d)))))
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 t_1 = t_0 + sqrt(((t_0 * t_0) - (M * M)));
double tmp;
if (((c0 / (2.0 * w)) * t_1) <= ((double) INFINITY)) {
tmp = (c0 / (w + w)) * t_1;
} else {
tmp = (-0.25 * (pow((D * M), 2.0) * h)) / (d * d);
}
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 t_1 = t_0 + Math.sqrt(((t_0 * t_0) - (M * M)));
double tmp;
if (((c0 / (2.0 * w)) * t_1) <= Double.POSITIVE_INFINITY) {
tmp = (c0 / (w + w)) * t_1;
} else {
tmp = (-0.25 * (Math.pow((D * M), 2.0) * h)) / (d * d);
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) t_1 = t_0 + math.sqrt(((t_0 * t_0) - (M * M))) tmp = 0 if ((c0 / (2.0 * w)) * t_1) <= math.inf: tmp = (c0 / (w + w)) * t_1 else: tmp = (-0.25 * (math.pow((D * M), 2.0) * h)) / (d * d) 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))) t_1 = Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M)))) tmp = 0.0 if (Float64(Float64(c0 / Float64(2.0 * w)) * t_1) <= Inf) tmp = Float64(Float64(c0 / Float64(w + w)) * t_1); else tmp = Float64(Float64(-0.25 * Float64((Float64(D * M) ^ 2.0) * h)) / Float64(d * d)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); t_1 = t_0 + sqrt(((t_0 * t_0) - (M * M))); tmp = 0.0; if (((c0 / (2.0 * w)) * t_1) <= Inf) tmp = (c0 / (w + w)) * t_1; else tmp = (-0.25 * (((D * M) ^ 2.0) * h)) / (d * d); 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]}, Block[{t$95$1 = N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], Infinity], N[(N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(-0.25 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / N[(d * d), $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)}\\
t_1 := t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot t\_1 \leq \infty:\\
\;\;\;\;\frac{c0}{w + w} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.25 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{d \cdot d}\\
\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 78.5%
lift-*.f64N/A
count-2-revN/A
lower-+.f6478.5
Applied rewrites78.5%
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 c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites7.1%
Taylor expanded in c0 around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
associate-*r*N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6437.2
Applied rewrites37.2%
(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 (/ (* 2.0 (* (* c0 d) d)) (* (* (* D D) h) w))) (* w 2.0))
(/ (* -0.25 (* (pow (* D M) 2.0) h)) (* d d)))))
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 * ((2.0 * ((c0 * d) * d)) / (((D * D) * h) * w))) / (w * 2.0);
} else {
tmp = (-0.25 * (pow((D * M), 2.0) * h)) / (d * d);
}
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 * ((2.0 * ((c0 * d) * d)) / (((D * D) * h) * w))) / (w * 2.0);
} else {
tmp = (-0.25 * (Math.pow((D * M), 2.0) * h)) / (d * d);
}
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 * ((2.0 * ((c0 * d) * d)) / (((D * D) * h) * w))) / (w * 2.0) else: tmp = (-0.25 * (math.pow((D * M), 2.0) * h)) / (d * d) 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(Float64(2.0 * Float64(Float64(c0 * d) * d)) / Float64(Float64(Float64(D * D) * h) * w))) / Float64(w * 2.0)); else tmp = Float64(Float64(-0.25 * Float64((Float64(D * M) ^ 2.0) * h)) / Float64(d * d)); 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 * ((2.0 * ((c0 * d) * d)) / (((D * D) * h) * w))) / (w * 2.0); else tmp = (-0.25 * (((D * M) ^ 2.0) * h)) / (d * d); 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[(N[(2.0 * N[(N[(c0 * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(-0.25 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / N[(d * d), $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)}\\
\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 \cdot \frac{2 \cdot \left(\left(c0 \cdot d\right) \cdot d\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}}{w \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.25 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{d \cdot d}\\
\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 78.5%
Applied rewrites69.1%
Taylor expanded in c0 around inf
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6476.3
Applied rewrites76.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f6477.3
Applied rewrites77.3%
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 c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites7.1%
Taylor expanded in c0 around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
associate-*r*N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6437.2
Applied rewrites37.2%
Final simplification52.4%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* c0 (* d d))) (t_1 (/ t_0 (* (* w h) (* D D)))))
(if (<=
(* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))
INFINITY)
(* (/ t_0 (* (* (* (* D D) h) w) w)) c0)
(* (/ t_0 (* (* D (* D h)) (* w w))) c0))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 * (d * d);
double t_1 = t_0 / ((w * h) * (D * D));
double tmp;
if (((c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
tmp = (t_0 / ((((D * D) * h) * w) * w)) * c0;
} else {
tmp = (t_0 / ((D * (D * h)) * (w * w))) * c0;
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 * (d * d);
double t_1 = t_0 / ((w * h) * (D * D));
double tmp;
if (((c0 / (2.0 * w)) * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = (t_0 / ((((D * D) * h) * w) * w)) * c0;
} else {
tmp = (t_0 / ((D * (D * h)) * (w * w))) * c0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 * (d * d) t_1 = t_0 / ((w * h) * (D * D)) tmp = 0 if ((c0 / (2.0 * w)) * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= math.inf: tmp = (t_0 / ((((D * D) * h) * w) * w)) * c0 else: tmp = (t_0 / ((D * (D * h)) * (w * w))) * c0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 * Float64(d * d)) t_1 = Float64(t_0 / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf) tmp = Float64(Float64(t_0 / Float64(Float64(Float64(Float64(D * D) * h) * w) * w)) * c0); else tmp = Float64(Float64(t_0 / Float64(Float64(D * Float64(D * h)) * Float64(w * w))) * c0); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 * (d * d); t_1 = t_0 / ((w * h) * (D * D)); tmp = 0.0; if (((c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= Inf) tmp = (t_0 / ((((D * D) * h) * w) * w)) * c0; else tmp = (t_0 / ((D * (D * h)) * (w * w))) * c0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / 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$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(t$95$0 / N[(N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], N[(N[(t$95$0 / N[(N[(D * N[(D * h), $MachinePrecision]), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c0 \cdot \left(d \cdot d\right)\\
t_1 := \frac{t\_0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;\frac{t\_0}{\left(\left(\left(D \cdot D\right) \cdot h\right) \cdot w\right) \cdot w} \cdot c0\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(w \cdot w\right)} \cdot c0\\
\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 78.5%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites52.2%
Applied rewrites62.5%
Taylor expanded in c0 around inf
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6466.0
Applied rewrites66.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6471.2
Applied rewrites71.2%
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 c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites7.1%
Applied rewrites14.5%
Taylor expanded in c0 around inf
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6415.1
Applied rewrites15.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6419.2
Applied rewrites19.2%
(FPCore (c0 w h D d M) :precision binary64 (if (<= d 1.3e-94) (* (* (* (/ (/ d (* D D)) h) (/ d (* w w))) c0) c0) (/ (* c0 (/ (/ (/ (/ (* (* (* 2.0 d) d) c0) h) w) D) D)) (* 2.0 w))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (d <= 1.3e-94) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} else {
tmp = (c0 * (((((((2.0 * d) * d) * c0) / h) / w) / D) / D)) / (2.0 * w);
}
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 <= 1.3d-94) then
tmp = ((((d_1 / (d * d)) / h) * (d_1 / (w * w))) * c0) * c0
else
tmp = (c0 * (((((((2.0d0 * d_1) * d_1) * c0) / h) / w) / d) / d)) / (2.0d0 * w)
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.3e-94) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} else {
tmp = (c0 * (((((((2.0 * d) * d) * c0) / h) / w) / D) / D)) / (2.0 * w);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if d <= 1.3e-94: tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0 else: tmp = (c0 * (((((((2.0 * d) * d) * c0) / h) / w) / D) / D)) / (2.0 * w) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (d <= 1.3e-94) tmp = Float64(Float64(Float64(Float64(Float64(d / Float64(D * D)) / h) * Float64(d / Float64(w * w))) * c0) * c0); else tmp = Float64(Float64(c0 * Float64(Float64(Float64(Float64(Float64(Float64(Float64(2.0 * d) * d) * c0) / h) / w) / D) / D)) / Float64(2.0 * w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (d <= 1.3e-94) tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0; else tmp = (c0 * (((((((2.0 * d) * d) * c0) / h) / w) / D) / D)) / (2.0 * w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[d, 1.3e-94], N[(N[(N[(N[(N[(d / N[(D * D), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] * N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] * c0), $MachinePrecision], N[(N[(c0 * N[(N[(N[(N[(N[(N[(N[(2.0 * d), $MachinePrecision] * d), $MachinePrecision] * c0), $MachinePrecision] / h), $MachinePrecision] / w), $MachinePrecision] / D), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.3 \cdot 10^{-94}:\\
\;\;\;\;\left(\left(\frac{\frac{d}{D \cdot D}}{h} \cdot \frac{d}{w \cdot w}\right) \cdot c0\right) \cdot c0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \frac{\frac{\frac{\frac{\left(\left(2 \cdot d\right) \cdot d\right) \cdot c0}{h}}{w}}{D}}{D}}{2 \cdot w}\\
\end{array}
\end{array}
if d < 1.29999999999999997e-94Initial program 30.4%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites26.3%
Applied rewrites36.4%
Taylor expanded in c0 around inf
pow2N/A
associate-*r*N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
pow2N/A
lower-*.f64N/A
Applied rewrites45.0%
if 1.29999999999999997e-94 < d Initial program 28.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-*.f6438.2
Applied rewrites38.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites42.8%
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
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f6442.8
Applied rewrites42.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6446.4
Applied rewrites46.4%
(FPCore (c0 w h D d M) :precision binary64 (if (<= d 1.2e-94) (* (* (* (/ (/ d (* D D)) h) (/ d (* w w))) c0) c0) (/ (* c0 (/ (/ (* 2.0 (* (* c0 d) d)) (* D (* h w))) D)) (* 2.0 w))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (d <= 1.2e-94) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} else {
tmp = (c0 * (((2.0 * ((c0 * d) * d)) / (D * (h * w))) / D)) / (2.0 * w);
}
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 <= 1.2d-94) then
tmp = ((((d_1 / (d * d)) / h) * (d_1 / (w * w))) * c0) * c0
else
tmp = (c0 * (((2.0d0 * ((c0 * d_1) * d_1)) / (d * (h * w))) / d)) / (2.0d0 * w)
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.2e-94) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} else {
tmp = (c0 * (((2.0 * ((c0 * d) * d)) / (D * (h * w))) / D)) / (2.0 * w);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if d <= 1.2e-94: tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0 else: tmp = (c0 * (((2.0 * ((c0 * d) * d)) / (D * (h * w))) / D)) / (2.0 * w) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (d <= 1.2e-94) tmp = Float64(Float64(Float64(Float64(Float64(d / Float64(D * D)) / h) * Float64(d / Float64(w * w))) * c0) * c0); else tmp = Float64(Float64(c0 * Float64(Float64(Float64(2.0 * Float64(Float64(c0 * d) * d)) / Float64(D * Float64(h * w))) / D)) / Float64(2.0 * w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (d <= 1.2e-94) tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0; else tmp = (c0 * (((2.0 * ((c0 * d) * d)) / (D * (h * w))) / D)) / (2.0 * w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[d, 1.2e-94], N[(N[(N[(N[(N[(d / N[(D * D), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] * N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] * c0), $MachinePrecision], N[(N[(c0 * N[(N[(N[(2.0 * N[(N[(c0 * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / N[(D * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.2 \cdot 10^{-94}:\\
\;\;\;\;\left(\left(\frac{\frac{d}{D \cdot D}}{h} \cdot \frac{d}{w \cdot w}\right) \cdot c0\right) \cdot c0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \frac{\frac{2 \cdot \left(\left(c0 \cdot d\right) \cdot d\right)}{D \cdot \left(h \cdot w\right)}}{D}}{2 \cdot w}\\
\end{array}
\end{array}
if d < 1.2e-94Initial program 30.4%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites26.3%
Applied rewrites36.4%
Taylor expanded in c0 around inf
pow2N/A
associate-*r*N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
pow2N/A
lower-*.f64N/A
Applied rewrites45.0%
if 1.2e-94 < d Initial program 28.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-*.f6438.2
Applied rewrites38.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites42.8%
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
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f6442.8
Applied rewrites42.8%
Taylor expanded in c0 around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f64N/A
lower-*.f64N/A
lift-*.f6444.4
Applied rewrites44.4%
(FPCore (c0 w h D d M) :precision binary64 (if (<= (* d d) 5e-187) (* (* (* (/ (/ d (* D D)) h) (/ d (* w w))) c0) c0) (* (/ 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 * d) <= 5e-187) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} 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 * d_1) <= 5d-187) then
tmp = ((((d_1 / (d * d)) / h) * (d_1 / (w * w))) * c0) * c0
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 * d) <= 5e-187) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} 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 * d) <= 5e-187: tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0 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 (Float64(d * d) <= 5e-187) tmp = Float64(Float64(Float64(Float64(Float64(d / Float64(D * D)) / h) * Float64(d / Float64(w * w))) * c0) * c0); else tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 * Float64(d * Float64(d * c0))) / Float64(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 * d) <= 5e-187) tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0; 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[N[(d * d), $MachinePrecision], 5e-187], N[(N[(N[(N[(N[(d / N[(D * D), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] * N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] * c0), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[(d * N[(d * c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \cdot d \leq 5 \cdot 10^{-187}:\\
\;\;\;\;\left(\left(\frac{\frac{d}{D \cdot D}}{h} \cdot \frac{d}{w \cdot w}\right) \cdot c0\right) \cdot c0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(d \cdot \left(d \cdot c0\right)\right)}{\left(\left(h \cdot w\right) \cdot D\right) \cdot D}\\
\end{array}
\end{array}
if (*.f64 d d) < 4.9999999999999996e-187Initial program 30.0%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites20.8%
Applied rewrites34.6%
Taylor expanded in c0 around inf
pow2N/A
associate-*r*N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
pow2N/A
lower-*.f64N/A
Applied rewrites53.1%
if 4.9999999999999996e-187 < (*.f64 d d) Initial program 29.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-*.f6443.9
Applied rewrites43.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6445.3
Applied rewrites45.3%
(FPCore (c0 w h D d M) :precision binary64 (if (<= d 1.2e-94) (* (* (* (/ (/ d (* D D)) h) (/ d (* w w))) c0) c0) (/ (* c0 (/ (/ (* (* 2.0 (* d d)) c0) (* (* h w) D)) D)) (+ w w))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (d <= 1.2e-94) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} else {
tmp = (c0 * ((((2.0 * (d * d)) * c0) / ((h * w) * D)) / D)) / (w + w);
}
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 <= 1.2d-94) then
tmp = ((((d_1 / (d * d)) / h) * (d_1 / (w * w))) * c0) * c0
else
tmp = (c0 * ((((2.0d0 * (d_1 * d_1)) * c0) / ((h * w) * d)) / d)) / (w + w)
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.2e-94) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} else {
tmp = (c0 * ((((2.0 * (d * d)) * c0) / ((h * w) * D)) / D)) / (w + w);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if d <= 1.2e-94: tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0 else: tmp = (c0 * ((((2.0 * (d * d)) * c0) / ((h * w) * D)) / D)) / (w + w) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (d <= 1.2e-94) tmp = Float64(Float64(Float64(Float64(Float64(d / Float64(D * D)) / h) * Float64(d / Float64(w * w))) * c0) * c0); else tmp = Float64(Float64(c0 * Float64(Float64(Float64(Float64(2.0 * Float64(d * d)) * c0) / Float64(Float64(h * w) * D)) / D)) / Float64(w + w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (d <= 1.2e-94) tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0; else tmp = (c0 * ((((2.0 * (d * d)) * c0) / ((h * w) * D)) / D)) / (w + w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[d, 1.2e-94], N[(N[(N[(N[(N[(d / N[(D * D), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] * N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] * c0), $MachinePrecision], N[(N[(c0 * 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[(w + w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.2 \cdot 10^{-94}:\\
\;\;\;\;\left(\left(\frac{\frac{d}{D \cdot D}}{h} \cdot \frac{d}{w \cdot w}\right) \cdot c0\right) \cdot c0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \frac{\frac{\left(2 \cdot \left(d \cdot d\right)\right) \cdot c0}{\left(h \cdot w\right) \cdot D}}{D}}{w + w}\\
\end{array}
\end{array}
if d < 1.2e-94Initial program 30.4%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites26.3%
Applied rewrites36.4%
Taylor expanded in c0 around inf
pow2N/A
associate-*r*N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
pow2N/A
lower-*.f64N/A
Applied rewrites45.0%
if 1.2e-94 < d Initial program 28.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-*.f6438.2
Applied rewrites38.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites42.8%
lift-*.f64N/A
count-2-revN/A
lift-+.f6442.8
Applied rewrites42.8%
(FPCore (c0 w h D d M) :precision binary64 (if (<= (* d d) 2e-188) (* (* (* (/ (/ d (* D D)) h) (/ d (* w w))) c0) c0) (* (/ c0 (+ w 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 * d) <= 2e-188) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} else {
tmp = (c0 / (w + 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 * d_1) <= 2d-188) then
tmp = ((((d_1 / (d * d)) / h) * (d_1 / (w * w))) * c0) * c0
else
tmp = (c0 / (w + 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 * d) <= 2e-188) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} else {
tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if (d * d) <= 2e-188: tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0 else: tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D)) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (Float64(d * d) <= 2e-188) tmp = Float64(Float64(Float64(Float64(Float64(d / Float64(D * D)) / h) * Float64(d / Float64(w * w))) * c0) * c0); else tmp = Float64(Float64(c0 / Float64(w + w)) * Float64(Float64(2.0 * Float64(Float64(d * d) * c0)) / Float64(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 * d) <= 2e-188) tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0; else tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D)); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(d * d), $MachinePrecision], 2e-188], N[(N[(N[(N[(N[(d / N[(D * D), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] * N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] * c0), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \cdot d \leq 2 \cdot 10^{-188}:\\
\;\;\;\;\left(\left(\frac{\frac{d}{D \cdot D}}{h} \cdot \frac{d}{w \cdot w}\right) \cdot c0\right) \cdot c0\\
\mathbf{else}:\\
\;\;\;\;\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}\\
\end{array}
\end{array}
if (*.f64 d d) < 1.9999999999999999e-188Initial program 30.6%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites21.2%
Applied rewrites35.3%
Taylor expanded in c0 around inf
pow2N/A
associate-*r*N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
pow2N/A
lower-*.f64N/A
Applied rewrites54.3%
if 1.9999999999999999e-188 < (*.f64 d d) Initial program 29.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-*.f6443.7
Applied rewrites43.7%
lift-*.f64N/A
count-2-revN/A
lower-+.f6443.7
Applied rewrites43.7%
(FPCore (c0 w h D d M) :precision binary64 (if (<= d 2.6e-94) (* (* (* (/ (/ d (* D D)) h) (/ d (* w w))) c0) c0) (* (/ 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 <= 2.6e-94) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} 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 <= 2.6d-94) then
tmp = ((((d_1 / (d * d)) / h) * (d_1 / (w * w))) * c0) * c0
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 <= 2.6e-94) {
tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
} 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 <= 2.6e-94: tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0 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 <= 2.6e-94) tmp = Float64(Float64(Float64(Float64(Float64(d / Float64(D * D)) / h) * Float64(d / Float64(w * w))) * c0) * c0); else tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 * Float64(Float64(d * d) * c0)) / Float64(Float64(h * Float64(w * D)) * D))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (d <= 2.6e-94) tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0; 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, 2.6e-94], N[(N[(N[(N[(N[(d / N[(D * D), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] * N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] * c0), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(h * N[(w * D), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.6 \cdot 10^{-94}:\\
\;\;\;\;\left(\left(\frac{\frac{d}{D \cdot D}}{h} \cdot \frac{d}{w \cdot w}\right) \cdot c0\right) \cdot c0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(h \cdot \left(w \cdot D\right)\right) \cdot D}\\
\end{array}
\end{array}
if d < 2.59999999999999994e-94Initial program 30.4%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites26.3%
Applied rewrites36.4%
Taylor expanded in c0 around inf
pow2N/A
associate-*r*N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
pow2N/A
lower-*.f64N/A
Applied rewrites45.0%
if 2.59999999999999994e-94 < d Initial program 28.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-*.f6438.2
Applied rewrites38.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6440.1
Applied rewrites40.1%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* c0 (* d d))))
(if (<= D 9e-23)
(* (/ t_0 (* (* (* (* D D) h) w) w)) c0)
(if (<= D 3.9e+130)
(* (/ (/ (* (* c0 d) d) (* D D)) (* h (* w w))) c0)
(* (/ t_0 (* (* D (* D h)) (* w w))) c0)))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 * (d * d);
double tmp;
if (D <= 9e-23) {
tmp = (t_0 / ((((D * D) * h) * w) * w)) * c0;
} else if (D <= 3.9e+130) {
tmp = ((((c0 * d) * d) / (D * D)) / (h * (w * w))) * c0;
} else {
tmp = (t_0 / ((D * (D * h)) * (w * w))) * c0;
}
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)
if (d <= 9d-23) then
tmp = (t_0 / ((((d * d) * h) * w) * w)) * c0
else if (d <= 3.9d+130) then
tmp = ((((c0 * d_1) * d_1) / (d * d)) / (h * (w * w))) * c0
else
tmp = (t_0 / ((d * (d * h)) * (w * w))) * c0
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);
double tmp;
if (D <= 9e-23) {
tmp = (t_0 / ((((D * D) * h) * w) * w)) * c0;
} else if (D <= 3.9e+130) {
tmp = ((((c0 * d) * d) / (D * D)) / (h * (w * w))) * c0;
} else {
tmp = (t_0 / ((D * (D * h)) * (w * w))) * c0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 * (d * d) tmp = 0 if D <= 9e-23: tmp = (t_0 / ((((D * D) * h) * w) * w)) * c0 elif D <= 3.9e+130: tmp = ((((c0 * d) * d) / (D * D)) / (h * (w * w))) * c0 else: tmp = (t_0 / ((D * (D * h)) * (w * w))) * c0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 * Float64(d * d)) tmp = 0.0 if (D <= 9e-23) tmp = Float64(Float64(t_0 / Float64(Float64(Float64(Float64(D * D) * h) * w) * w)) * c0); elseif (D <= 3.9e+130) tmp = Float64(Float64(Float64(Float64(Float64(c0 * d) * d) / Float64(D * D)) / Float64(h * Float64(w * w))) * c0); else tmp = Float64(Float64(t_0 / Float64(Float64(D * Float64(D * h)) * Float64(w * w))) * c0); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 * (d * d); tmp = 0.0; if (D <= 9e-23) tmp = (t_0 / ((((D * D) * h) * w) * w)) * c0; elseif (D <= 3.9e+130) tmp = ((((c0 * d) * d) / (D * D)) / (h * (w * w))) * c0; else tmp = (t_0 / ((D * (D * h)) * (w * w))) * c0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 9e-23], N[(N[(t$95$0 / N[(N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[D, 3.9e+130], N[(N[(N[(N[(N[(c0 * d), $MachinePrecision] * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], N[(N[(t$95$0 / N[(N[(D * N[(D * h), $MachinePrecision]), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c0 \cdot \left(d \cdot d\right)\\
\mathbf{if}\;D \leq 9 \cdot 10^{-23}:\\
\;\;\;\;\frac{t\_0}{\left(\left(\left(D \cdot D\right) \cdot h\right) \cdot w\right) \cdot w} \cdot c0\\
\mathbf{elif}\;D \leq 3.9 \cdot 10^{+130}:\\
\;\;\;\;\frac{\frac{\left(c0 \cdot d\right) \cdot d}{D \cdot D}}{h \cdot \left(w \cdot w\right)} \cdot c0\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(w \cdot w\right)} \cdot c0\\
\end{array}
\end{array}
if D < 8.9999999999999995e-23Initial program 30.2%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites25.9%
Applied rewrites34.0%
Taylor expanded in c0 around inf
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6435.6
Applied rewrites35.6%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6439.0
Applied rewrites39.0%
if 8.9999999999999995e-23 < D < 3.9000000000000002e130Initial program 32.7%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites16.6%
Applied rewrites33.4%
Taylor expanded in c0 around inf
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6433.7
Applied rewrites33.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
associate-*r*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
Applied rewrites45.2%
if 3.9000000000000002e130 < D Initial program 18.8%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites12.5%
Applied rewrites14.1%
Taylor expanded in c0 around inf
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6418.8
Applied rewrites18.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6443.9
Applied rewrites43.9%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* (* D D) h)))
(if (<= (* d d) 1e-255)
(* (* (/ d t_0) (/ d (* w w))) (* c0 c0))
(* (/ (* c0 (* d d)) (* (* t_0 w) w)) c0))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (D * D) * h;
double tmp;
if ((d * d) <= 1e-255) {
tmp = ((d / t_0) * (d / (w * w))) * (c0 * c0);
} else {
tmp = ((c0 * (d * d)) / ((t_0 * w) * w)) * c0;
}
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 = (d * d) * h
if ((d_1 * d_1) <= 1d-255) then
tmp = ((d_1 / t_0) * (d_1 / (w * w))) * (c0 * c0)
else
tmp = ((c0 * (d_1 * d_1)) / ((t_0 * w) * w)) * c0
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 = (D * D) * h;
double tmp;
if ((d * d) <= 1e-255) {
tmp = ((d / t_0) * (d / (w * w))) * (c0 * c0);
} else {
tmp = ((c0 * (d * d)) / ((t_0 * w) * w)) * c0;
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = (D * D) * h tmp = 0 if (d * d) <= 1e-255: tmp = ((d / t_0) * (d / (w * w))) * (c0 * c0) else: tmp = ((c0 * (d * d)) / ((t_0 * w) * w)) * c0 return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(D * D) * h) tmp = 0.0 if (Float64(d * d) <= 1e-255) tmp = Float64(Float64(Float64(d / t_0) * Float64(d / Float64(w * w))) * Float64(c0 * c0)); else tmp = Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(t_0 * w) * w)) * c0); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (D * D) * h; tmp = 0.0; if ((d * d) <= 1e-255) tmp = ((d / t_0) * (d / (w * w))) * (c0 * c0); else tmp = ((c0 * (d * d)) / ((t_0 * w) * w)) * c0; end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision]}, If[LessEqual[N[(d * d), $MachinePrecision], 1e-255], N[(N[(N[(d / t$95$0), $MachinePrecision] * N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(c0 * c0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$0 * w), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(D \cdot D\right) \cdot h\\
\mathbf{if}\;d \cdot d \leq 10^{-255}:\\
\;\;\;\;\left(\frac{d}{t\_0} \cdot \frac{d}{w \cdot w}\right) \cdot \left(c0 \cdot c0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(d \cdot d\right)}{\left(t\_0 \cdot w\right) \cdot w} \cdot c0\\
\end{array}
\end{array}
if (*.f64 d d) < 1e-255Initial program 24.2%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites18.3%
Taylor expanded in c0 around inf
pow2N/A
associate-*r*N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.8
Applied rewrites48.8%
if 1e-255 < (*.f64 d d) Initial program 30.6%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites25.1%
Applied rewrites33.0%
Taylor expanded in c0 around inf
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6439.1
Applied rewrites39.1%
Final simplification40.4%
(FPCore (c0 w h D d M) :precision binary64 (* (* (* (/ (/ d (* D D)) h) (/ d (* w w))) c0) c0))
double code(double c0, double w, double h, double D, double d, double M) {
return ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
}
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 / (d * d)) / h) * (d_1 / (w * w))) * c0) * c0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0;
}
def code(c0, w, h, D, d, M): return ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0
function code(c0, w, h, D, d, M) return Float64(Float64(Float64(Float64(Float64(d / Float64(D * D)) / h) * Float64(d / Float64(w * w))) * c0) * c0) end
function tmp = code(c0, w, h, D, d, M) tmp = ((((d / (D * D)) / h) * (d / (w * w))) * c0) * c0; end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(N[(N[(N[(d / N[(D * D), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] * N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] * c0), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{\frac{d}{D \cdot D}}{h} \cdot \frac{d}{w \cdot w}\right) \cdot c0\right) \cdot c0
\end{array}
Initial program 29.8%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites24.2%
Applied rewrites32.7%
Taylor expanded in c0 around inf
pow2N/A
associate-*r*N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
pow2N/A
lower-*.f64N/A
Applied rewrites41.3%
(FPCore (c0 w h D d M) :precision binary64 (* (/ (* c0 (* d d)) (* (* D (* D h)) (* w w))) c0))
double code(double c0, double w, double h, double D, double d, double M) {
return ((c0 * (d * d)) / ((D * (D * h)) * (w * w))) * c0;
}
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 * (d_1 * d_1)) / ((d * (d * h)) * (w * w))) * c0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return ((c0 * (d * d)) / ((D * (D * h)) * (w * w))) * c0;
}
def code(c0, w, h, D, d, M): return ((c0 * (d * d)) / ((D * (D * h)) * (w * w))) * c0
function code(c0, w, h, D, d, M) return Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * Float64(D * h)) * Float64(w * w))) * c0) end
function tmp = code(c0, w, h, D, d, M) tmp = ((c0 * (d * d)) / ((D * (D * h)) * (w * w))) * c0; end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * N[(D * h), $MachinePrecision]), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]
\begin{array}{l}
\\
\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(w \cdot w\right)} \cdot c0
\end{array}
Initial program 29.8%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites24.2%
Applied rewrites32.7%
Taylor expanded in c0 around inf
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6434.4
Applied rewrites34.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6436.6
Applied rewrites36.6%
(FPCore (c0 w h D d M) :precision binary64 (* (/ (* c0 (* d d)) (* (* D D) (* h (* w w)))) c0))
double code(double c0, double w, double h, double D, double d, double M) {
return ((c0 * (d * d)) / ((D * D) * (h * (w * w)))) * c0;
}
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 * (d_1 * d_1)) / ((d * d) * (h * (w * w)))) * c0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return ((c0 * (d * d)) / ((D * D) * (h * (w * w)))) * c0;
}
def code(c0, w, h, D, d, M): return ((c0 * (d * d)) / ((D * D) * (h * (w * w)))) * c0
function code(c0, w, h, D, d, M) return Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(h * Float64(w * w)))) * c0) end
function tmp = code(c0, w, h, D, d, M) tmp = ((c0 * (d * d)) / ((D * D) * (h * (w * w)))) * c0; end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]
\begin{array}{l}
\\
\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)} \cdot c0
\end{array}
Initial program 29.8%
Taylor expanded in c0 around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites24.2%
Applied rewrites32.7%
Taylor expanded in c0 around inf
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6434.4
Applied rewrites34.4%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6433.0
Applied rewrites33.0%
(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 29.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 2025061
(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))))))