
(FPCore (c0 w h D d M) :precision binary64 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))) (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) end
function tmp = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)
\end{array}
\end{array}
Herbie found 11 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)))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (/ t_0 (* (* w h) (* D D)))))
(if (<= (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))) INFINITY)
(/ (* 2.0 (* (/ (* c0 d) (* D D)) (/ (* c0 d) (* h w)))) (+ w w))
(* t_1 (/ (* -0.5 (* (* D D) (* (* (* M M) h) w))) t_0)))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 * (d * d);
double t_1 = c0 / (2.0 * w);
double t_2 = t_0 / ((w * h) * (D * D));
double tmp;
if ((t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))))) <= ((double) INFINITY)) {
tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (w + w);
} else {
tmp = t_1 * ((-0.5 * ((D * D) * (((M * M) * h) * w))) / t_0);
}
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 = c0 / (2.0 * w);
double t_2 = t_0 / ((w * h) * (D * D));
double tmp;
if ((t_1 * (t_2 + Math.sqrt(((t_2 * t_2) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (w + w);
} else {
tmp = t_1 * ((-0.5 * ((D * D) * (((M * M) * h) * w))) / t_0);
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 * (d * d) t_1 = c0 / (2.0 * w) t_2 = t_0 / ((w * h) * (D * D)) tmp = 0 if (t_1 * (t_2 + math.sqrt(((t_2 * t_2) - (M * M))))) <= math.inf: tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (w + w) else: tmp = t_1 * ((-0.5 * ((D * D) * (((M * M) * h) * w))) / t_0) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 * Float64(d * d)) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(t_0 / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) <= Inf) tmp = Float64(Float64(2.0 * Float64(Float64(Float64(c0 * d) / Float64(D * D)) * Float64(Float64(c0 * d) / Float64(h * w)))) / Float64(w + w)); else tmp = Float64(t_1 * Float64(Float64(-0.5 * Float64(Float64(D * D) * Float64(Float64(Float64(M * M) * h) * w))) / t_0)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 * (d * d); t_1 = c0 / (2.0 * w); t_2 = t_0 / ((w * h) * (D * D)); tmp = 0.0; if ((t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))))) <= Inf) tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (w + w); else tmp = t_1 * ((-0.5 * ((D * D) * (((M * M) * h) * w))) / t_0); 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[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * d), $MachinePrecision] / N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w + w), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(-0.5 * N[(N[(D * D), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c0 \cdot \left(d \cdot d\right)\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{t\_0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;\frac{2 \cdot \left(\frac{c0 \cdot d}{D \cdot D} \cdot \frac{c0 \cdot d}{h \cdot w}\right)}{w + w}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{-0.5 \cdot \left(\left(D \cdot D\right) \cdot \left(\left(\left(M \cdot M\right) \cdot h\right) \cdot w\right)\right)}{t\_0}\\
\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 74.9%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in c0 around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6474.0
Applied rewrites74.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f6477.9
Applied rewrites77.9%
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 rewrites1.4%
Taylor expanded in c0 around 0
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6425.8
Applied rewrites25.8%
(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* c0 (* d d)))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (/ t_0 (* (* w h) (* D D)))))
(if (<= (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))) INFINITY)
(/ (* 2.0 (* (/ (* c0 d) (* D D)) (/ (* c0 d) (* h w)))) (+ w w))
(* t_1 (* -0.5 (/ (* (* D D) (* (* M M) (* h w))) t_0))))))
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 * (d * d);
double t_1 = c0 / (2.0 * w);
double t_2 = t_0 / ((w * h) * (D * D));
double tmp;
if ((t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))))) <= ((double) INFINITY)) {
tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (w + w);
} else {
tmp = t_1 * (-0.5 * (((D * D) * ((M * M) * (h * w))) / t_0));
}
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 = c0 / (2.0 * w);
double t_2 = t_0 / ((w * h) * (D * D));
double tmp;
if ((t_1 * (t_2 + Math.sqrt(((t_2 * t_2) - (M * M))))) <= Double.POSITIVE_INFINITY) {
tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (w + w);
} else {
tmp = t_1 * (-0.5 * (((D * D) * ((M * M) * (h * w))) / t_0));
}
return tmp;
}
def code(c0, w, h, D, d, M): t_0 = c0 * (d * d) t_1 = c0 / (2.0 * w) t_2 = t_0 / ((w * h) * (D * D)) tmp = 0 if (t_1 * (t_2 + math.sqrt(((t_2 * t_2) - (M * M))))) <= math.inf: tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (w + w) else: tmp = t_1 * (-0.5 * (((D * D) * ((M * M) * (h * w))) / t_0)) return tmp
function code(c0, w, h, D, d, M) t_0 = Float64(c0 * Float64(d * d)) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(t_0 / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) <= Inf) tmp = Float64(Float64(2.0 * Float64(Float64(Float64(c0 * d) / Float64(D * D)) * Float64(Float64(c0 * d) / Float64(h * w)))) / Float64(w + w)); else tmp = Float64(t_1 * Float64(-0.5 * Float64(Float64(Float64(D * D) * Float64(Float64(M * M) * Float64(h * w))) / t_0))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 * (d * d); t_1 = c0 / (2.0 * w); t_2 = t_0 / ((w * h) * (D * D)); tmp = 0.0; if ((t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))))) <= Inf) tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (w + w); else tmp = t_1 * (-0.5 * (((D * D) * ((M * M) * (h * w))) / t_0)); 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[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * d), $MachinePrecision] / N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w + w), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(-0.5 * N[(N[(N[(D * D), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := c0 \cdot \left(d \cdot d\right)\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{t\_0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;\frac{2 \cdot \left(\frac{c0 \cdot d}{D \cdot D} \cdot \frac{c0 \cdot d}{h \cdot w}\right)}{w + w}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(-0.5 \cdot \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot w\right)\right)}{t\_0}\right)\\
\end{array}
\end{array}
if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 74.9%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in c0 around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6474.0
Applied rewrites74.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f6477.9
Applied rewrites77.9%
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 rewrites1.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f642.9
Applied rewrites2.9%
Taylor expanded in c0 around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6423.7
Applied rewrites23.7%
(FPCore (c0 w h D d M) :precision binary64 (if (<= h -8000000000.0) (* (/ c0 (* 2.0 w)) (/ (* 2.0 (* (* d d) c0)) (* (* h (* w D)) D))) (/ (* 2.0 (* (/ (* c0 d) (* D D)) (/ (* c0 d) (* h w)))) (+ w w))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (h <= -8000000000.0) {
tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D));
} else {
tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (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 (h <= (-8000000000.0d0)) then
tmp = (c0 / (2.0d0 * w)) * ((2.0d0 * ((d_1 * d_1) * c0)) / ((h * (w * d)) * d))
else
tmp = (2.0d0 * (((c0 * d_1) / (d * d)) * ((c0 * d_1) / (h * w)))) / (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 (h <= -8000000000.0) {
tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D));
} else {
tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (w + w);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if h <= -8000000000.0: tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D)) else: tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (w + w) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (h <= -8000000000.0) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 * Float64(Float64(d * d) * c0)) / Float64(Float64(h * Float64(w * D)) * D))); else tmp = Float64(Float64(2.0 * Float64(Float64(Float64(c0 * d) / Float64(D * D)) * Float64(Float64(c0 * d) / Float64(h * w)))) / Float64(w + w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (h <= -8000000000.0) tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D)); else tmp = (2.0 * (((c0 * d) / (D * D)) * ((c0 * d) / (h * w)))) / (w + w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[h, -8000000000.0], 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], N[(N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * d), $MachinePrecision] / N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w + w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -8000000000:\\
\;\;\;\;\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}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(\frac{c0 \cdot d}{D \cdot D} \cdot \frac{c0 \cdot d}{h \cdot w}\right)}{w + w}\\
\end{array}
\end{array}
if h < -8e9Initial 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-*.f6435.7
Applied rewrites35.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6438.0
Applied rewrites38.0%
if -8e9 < h Initial program 23.6%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in c0 around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6435.5
Applied rewrites35.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f6439.4
Applied rewrites39.4%
(FPCore (c0 w h D d M) :precision binary64 (if (<= h -8.2e-137) (* (/ c0 (* 2.0 w)) (/ (* 2.0 (* (* d d) c0)) (* (* h (* w D)) D))) (/ (* 2.0 (/ (* (* c0 d) (* c0 d)) (* (* D D) (* h w)))) (+ w w))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (h <= -8.2e-137) {
tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D));
} else {
tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (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 (h <= (-8.2d-137)) then
tmp = (c0 / (2.0d0 * w)) * ((2.0d0 * ((d_1 * d_1) * c0)) / ((h * (w * d)) * d))
else
tmp = (2.0d0 * (((c0 * d_1) * (c0 * d_1)) / ((d * d) * (h * w)))) / (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 (h <= -8.2e-137) {
tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D));
} else {
tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if h <= -8.2e-137: tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D)) else: tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (h <= -8.2e-137) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 * Float64(Float64(d * d) * c0)) / Float64(Float64(h * Float64(w * D)) * D))); else tmp = Float64(Float64(2.0 * Float64(Float64(Float64(c0 * d) * Float64(c0 * d)) / Float64(Float64(D * D) * Float64(h * w)))) / Float64(w + w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (h <= -8.2e-137) tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / ((h * (w * D)) * D)); else tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[h, -8.2e-137], 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], N[(N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] * N[(c0 * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w + w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -8.2 \cdot 10^{-137}:\\
\;\;\;\;\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}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{\left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}}{w + w}\\
\end{array}
\end{array}
if h < -8.1999999999999997e-137Initial program 24.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-*.f6436.1
Applied rewrites36.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6437.6
Applied rewrites37.6%
if -8.1999999999999997e-137 < h Initial program 23.1%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in c0 around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6435.4
Applied rewrites35.4%
(FPCore (c0 w h D d M) :precision binary64 (if (<= h -5e-140) (* (/ c0 (* 2.0 w)) (/ (* 2.0 (* d (* d c0))) (* (* (* h w) D) D))) (/ (* 2.0 (/ (* (* c0 d) (* c0 d)) (* (* D D) (* h w)))) (+ w w))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (h <= -5e-140) {
tmp = (c0 / (2.0 * w)) * ((2.0 * (d * (d * c0))) / (((h * w) * D) * D));
} else {
tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (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 (h <= (-5d-140)) then
tmp = (c0 / (2.0d0 * w)) * ((2.0d0 * (d_1 * (d_1 * c0))) / (((h * w) * d) * d))
else
tmp = (2.0d0 * (((c0 * d_1) * (c0 * d_1)) / ((d * d) * (h * w)))) / (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 (h <= -5e-140) {
tmp = (c0 / (2.0 * w)) * ((2.0 * (d * (d * c0))) / (((h * w) * D) * D));
} else {
tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if h <= -5e-140: tmp = (c0 / (2.0 * w)) * ((2.0 * (d * (d * c0))) / (((h * w) * D) * D)) else: tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (h <= -5e-140) tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 * Float64(d * Float64(d * c0))) / Float64(Float64(Float64(h * w) * D) * D))); else tmp = Float64(Float64(2.0 * Float64(Float64(Float64(c0 * d) * Float64(c0 * d)) / Float64(Float64(D * D) * Float64(h * w)))) / Float64(w + w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (h <= -5e-140) tmp = (c0 / (2.0 * w)) * ((2.0 * (d * (d * c0))) / (((h * w) * D) * D)); else tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[h, -5e-140], 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], N[(N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] * N[(c0 * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w + w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-140}:\\
\;\;\;\;\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}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{\left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}}{w + w}\\
\end{array}
\end{array}
if h < -5.00000000000000015e-140Initial program 24.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-*.f6436.1
Applied rewrites36.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6440.1
Applied rewrites40.1%
if -5.00000000000000015e-140 < h Initial program 23.1%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in c0 around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6435.4
Applied rewrites35.4%
(FPCore (c0 w h D d M) :precision binary64 (if (<= h -1.35e-136) (/ (* c0 (/ (* (* 2.0 (* d d)) c0) (* (* (* h w) D) D))) (+ w w)) (/ (* 2.0 (/ (* (* c0 d) (* c0 d)) (* (* D D) (* h w)))) (+ w w))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (h <= -1.35e-136) {
tmp = (c0 * (((2.0 * (d * d)) * c0) / (((h * w) * D) * D))) / (w + w);
} else {
tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (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 (h <= (-1.35d-136)) then
tmp = (c0 * (((2.0d0 * (d_1 * d_1)) * c0) / (((h * w) * d) * d))) / (w + w)
else
tmp = (2.0d0 * (((c0 * d_1) * (c0 * d_1)) / ((d * d) * (h * w)))) / (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 (h <= -1.35e-136) {
tmp = (c0 * (((2.0 * (d * d)) * c0) / (((h * w) * D) * D))) / (w + w);
} else {
tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if h <= -1.35e-136: tmp = (c0 * (((2.0 * (d * d)) * c0) / (((h * w) * D) * D))) / (w + w) else: tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (h <= -1.35e-136) tmp = Float64(Float64(c0 * Float64(Float64(Float64(2.0 * Float64(d * d)) * c0) / Float64(Float64(Float64(h * w) * D) * D))) / Float64(w + w)); else tmp = Float64(Float64(2.0 * Float64(Float64(Float64(c0 * d) * Float64(c0 * d)) / Float64(Float64(D * D) * Float64(h * w)))) / Float64(w + w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (h <= -1.35e-136) tmp = (c0 * (((2.0 * (d * d)) * c0) / (((h * w) * D) * D))) / (w + w); else tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[h, -1.35e-136], N[(N[(c0 * N[(N[(N[(2.0 * N[(d * d), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] / N[(N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w + w), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] * N[(c0 * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w + w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.35 \cdot 10^{-136}:\\
\;\;\;\;\frac{c0 \cdot \frac{\left(2 \cdot \left(d \cdot d\right)\right) \cdot c0}{\left(\left(h \cdot w\right) \cdot D\right) \cdot D}}{w + w}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{\left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}}{w + w}\\
\end{array}
\end{array}
if h < -1.3499999999999999e-136Initial program 24.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-*.f6436.2
Applied rewrites36.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites36.0%
if -1.3499999999999999e-136 < h Initial program 23.1%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in c0 around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6435.4
Applied rewrites35.4%
(FPCore (c0 w h D d M) :precision binary64 (if (<= h -8.2e-137) (* (/ c0 (+ w w)) (/ (* 2.0 (* (* d d) c0)) (* (* (* h w) D) D))) (/ (* 2.0 (/ (* (* c0 d) (* c0 d)) (* (* D D) (* h w)))) (+ w w))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (h <= -8.2e-137) {
tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D));
} else {
tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (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 (h <= (-8.2d-137)) then
tmp = (c0 / (w + w)) * ((2.0d0 * ((d_1 * d_1) * c0)) / (((h * w) * d) * d))
else
tmp = (2.0d0 * (((c0 * d_1) * (c0 * d_1)) / ((d * d) * (h * w)))) / (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 (h <= -8.2e-137) {
tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D));
} else {
tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w);
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if h <= -8.2e-137: tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D)) else: tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (h <= -8.2e-137) tmp = Float64(Float64(c0 / Float64(w + w)) * Float64(Float64(2.0 * Float64(Float64(d * d) * c0)) / Float64(Float64(Float64(h * w) * D) * D))); else tmp = Float64(Float64(2.0 * Float64(Float64(Float64(c0 * d) * Float64(c0 * d)) / Float64(Float64(D * D) * Float64(h * w)))) / Float64(w + w)); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (h <= -8.2e-137) tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D)); else tmp = (2.0 * (((c0 * d) * (c0 * d)) / ((D * D) * (h * w)))) / (w + w); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[h, -8.2e-137], N[(N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] * N[(c0 * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w + w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -8.2 \cdot 10^{-137}:\\
\;\;\;\;\frac{c0}{w + w} \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(\left(h \cdot w\right) \cdot D\right) \cdot D}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{\left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}}{w + w}\\
\end{array}
\end{array}
if h < -8.1999999999999997e-137Initial program 24.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-*.f6436.1
Applied rewrites36.1%
lift-*.f64N/A
count-2-revN/A
lower-+.f6436.1
Applied rewrites36.1%
if -8.1999999999999997e-137 < h Initial program 23.1%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in c0 around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6435.4
Applied rewrites35.4%
(FPCore (c0 w h D d M) :precision binary64 (if (<= h -1.7e-138) (* (/ c0 (+ w w)) (/ (* 2.0 (* (* d d) c0)) (* (* (* h w) D) D))) (/ (* (* c0 d) (* c0 d)) (* (* D D) (* h (* w w))))))
double code(double c0, double w, double h, double D, double d, double M) {
double tmp;
if (h <= -1.7e-138) {
tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D));
} else {
tmp = ((c0 * d) * (c0 * d)) / ((D * D) * (h * (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 (h <= (-1.7d-138)) then
tmp = (c0 / (w + w)) * ((2.0d0 * ((d_1 * d_1) * c0)) / (((h * w) * d) * d))
else
tmp = ((c0 * d_1) * (c0 * d_1)) / ((d * d) * (h * (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 (h <= -1.7e-138) {
tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D));
} else {
tmp = ((c0 * d) * (c0 * d)) / ((D * D) * (h * (w * w)));
}
return tmp;
}
def code(c0, w, h, D, d, M): tmp = 0 if h <= -1.7e-138: tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D)) else: tmp = ((c0 * d) * (c0 * d)) / ((D * D) * (h * (w * w))) return tmp
function code(c0, w, h, D, d, M) tmp = 0.0 if (h <= -1.7e-138) tmp = Float64(Float64(c0 / Float64(w + w)) * Float64(Float64(2.0 * Float64(Float64(d * d) * c0)) / Float64(Float64(Float64(h * w) * D) * D))); else tmp = Float64(Float64(Float64(c0 * d) * Float64(c0 * d)) / Float64(Float64(D * D) * Float64(h * Float64(w * w)))); end return tmp end
function tmp_2 = code(c0, w, h, D, d, M) tmp = 0.0; if (h <= -1.7e-138) tmp = (c0 / (w + w)) * ((2.0 * ((d * d) * c0)) / (((h * w) * D) * D)); else tmp = ((c0 * d) * (c0 * d)) / ((D * D) * (h * (w * w))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[h, -1.7e-138], N[(N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(c0 * d), $MachinePrecision] * N[(c0 * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.7 \cdot 10^{-138}:\\
\;\;\;\;\frac{c0}{w + w} \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(\left(h \cdot w\right) \cdot D\right) \cdot D}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\\
\end{array}
\end{array}
if h < -1.7000000000000001e-138Initial program 24.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-*.f6436.1
Applied rewrites36.1%
lift-*.f64N/A
count-2-revN/A
lower-+.f6436.1
Applied rewrites36.1%
if -1.7000000000000001e-138 < h Initial program 23.1%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in c0 around inf
lower-/.f64N/A
pow2N/A
pow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.2
Applied rewrites32.2%
(FPCore (c0 w h D d M) :precision binary64 (/ (* (* c0 d) (* c0 d)) (* (* D D) (* h (* w w)))))
double code(double c0, double w, double h, double D, double d, double M) {
return ((c0 * d) * (c0 * d)) / ((D * D) * (h * (w * w)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = ((c0 * d_1) * (c0 * d_1)) / ((d * d) * (h * (w * w)))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return ((c0 * d) * (c0 * d)) / ((D * D) * (h * (w * w)));
}
def code(c0, w, h, D, d, M): return ((c0 * d) * (c0 * d)) / ((D * D) * (h * (w * w)))
function code(c0, w, h, D, d, M) return Float64(Float64(Float64(c0 * d) * Float64(c0 * d)) / Float64(Float64(D * D) * Float64(h * Float64(w * w)))) end
function tmp = code(c0, w, h, D, d, M) tmp = ((c0 * d) * (c0 * d)) / ((D * D) * (h * (w * w))); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(N[(c0 * d), $MachinePrecision] * N[(c0 * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}
\end{array}
Initial program 23.6%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in c0 around inf
lower-/.f64N/A
pow2N/A
pow2N/A
unswap-sqrN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.4
Applied rewrites32.4%
(FPCore (c0 w h D d M) :precision binary64 (* (* c0 c0) (/ (* d d) (* (* D D) (* h (* w w))))))
double code(double c0, double w, double h, double D, double d, double M) {
return (c0 * c0) * ((d * d) / ((D * D) * (h * (w * w))));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = (c0 * c0) * ((d_1 * d_1) / ((d * d) * (h * (w * w))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 * c0) * ((d * d) / ((D * D) * (h * (w * w))));
}
def code(c0, w, h, D, d, M): return (c0 * c0) * ((d * d) / ((D * D) * (h * (w * w))))
function code(c0, w, h, D, d, M) return Float64(Float64(c0 * c0) * Float64(Float64(d * d) / Float64(Float64(D * D) * Float64(h * Float64(w * w))))) end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 * c0) * ((d * d) / ((D * D) * (h * (w * w)))); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 * c0), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(c0 \cdot c0\right) \cdot \frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}
\end{array}
Initial program 23.6%
Taylor expanded in c0 around inf
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
unpow2N/A
lower-*.f6425.1
Applied rewrites25.1%
Taylor expanded in w around 0
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6425.2
Applied rewrites25.2%
(FPCore (c0 w h D d M) :precision binary64 (/ (* c0 (* (sqrt -1.0) M)) (+ w w)))
double code(double c0, double w, double h, double D, double d, double M) {
return (c0 * (sqrt(-1.0) * M)) / (w + w);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(c0, w, h, d, d_1, m)
use fmin_fmax_functions
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = (c0 * (sqrt((-1.0d0)) * m)) / (w + w)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 * (Math.sqrt(-1.0) * M)) / (w + w);
}
def code(c0, w, h, D, d, M): return (c0 * (math.sqrt(-1.0) * M)) / (w + w)
function code(c0, w, h, D, d, M) return Float64(Float64(c0 * Float64(sqrt(-1.0) * M)) / Float64(w + w)) end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 * (sqrt(-1.0) * M)) / (w + w); end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 * N[(N[Sqrt[-1.0], $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision] / N[(w + w), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{c0 \cdot \left(\sqrt{-1} \cdot M\right)}{w + w}
\end{array}
Initial program 23.6%
Taylor expanded in c0 around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
herbie shell --seed 2025121
(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))))))