
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (* M (/ D (+ d_m d_m))))
(t_1 (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l))))
(if (<= l 2.9e-282)
(* (/ d_m (sqrt (* l h))) t_1)
(* (/ (* 1.0 d_m) (* (sqrt l) (sqrt h))) t_1))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = M * (D / (d_m + d_m));
double t_1 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
double tmp;
if (l <= 2.9e-282) {
tmp = (d_m / sqrt((l * h))) * t_1;
} else {
tmp = ((1.0 * d_m) / (sqrt(l) * sqrt(h))) * t_1;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = m * (d / (d_m + d_m))
t_1 = 1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l)
if (l <= 2.9d-282) then
tmp = (d_m / sqrt((l * h))) * t_1
else
tmp = ((1.0d0 * d_m) / (sqrt(l) * sqrt(h))) * t_1
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = M * (D / (d_m + d_m));
double t_1 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
double tmp;
if (l <= 2.9e-282) {
tmp = (d_m / Math.sqrt((l * h))) * t_1;
} else {
tmp = ((1.0 * d_m) / (Math.sqrt(l) * Math.sqrt(h))) * t_1;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = M * (D / (d_m + d_m)) t_1 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l) tmp = 0 if l <= 2.9e-282: tmp = (d_m / math.sqrt((l * h))) * t_1 else: tmp = ((1.0 * d_m) / (math.sqrt(l) * math.sqrt(h))) * t_1 return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(M * Float64(D / Float64(d_m + d_m))) t_1 = Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l)) tmp = 0.0 if (l <= 2.9e-282) tmp = Float64(Float64(d_m / sqrt(Float64(l * h))) * t_1); else tmp = Float64(Float64(Float64(1.0 * d_m) / Float64(sqrt(l) * sqrt(h))) * t_1); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = M * (D / (d_m + d_m)); t_1 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l); tmp = 0.0; if (l <= 2.9e-282) tmp = (d_m / sqrt((l * h))) * t_1; else tmp = ((1.0 * d_m) / (sqrt(l) * sqrt(h))) * t_1; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M * N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 2.9e-282], N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(1.0 * d$95$m), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := M \cdot \frac{D}{d\_m + d\_m}\\
t_1 := 1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\\
\mathbf{if}\;\ell \leq 2.9 \cdot 10^{-282}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot d\_m}{\sqrt{\ell} \cdot \sqrt{h}} \cdot t\_1\\
\end{array}
\end{array}
if l < 2.89999999999999998e-282Initial program 7.1%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6468.2
Applied rewrites68.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites74.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6474.3
Applied rewrites74.3%
Taylor expanded in d around 0
Applied rewrites74.3%
if 2.89999999999999998e-282 < l Initial program 65.5%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6467.4
Applied rewrites67.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites71.7%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6472.1
Applied rewrites72.1%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lift-sqrt.f6482.6
Applied rewrites82.6%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (* M (/ D (+ d_m d_m)))))
(if (<= l 1.25e+58)
(* (/ d_m (sqrt (* l h))) (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))
(* (/ 1.0 (* (sqrt l) (sqrt h))) d_m))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = M * (D / (d_m + d_m));
double tmp;
if (l <= 1.25e+58) {
tmp = (d_m / sqrt((l * h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
} else {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = m * (d / (d_m + d_m))
if (l <= 1.25d+58) then
tmp = (d_m / sqrt((l * h))) * (1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l))
else
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d_m
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = M * (D / (d_m + d_m));
double tmp;
if (l <= 1.25e+58) {
tmp = (d_m / Math.sqrt((l * h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = M * (D / (d_m + d_m)) tmp = 0 if l <= 1.25e+58: tmp = (d_m / math.sqrt((l * h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l)) else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(M * Float64(D / Float64(d_m + d_m))) tmp = 0.0 if (l <= 1.25e+58) tmp = Float64(Float64(d_m / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l))); else tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = M * (D / (d_m + d_m)); tmp = 0.0; if (l <= 1.25e+58) tmp = (d_m / sqrt((l * h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l)); else tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M * N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 1.25e+58], N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := M \cdot \frac{D}{d\_m + d\_m}\\
\mathbf{if}\;\ell \leq 1.25 \cdot 10^{+58}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\end{array}
\end{array}
if l < 1.24999999999999996e58Initial program 29.3%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6471.4
Applied rewrites71.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites77.4%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6477.8
Applied rewrites77.8%
Taylor expanded in d around 0
Applied rewrites77.8%
if 1.24999999999999996e58 < l Initial program 56.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.5
Applied rewrites46.5%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6446.5
Applied rewrites46.5%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6458.9
Applied rewrites58.9%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (sqrt (* l h))) (t_1 (/ D (+ d_m d_m))))
(if (<= (* M D) 5e-38)
(* (/ (* 1.0 d_m) t_0) 1.0)
(* (- 1.0 (* (* (* M (* t_1 (* t_1 M))) 0.5) (/ h l))) (/ d_m t_0)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((l * h));
double t_1 = D / (d_m + d_m);
double tmp;
if ((M * D) <= 5e-38) {
tmp = ((1.0 * d_m) / t_0) * 1.0;
} else {
tmp = (1.0 - (((M * (t_1 * (t_1 * M))) * 0.5) * (h / l))) * (d_m / t_0);
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((l * h))
t_1 = d / (d_m + d_m)
if ((m * d) <= 5d-38) then
tmp = ((1.0d0 * d_m) / t_0) * 1.0d0
else
tmp = (1.0d0 - (((m * (t_1 * (t_1 * m))) * 0.5d0) * (h / l))) * (d_m / t_0)
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = Math.sqrt((l * h));
double t_1 = D / (d_m + d_m);
double tmp;
if ((M * D) <= 5e-38) {
tmp = ((1.0 * d_m) / t_0) * 1.0;
} else {
tmp = (1.0 - (((M * (t_1 * (t_1 * M))) * 0.5) * (h / l))) * (d_m / t_0);
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((l * h)) t_1 = D / (d_m + d_m) tmp = 0 if (M * D) <= 5e-38: tmp = ((1.0 * d_m) / t_0) * 1.0 else: tmp = (1.0 - (((M * (t_1 * (t_1 * M))) * 0.5) * (h / l))) * (d_m / t_0) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(l * h)) t_1 = Float64(D / Float64(d_m + d_m)) tmp = 0.0 if (Float64(M * D) <= 5e-38) tmp = Float64(Float64(Float64(1.0 * d_m) / t_0) * 1.0); else tmp = Float64(Float64(1.0 - Float64(Float64(Float64(M * Float64(t_1 * Float64(t_1 * M))) * 0.5) * Float64(h / l))) * Float64(d_m / t_0)); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((l * h)); t_1 = D / (d_m + d_m); tmp = 0.0; if ((M * D) <= 5e-38) tmp = ((1.0 * d_m) / t_0) * 1.0; else tmp = (1.0 - (((M * (t_1 * (t_1 * M))) * 0.5) * (h / l))) * (d_m / t_0); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M * D), $MachinePrecision], 5e-38], N[(N[(N[(1.0 * d$95$m), $MachinePrecision] / t$95$0), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(1.0 - N[(N[(N[(M * N[(t$95$1 * N[(t$95$1 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d$95$m / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
t_1 := \frac{D}{d\_m + d\_m}\\
\mathbf{if}\;M \cdot D \leq 5 \cdot 10^{-38}:\\
\;\;\;\;\frac{1 \cdot d\_m}{t\_0} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \left(\left(M \cdot \left(t\_1 \cdot \left(t\_1 \cdot M\right)\right)\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \cdot \frac{d\_m}{t\_0}\\
\end{array}
\end{array}
if (*.f64 M D) < 5.00000000000000033e-38Initial program 35.4%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6468.0
Applied rewrites68.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites73.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6474.0
Applied rewrites74.0%
Taylor expanded in d around inf
associate-*r/50.0
count-2-rev50.0
associate-*r/50.0
count-2-rev50.0
unpow250.0
metadata-eval50.0
*-commutative50.0
associate-*r/50.0
Applied rewrites50.0%
if 5.00000000000000033e-38 < (*.f64 M D) Initial program 33.8%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6467.5
Applied rewrites67.5%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites71.2%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6471.3
Applied rewrites71.3%
Applied rewrites66.9%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(if (<= d_m 4.8e-163)
(fma
(* (sqrt (/ h (* (* l l) l))) (* (* D D) (/ (* M M) d_m)))
-0.125
(* (sqrt (/ 1.0 (* l h))) d_m))
(if (<= d_m 3.6e+152)
(*
(/ (* 1.0 d_m) (sqrt (* l h)))
(- 1.0 (/ (* (* (/ (* (* (* M M) D) D) (* d_m d_m)) 0.125) h) l)))
(* (sqrt (/ (/ 1.0 l) h)) d_m))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (d_m <= 4.8e-163) {
tmp = fma((sqrt((h / ((l * l) * l))) * ((D * D) * ((M * M) / d_m))), -0.125, (sqrt((1.0 / (l * h))) * d_m));
} else if (d_m <= 3.6e+152) {
tmp = ((1.0 * d_m) / sqrt((l * h))) * (1.0 - (((((((M * M) * D) * D) / (d_m * d_m)) * 0.125) * h) / l));
} else {
tmp = sqrt(((1.0 / l) / h)) * d_m;
}
return tmp;
}
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (d_m <= 4.8e-163) tmp = fma(Float64(sqrt(Float64(h / Float64(Float64(l * l) * l))) * Float64(Float64(D * D) * Float64(Float64(M * M) / d_m))), -0.125, Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m)); elseif (d_m <= 3.6e+152) tmp = Float64(Float64(Float64(1.0 * d_m) / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(M * M) * D) * D) / Float64(d_m * d_m)) * 0.125) * h) / l))); else tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m); end return tmp end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[d$95$m, 4.8e-163], N[(N[(N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D * D), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125 + N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[d$95$m, 3.6e+152], N[(N[(N[(1.0 * d$95$m), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(N[(M * M), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] / N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;d\_m \leq 4.8 \cdot 10^{-163}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}} \cdot \left(\left(D \cdot D\right) \cdot \frac{M \cdot M}{d\_m}\right), -0.125, \sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right)\\
\mathbf{elif}\;d\_m \leq 3.6 \cdot 10^{+152}:\\
\;\;\;\;\frac{1 \cdot d\_m}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\frac{\left(\left(M \cdot M\right) \cdot D\right) \cdot D}{d\_m \cdot d\_m} \cdot 0.125\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\
\end{array}
\end{array}
if d < 4.8000000000000001e-163Initial program 22.7%
Taylor expanded in l around inf
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites41.0%
if 4.8000000000000001e-163 < d < 3.5999999999999999e152Initial program 36.4%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.5
Applied rewrites69.5%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites74.3%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6474.8
Applied rewrites74.8%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6466.2
Applied rewrites66.2%
if 3.5999999999999999e152 < d Initial program 44.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6467.0
Applied rewrites67.0%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6467.7
Applied rewrites67.7%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= d_m 3.8e-163)
(/ (* (* (* (* D D) (/ (* (* M M) -1.0) d_m)) t_0) 0.125) (* l l))
(if (<= d_m 3.6e+152)
(*
(/ (* 1.0 d_m) t_0)
(- 1.0 (/ (* (* (/ (* (* (* M M) D) D) (* d_m d_m)) 0.125) h) l)))
(* (sqrt (/ (/ 1.0 l) h)) d_m)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((l * h));
double tmp;
if (d_m <= 3.8e-163) {
tmp = ((((D * D) * (((M * M) * -1.0) / d_m)) * t_0) * 0.125) / (l * l);
} else if (d_m <= 3.6e+152) {
tmp = ((1.0 * d_m) / t_0) * (1.0 - (((((((M * M) * D) * D) / (d_m * d_m)) * 0.125) * h) / l));
} else {
tmp = sqrt(((1.0 / l) / h)) * d_m;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (d_m <= 3.8d-163) then
tmp = ((((d * d) * (((m * m) * (-1.0d0)) / d_m)) * t_0) * 0.125d0) / (l * l)
else if (d_m <= 3.6d+152) then
tmp = ((1.0d0 * d_m) / t_0) * (1.0d0 - (((((((m * m) * d) * d) / (d_m * d_m)) * 0.125d0) * h) / l))
else
tmp = sqrt(((1.0d0 / l) / h)) * d_m
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (d_m <= 3.8e-163) {
tmp = ((((D * D) * (((M * M) * -1.0) / d_m)) * t_0) * 0.125) / (l * l);
} else if (d_m <= 3.6e+152) {
tmp = ((1.0 * d_m) / t_0) * (1.0 - (((((((M * M) * D) * D) / (d_m * d_m)) * 0.125) * h) / l));
} else {
tmp = Math.sqrt(((1.0 / l) / h)) * d_m;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((l * h)) tmp = 0 if d_m <= 3.8e-163: tmp = ((((D * D) * (((M * M) * -1.0) / d_m)) * t_0) * 0.125) / (l * l) elif d_m <= 3.6e+152: tmp = ((1.0 * d_m) / t_0) * (1.0 - (((((((M * M) * D) * D) / (d_m * d_m)) * 0.125) * h) / l)) else: tmp = math.sqrt(((1.0 / l) / h)) * d_m return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (d_m <= 3.8e-163) tmp = Float64(Float64(Float64(Float64(Float64(D * D) * Float64(Float64(Float64(M * M) * -1.0) / d_m)) * t_0) * 0.125) / Float64(l * l)); elseif (d_m <= 3.6e+152) tmp = Float64(Float64(Float64(1.0 * d_m) / t_0) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(M * M) * D) * D) / Float64(d_m * d_m)) * 0.125) * h) / l))); else tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((l * h)); tmp = 0.0; if (d_m <= 3.8e-163) tmp = ((((D * D) * (((M * M) * -1.0) / d_m)) * t_0) * 0.125) / (l * l); elseif (d_m <= 3.6e+152) tmp = ((1.0 * d_m) / t_0) * (1.0 - (((((((M * M) * D) * D) / (d_m * d_m)) * 0.125) * h) / l)); else tmp = sqrt(((1.0 / l) / h)) * d_m; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d$95$m, 3.8e-163], N[(N[(N[(N[(N[(D * D), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * -1.0), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * 0.125), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[d$95$m, 3.6e+152], N[(N[(N[(1.0 * d$95$m), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(N[(M * M), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] / N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;d\_m \leq 3.8 \cdot 10^{-163}:\\
\;\;\;\;\frac{\left(\left(\left(D \cdot D\right) \cdot \frac{\left(M \cdot M\right) \cdot -1}{d\_m}\right) \cdot t\_0\right) \cdot 0.125}{\ell \cdot \ell}\\
\mathbf{elif}\;d\_m \leq 3.6 \cdot 10^{+152}:\\
\;\;\;\;\frac{1 \cdot d\_m}{t\_0} \cdot \left(1 - \frac{\left(\frac{\left(\left(M \cdot M\right) \cdot D\right) \cdot D}{d\_m \cdot d\_m} \cdot 0.125\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\
\end{array}
\end{array}
if d < 3.8e-163Initial program 22.7%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites30.6%
Taylor expanded in h around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites33.5%
if 3.8e-163 < d < 3.5999999999999999e152Initial program 36.4%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.4
Applied rewrites69.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites74.3%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6474.8
Applied rewrites74.8%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6466.2
Applied rewrites66.2%
if 3.5999999999999999e152 < d Initial program 44.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6467.0
Applied rewrites67.0%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6467.7
Applied rewrites67.7%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= M 1.85e-64)
(* (/ (* 1.0 d_m) t_0) 1.0)
(/ (* (/ (* t_0 (* (* (* M M) D) D)) d_m) -0.125) (* l l)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((l * h));
double tmp;
if (M <= 1.85e-64) {
tmp = ((1.0 * d_m) / t_0) * 1.0;
} else {
tmp = (((t_0 * (((M * M) * D) * D)) / d_m) * -0.125) / (l * l);
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (m <= 1.85d-64) then
tmp = ((1.0d0 * d_m) / t_0) * 1.0d0
else
tmp = (((t_0 * (((m * m) * d) * d)) / d_m) * (-0.125d0)) / (l * l)
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (M <= 1.85e-64) {
tmp = ((1.0 * d_m) / t_0) * 1.0;
} else {
tmp = (((t_0 * (((M * M) * D) * D)) / d_m) * -0.125) / (l * l);
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((l * h)) tmp = 0 if M <= 1.85e-64: tmp = ((1.0 * d_m) / t_0) * 1.0 else: tmp = (((t_0 * (((M * M) * D) * D)) / d_m) * -0.125) / (l * l) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (M <= 1.85e-64) tmp = Float64(Float64(Float64(1.0 * d_m) / t_0) * 1.0); else tmp = Float64(Float64(Float64(Float64(t_0 * Float64(Float64(Float64(M * M) * D) * D)) / d_m) * -0.125) / Float64(l * l)); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((l * h)); tmp = 0.0; if (M <= 1.85e-64) tmp = ((1.0 * d_m) / t_0) * 1.0; else tmp = (((t_0 * (((M * M) * D) * D)) / d_m) * -0.125) / (l * l); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, 1.85e-64], N[(N[(N[(1.0 * d$95$m), $MachinePrecision] / t$95$0), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(N[(t$95$0 * N[(N[(N[(M * M), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision] * -0.125), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;M \leq 1.85 \cdot 10^{-64}:\\
\;\;\;\;\frac{1 \cdot d\_m}{t\_0} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0 \cdot \left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right)}{d\_m} \cdot -0.125}{\ell \cdot \ell}\\
\end{array}
\end{array}
if M < 1.84999999999999999e-64Initial program 36.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6468.3
Applied rewrites68.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites73.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6473.9
Applied rewrites73.9%
Taylor expanded in d around inf
associate-*r/48.1
count-2-rev48.1
associate-*r/48.1
count-2-rev48.1
unpow248.1
metadata-eval48.1
*-commutative48.1
associate-*r/48.1
Applied rewrites48.1%
if 1.84999999999999999e-64 < M Initial program 31.9%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites35.3%
Taylor expanded in d around 0
*-commutativeN/A
associate-*l/N/A
*-commutativeN/A
pow2N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.5%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (if (<= M 5e-75) (* (/ (* 1.0 d_m) (sqrt (* l h))) 1.0) (* (* -0.125 (* (* D D) (/ (* M M) d_m))) (sqrt (/ h (* (* l l) l))))))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (M <= 5e-75) {
tmp = ((1.0 * d_m) / sqrt((l * h))) * 1.0;
} else {
tmp = (-0.125 * ((D * D) * ((M * M) / d_m))) * sqrt((h / ((l * l) * l)));
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: tmp
if (m <= 5d-75) then
tmp = ((1.0d0 * d_m) / sqrt((l * h))) * 1.0d0
else
tmp = ((-0.125d0) * ((d * d) * ((m * m) / d_m))) * sqrt((h / ((l * l) * l)))
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (M <= 5e-75) {
tmp = ((1.0 * d_m) / Math.sqrt((l * h))) * 1.0;
} else {
tmp = (-0.125 * ((D * D) * ((M * M) / d_m))) * Math.sqrt((h / ((l * l) * l)));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if M <= 5e-75: tmp = ((1.0 * d_m) / math.sqrt((l * h))) * 1.0 else: tmp = (-0.125 * ((D * D) * ((M * M) / d_m))) * math.sqrt((h / ((l * l) * l))) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (M <= 5e-75) tmp = Float64(Float64(Float64(1.0 * d_m) / sqrt(Float64(l * h))) * 1.0); else tmp = Float64(Float64(-0.125 * Float64(Float64(D * D) * Float64(Float64(M * M) / d_m))) * sqrt(Float64(h / Float64(Float64(l * l) * l)))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (M <= 5e-75) tmp = ((1.0 * d_m) / sqrt((l * h))) * 1.0; else tmp = (-0.125 * ((D * D) * ((M * M) / d_m))) * sqrt((h / ((l * l) * l))); end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[M, 5e-75], N[(N[(N[(1.0 * d$95$m), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(-0.125 * N[(N[(D * D), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;M \leq 5 \cdot 10^{-75}:\\
\;\;\;\;\frac{1 \cdot d\_m}{\sqrt{\ell \cdot h}} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(-0.125 \cdot \left(\left(D \cdot D\right) \cdot \frac{M \cdot M}{d\_m}\right)\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
\end{array}
\end{array}
if M < 4.99999999999999979e-75Initial program 36.3%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6468.2
Applied rewrites68.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites73.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6473.8
Applied rewrites73.8%
Taylor expanded in d around inf
associate-*r/48.1
count-2-rev48.1
associate-*r/48.1
count-2-rev48.1
unpow248.1
metadata-eval48.1
*-commutative48.1
associate-*r/48.1
Applied rewrites48.1%
if 4.99999999999999979e-75 < M Initial program 31.9%
Taylor expanded in d around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6435.2
Applied rewrites35.2%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
(if (<= t_0 -5e-58)
(* (- d_m) (sqrt (/ 1.0 (* l h))))
(if (<= t_0 5e+252)
(* (/ (sqrt (/ 1.0 h)) (sqrt l)) d_m)
(* (/ (* 1.0 d_m) (sqrt (* l h))) 1.0)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-58) {
tmp = -d_m * sqrt((1.0 / (l * h)));
} else if (t_0 <= 5e+252) {
tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
} else {
tmp = ((1.0 * d_m) / sqrt((l * h))) * 1.0;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-5d-58)) then
tmp = -d_m * sqrt((1.0d0 / (l * h)))
else if (t_0 <= 5d+252) then
tmp = (sqrt((1.0d0 / h)) / sqrt(l)) * d_m
else
tmp = ((1.0d0 * d_m) / sqrt((l * h))) * 1.0d0
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-58) {
tmp = -d_m * Math.sqrt((1.0 / (l * h)));
} else if (t_0 <= 5e+252) {
tmp = (Math.sqrt((1.0 / h)) / Math.sqrt(l)) * d_m;
} else {
tmp = ((1.0 * d_m) / Math.sqrt((l * h))) * 1.0;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -5e-58: tmp = -d_m * math.sqrt((1.0 / (l * h))) elif t_0 <= 5e+252: tmp = (math.sqrt((1.0 / h)) / math.sqrt(l)) * d_m else: tmp = ((1.0 * d_m) / math.sqrt((l * h))) * 1.0 return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -5e-58) tmp = Float64(Float64(-d_m) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (t_0 <= 5e+252) tmp = Float64(Float64(sqrt(Float64(1.0 / h)) / sqrt(l)) * d_m); else tmp = Float64(Float64(Float64(1.0 * d_m) / sqrt(Float64(l * h))) * 1.0); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -5e-58) tmp = -d_m * sqrt((1.0 / (l * h))); elseif (t_0 <= 5e+252) tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m; else tmp = ((1.0 * d_m) / sqrt((l * h))) * 1.0; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-58], N[((-d$95$m) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+252], N[(N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(N[(1.0 * d$95$m), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-58}:\\
\;\;\;\;\left(-d\_m\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+252}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot d\_m}{\sqrt{\ell \cdot h}} \cdot 1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.99999999999999977e-58Initial program 83.6%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6475.3
Applied rewrites75.3%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-/.f64N/A
lift-*.f6423.2
Applied rewrites23.2%
if -4.99999999999999977e-58 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999997e252Initial program 87.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6470.9
Applied rewrites70.9%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6472.0
Applied rewrites72.0%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
lower-sqrt.f6487.5
Applied rewrites87.5%
if 4.9999999999999997e252 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 7.6%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6464.0
Applied rewrites64.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites72.1%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-commutativeN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6472.3
Applied rewrites72.3%
Taylor expanded in d around inf
associate-*r/44.6
count-2-rev44.6
associate-*r/44.6
count-2-rev44.6
unpow244.6
metadata-eval44.6
*-commutative44.6
associate-*r/44.6
Applied rewrites44.6%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
(if (<= t_0 -5e-58)
(* (- d_m) (sqrt (/ 1.0 (* l h))))
(if (<= t_0 1e+169)
(* (/ (sqrt (/ 1.0 h)) (sqrt l)) d_m)
(* (/ 1.0 (sqrt (* l h))) d_m)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-58) {
tmp = -d_m * sqrt((1.0 / (l * h)));
} else if (t_0 <= 1e+169) {
tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
} else {
tmp = (1.0 / sqrt((l * h))) * d_m;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-5d-58)) then
tmp = -d_m * sqrt((1.0d0 / (l * h)))
else if (t_0 <= 1d+169) then
tmp = (sqrt((1.0d0 / h)) / sqrt(l)) * d_m
else
tmp = (1.0d0 / sqrt((l * h))) * d_m
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-58) {
tmp = -d_m * Math.sqrt((1.0 / (l * h)));
} else if (t_0 <= 1e+169) {
tmp = (Math.sqrt((1.0 / h)) / Math.sqrt(l)) * d_m;
} else {
tmp = (1.0 / Math.sqrt((l * h))) * d_m;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -5e-58: tmp = -d_m * math.sqrt((1.0 / (l * h))) elif t_0 <= 1e+169: tmp = (math.sqrt((1.0 / h)) / math.sqrt(l)) * d_m else: tmp = (1.0 / math.sqrt((l * h))) * d_m return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -5e-58) tmp = Float64(Float64(-d_m) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (t_0 <= 1e+169) tmp = Float64(Float64(sqrt(Float64(1.0 / h)) / sqrt(l)) * d_m); else tmp = Float64(Float64(1.0 / sqrt(Float64(l * h))) * d_m); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -5e-58) tmp = -d_m * sqrt((1.0 / (l * h))); elseif (t_0 <= 1e+169) tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m; else tmp = (1.0 / sqrt((l * h))) * d_m; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-58], N[((-d$95$m) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+169], N[(N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-58}:\\
\;\;\;\;\left(-d\_m\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;t\_0 \leq 10^{+169}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell \cdot h}} \cdot d\_m\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.99999999999999977e-58Initial program 83.6%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6475.3
Applied rewrites75.3%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-/.f64N/A
lift-*.f6423.2
Applied rewrites23.2%
if -4.99999999999999977e-58 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 9.99999999999999934e168Initial program 86.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.8
Applied rewrites69.8%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6470.9
Applied rewrites70.9%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lift-/.f64N/A
lower-sqrt.f6486.6
Applied rewrites86.6%
if 9.99999999999999934e168 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 9.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6445.2
Applied rewrites45.2%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6445.4
Applied rewrites45.4%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
(if (<= t_0 -5e-58)
(* (- d_m) (sqrt (/ 1.0 (* l h))))
(if (<= t_0 1e+169)
(* (/ 1.0 (* (sqrt l) (sqrt h))) d_m)
(* (/ 1.0 (sqrt (* l h))) d_m)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-58) {
tmp = -d_m * sqrt((1.0 / (l * h)));
} else if (t_0 <= 1e+169) {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
} else {
tmp = (1.0 / sqrt((l * h))) * d_m;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: t_0
real(8) :: tmp
t_0 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-5d-58)) then
tmp = -d_m * sqrt((1.0d0 / (l * h)))
else if (t_0 <= 1d+169) then
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d_m
else
tmp = (1.0d0 / sqrt((l * h))) * d_m
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double t_0 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -5e-58) {
tmp = -d_m * Math.sqrt((1.0 / (l * h)));
} else if (t_0 <= 1e+169) {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
} else {
tmp = (1.0 / Math.sqrt((l * h))) * d_m;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -5e-58: tmp = -d_m * math.sqrt((1.0 / (l * h))) elif t_0 <= 1e+169: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m else: tmp = (1.0 / math.sqrt((l * h))) * d_m return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -5e-58) tmp = Float64(Float64(-d_m) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (t_0 <= 1e+169) tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m); else tmp = Float64(Float64(1.0 / sqrt(Float64(l * h))) * d_m); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -5e-58) tmp = -d_m * sqrt((1.0 / (l * h))); elseif (t_0 <= 1e+169) tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m; else tmp = (1.0 / sqrt((l * h))) * d_m; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-58], N[((-d$95$m) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+169], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-58}:\\
\;\;\;\;\left(-d\_m\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;t\_0 \leq 10^{+169}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell \cdot h}} \cdot d\_m\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.99999999999999977e-58Initial program 83.6%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6475.3
Applied rewrites75.3%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-/.f64N/A
lift-*.f6423.2
Applied rewrites23.2%
if -4.99999999999999977e-58 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 9.99999999999999934e168Initial program 86.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6469.8
Applied rewrites69.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6470.3
Applied rewrites70.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6486.6
Applied rewrites86.6%
if 9.99999999999999934e168 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 9.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6445.2
Applied rewrites45.2%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6445.4
Applied rewrites45.4%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(if (<=
(*
(* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))
-5e-58)
(* (- d_m) (sqrt (/ 1.0 (* l h))))
(* (/ 1.0 (sqrt (* l h))) d_m)))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (((pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e-58) {
tmp = -d_m * sqrt((1.0 / (l * h)));
} else {
tmp = (1.0 / sqrt((l * h))) * d_m;
}
return tmp;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8) :: tmp
if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))) <= (-5d-58)) then
tmp = -d_m * sqrt((1.0d0 / (l * h)))
else
tmp = (1.0d0 / sqrt((l * h))) * d_m
end if
code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (((Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e-58) {
tmp = -d_m * Math.sqrt((1.0 / (l * h)));
} else {
tmp = (1.0 / Math.sqrt((l * h))) * d_m;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if ((math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e-58: tmp = -d_m * math.sqrt((1.0 / (l * h))) else: tmp = (1.0 / math.sqrt((l * h))) * d_m return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) <= -5e-58) tmp = Float64(Float64(-d_m) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(Float64(1.0 / sqrt(Float64(l * h))) * d_m); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (((((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)))) <= -5e-58) tmp = -d_m * sqrt((1.0 / (l * h))); else tmp = (1.0 / sqrt((l * h))) * d_m; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-58], N[((-d$95$m) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{-58}:\\
\;\;\;\;\left(-d\_m\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell \cdot h}} \cdot d\_m\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.99999999999999977e-58Initial program 83.6%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6475.3
Applied rewrites75.3%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-/.f64N/A
lift-*.f6423.2
Applied rewrites23.2%
if -4.99999999999999977e-58 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 25.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6450.3
Applied rewrites50.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6450.6
Applied rewrites50.6%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (* (/ 1.0 (sqrt (* l h))) d_m))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
return (1.0 / sqrt((l * h))) * d_m;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
code = (1.0d0 / sqrt((l * h))) * d_m
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
return (1.0 / Math.sqrt((l * h))) * d_m;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): return (1.0 / math.sqrt((l * h))) * d_m
d_m = abs(d) function code(d_m, h, l, M, D) return Float64(Float64(1.0 / sqrt(Float64(l * h))) * d_m) end
d_m = abs(d); function tmp = code(d_m, h, l, M, D) tmp = (1.0 / sqrt((l * h))) * d_m; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := N[(N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
\frac{1}{\sqrt{\ell \cdot h}} \cdot d\_m
\end{array}
Initial program 34.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.2
Applied rewrites42.2%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f6442.5
Applied rewrites42.5%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (* (sqrt (/ 1.0 (* l h))) d_m))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
return sqrt((1.0 / (l * h))) * d_m;
}
d_m = private
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(d_m, h, l, m, d)
use fmin_fmax_functions
real(8), intent (in) :: d_m
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d
code = sqrt((1.0d0 / (l * h))) * d_m
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
return Math.sqrt((1.0 / (l * h))) * d_m;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): return math.sqrt((1.0 / (l * h))) * d_m
d_m = abs(d) function code(d_m, h, l, M, D) return Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) end
d_m = abs(d); function tmp = code(d_m, h, l, M, D) tmp = sqrt((1.0 / (l * h))) * d_m; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m
\end{array}
Initial program 34.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.2
Applied rewrites42.2%
herbie shell --seed 2025120
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))