
(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 14 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
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))
(t_1 (* (/ D (+ d_m d_m)) M)))
(if (<=
(* (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0))) t_0)
1e+291)
(* (/ (* (sqrt d_m) (sqrt (/ d_m l))) (sqrt h)) t_0)
(*
(* d_m (sqrt (/ 1.0 (* h l))))
(- 1.0 (/ (* (* (* 0.5 t_1) t_1) h) l))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
double t_1 = (D / (d_m + d_m)) * M;
double tmp;
if (((pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * t_0) <= 1e+291) {
tmp = ((sqrt(d_m) * sqrt((d_m / l))) / sqrt(h)) * t_0;
} else {
tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / 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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l))
t_1 = (d / (d_m + d_m)) * m
if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * t_0) <= 1d+291) then
tmp = ((sqrt(d_m) * sqrt((d_m / l))) / sqrt(h)) * t_0
else
tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - ((((0.5d0 * t_1) * t_1) * h) / 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 = 1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
double t_1 = (D / (d_m + d_m)) * M;
double tmp;
if (((Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * t_0) <= 1e+291) {
tmp = ((Math.sqrt(d_m) * Math.sqrt((d_m / l))) / Math.sqrt(h)) * t_0;
} else {
tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / l));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = 1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)) t_1 = (D / (d_m + d_m)) * M tmp = 0 if ((math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * t_0) <= 1e+291: tmp = ((math.sqrt(d_m) * math.sqrt((d_m / l))) / math.sqrt(h)) * t_0 else: tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / l)) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_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))) t_1 = Float64(Float64(D / Float64(d_m + d_m)) * M) tmp = 0.0 if (Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * t_0) <= 1e+291) tmp = Float64(Float64(Float64(sqrt(d_m) * sqrt(Float64(d_m / l))) / sqrt(h)) * t_0); else tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(0.5 * t_1) * t_1) * h) / l))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = 1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)); t_1 = (D / (d_m + d_m)) * M; tmp = 0.0; if (((((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * t_0) <= 1e+291) tmp = ((sqrt(d_m) * sqrt((d_m / l))) / sqrt(h)) * t_0; else tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / 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[(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]}, Block[{t$95$1 = N[(N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]}, 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] * t$95$0), $MachinePrecision], 1e+291], N[(N[(N[(N[Sqrt[d$95$m], $MachinePrecision] * N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(0.5 * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
t_1 := \frac{D}{d\_m + d\_m} \cdot M\\
\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 t\_0 \leq 10^{+291}:\\
\;\;\;\;\frac{\sqrt{d\_m} \cdot \sqrt{\frac{d\_m}{\ell}}}{\sqrt{h}} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(0.5 \cdot t\_1\right) \cdot t\_1\right) \cdot h}{\ell}\right)\\
\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)))) < 9.9999999999999996e290Initial program 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6437.9
Applied rewrites37.9%
if 9.9999999999999996e290 < (*.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 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites74.1%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (/ D (+ d_m d_m))) (t_1 (* t_0 M)) (t_2 (* M t_0)))
(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))))
1e+291)
(*
(* (sqrt (/ d_m l)) (/ (sqrt d_m) (sqrt h)))
(- 1.0 (* (* 0.5 (* t_2 t_2)) (/ h l))))
(*
(* d_m (sqrt (/ 1.0 (* h l))))
(- 1.0 (/ (* (* (* 0.5 t_1) t_1) h) l))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = D / (d_m + d_m);
double t_1 = t_0 * M;
double t_2 = M * t_0;
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)))) <= 1e+291) {
tmp = (sqrt((d_m / l)) * (sqrt(d_m) / sqrt(h))) * (1.0 - ((0.5 * (t_2 * t_2)) * (h / l)));
} else {
tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d / (d_m + d_m)
t_1 = t_0 * m
t_2 = m * t_0
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)))) <= 1d+291) then
tmp = (sqrt((d_m / l)) * (sqrt(d_m) / sqrt(h))) * (1.0d0 - ((0.5d0 * (t_2 * t_2)) * (h / l)))
else
tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - ((((0.5d0 * t_1) * t_1) * h) / 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 = D / (d_m + d_m);
double t_1 = t_0 * M;
double t_2 = M * t_0;
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)))) <= 1e+291) {
tmp = (Math.sqrt((d_m / l)) * (Math.sqrt(d_m) / Math.sqrt(h))) * (1.0 - ((0.5 * (t_2 * t_2)) * (h / l)));
} else {
tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / l));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = D / (d_m + d_m) t_1 = t_0 * M t_2 = M * t_0 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)))) <= 1e+291: tmp = (math.sqrt((d_m / l)) * (math.sqrt(d_m) / math.sqrt(h))) * (1.0 - ((0.5 * (t_2 * t_2)) * (h / l))) else: tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / l)) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(D / Float64(d_m + d_m)) t_1 = Float64(t_0 * M) t_2 = Float64(M * t_0) 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)))) <= 1e+291) tmp = Float64(Float64(sqrt(Float64(d_m / l)) * Float64(sqrt(d_m) / sqrt(h))) * Float64(1.0 - Float64(Float64(0.5 * Float64(t_2 * t_2)) * Float64(h / l)))); else tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(0.5 * t_1) * t_1) * h) / l))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = D / (d_m + d_m); t_1 = t_0 * M; t_2 = M * t_0; 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)))) <= 1e+291) tmp = (sqrt((d_m / l)) * (sqrt(d_m) / sqrt(h))) * (1.0 - ((0.5 * (t_2 * t_2)) * (h / l))); else tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / 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[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * M), $MachinePrecision]}, Block[{t$95$2 = N[(M * t$95$0), $MachinePrecision]}, 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], 1e+291], N[(N[(N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d$95$m], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(0.5 * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \frac{D}{d\_m + d\_m}\\
t_1 := t\_0 \cdot M\\
t_2 := M \cdot t\_0\\
\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 10^{+291}:\\
\;\;\;\;\left(\sqrt{\frac{d\_m}{\ell}} \cdot \frac{\sqrt{d\_m}}{\sqrt{h}}\right) \cdot \left(1 - \left(0.5 \cdot \left(t\_2 \cdot t\_2\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(0.5 \cdot t\_1\right) \cdot t\_1\right) \cdot h}{\ell}\right)\\
\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)))) < 9.9999999999999996e290Initial program 35.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.9
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
Applied rewrites33.7%
lift-pow.f64N/A
unpow2N/A
lower-*.f6433.7
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6433.3
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6433.5
Applied rewrites33.5%
lift-/.f64N/A
metadata-eval33.5
Applied rewrites33.5%
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
if 9.9999999999999996e290 < (*.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 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites74.1%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (/ D (+ d_m d_m))) (t_1 (* t_0 M)) (t_2 (* M t_0)))
(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))))
1e+291)
(*
(* (sqrt (/ d_m l)) (sqrt (/ d_m h)))
(- 1.0 (* (* 0.5 (* t_2 t_2)) (/ h l))))
(*
(* d_m (sqrt (/ 1.0 (* h l))))
(- 1.0 (/ (* (* (* 0.5 t_1) t_1) h) l))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = D / (d_m + d_m);
double t_1 = t_0 * M;
double t_2 = M * t_0;
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)))) <= 1e+291) {
tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * (1.0 - ((0.5 * (t_2 * t_2)) * (h / l)));
} else {
tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d / (d_m + d_m)
t_1 = t_0 * m
t_2 = m * t_0
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)))) <= 1d+291) then
tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * (1.0d0 - ((0.5d0 * (t_2 * t_2)) * (h / l)))
else
tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - ((((0.5d0 * t_1) * t_1) * h) / 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 = D / (d_m + d_m);
double t_1 = t_0 * M;
double t_2 = M * t_0;
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)))) <= 1e+291) {
tmp = (Math.sqrt((d_m / l)) * Math.sqrt((d_m / h))) * (1.0 - ((0.5 * (t_2 * t_2)) * (h / l)));
} else {
tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / l));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = D / (d_m + d_m) t_1 = t_0 * M t_2 = M * t_0 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)))) <= 1e+291: tmp = (math.sqrt((d_m / l)) * math.sqrt((d_m / h))) * (1.0 - ((0.5 * (t_2 * t_2)) * (h / l))) else: tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / l)) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(D / Float64(d_m + d_m)) t_1 = Float64(t_0 * M) t_2 = Float64(M * t_0) 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)))) <= 1e+291) tmp = Float64(Float64(sqrt(Float64(d_m / l)) * sqrt(Float64(d_m / h))) * Float64(1.0 - Float64(Float64(0.5 * Float64(t_2 * t_2)) * Float64(h / l)))); else tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(0.5 * t_1) * t_1) * h) / l))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = D / (d_m + d_m); t_1 = t_0 * M; t_2 = M * t_0; 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)))) <= 1e+291) tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * (1.0 - ((0.5 * (t_2 * t_2)) * (h / l))); else tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / 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[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * M), $MachinePrecision]}, Block[{t$95$2 = N[(M * t$95$0), $MachinePrecision]}, 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], 1e+291], N[(N[(N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(0.5 * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \frac{D}{d\_m + d\_m}\\
t_1 := t\_0 \cdot M\\
t_2 := M \cdot t\_0\\
\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 10^{+291}:\\
\;\;\;\;\left(\sqrt{\frac{d\_m}{\ell}} \cdot \sqrt{\frac{d\_m}{h}}\right) \cdot \left(1 - \left(0.5 \cdot \left(t\_2 \cdot t\_2\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(0.5 \cdot t\_1\right) \cdot t\_1\right) \cdot h}{\ell}\right)\\
\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)))) < 9.9999999999999996e290Initial program 35.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.9
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
Applied rewrites33.7%
lift-pow.f64N/A
unpow2N/A
lower-*.f6433.7
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6433.3
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6433.5
Applied rewrites33.5%
lift-/.f64N/A
metadata-eval33.5
Applied rewrites33.5%
if 9.9999999999999996e290 < (*.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 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites74.1%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (* (/ D (+ d_m d_m)) M)) (t_1 (* (* 0.5 t_0) t_0)))
(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))))
1e+291)
(* (sqrt (/ d_m h)) (* (sqrt (/ d_m l)) (- 1.0 (* t_1 (/ h l)))))
(* (* d_m (sqrt (/ 1.0 (* h l)))) (- 1.0 (/ (* t_1 h) l))))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = (D / (d_m + d_m)) * M;
double t_1 = (0.5 * t_0) * t_0;
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)))) <= 1e+291) {
tmp = sqrt((d_m / h)) * (sqrt((d_m / l)) * (1.0 - (t_1 * (h / l))));
} else {
tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((t_1 * h) / 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) :: t_1
real(8) :: tmp
t_0 = (d / (d_m + d_m)) * m
t_1 = (0.5d0 * t_0) * t_0
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)))) <= 1d+291) then
tmp = sqrt((d_m / h)) * (sqrt((d_m / l)) * (1.0d0 - (t_1 * (h / l))))
else
tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - ((t_1 * h) / 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 = (D / (d_m + d_m)) * M;
double t_1 = (0.5 * t_0) * t_0;
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)))) <= 1e+291) {
tmp = Math.sqrt((d_m / h)) * (Math.sqrt((d_m / l)) * (1.0 - (t_1 * (h / l))));
} else {
tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - ((t_1 * h) / l));
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = (D / (d_m + d_m)) * M t_1 = (0.5 * t_0) * t_0 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)))) <= 1e+291: tmp = math.sqrt((d_m / h)) * (math.sqrt((d_m / l)) * (1.0 - (t_1 * (h / l)))) else: tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - ((t_1 * h) / l)) return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(Float64(D / Float64(d_m + d_m)) * M) t_1 = Float64(Float64(0.5 * t_0) * t_0) 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)))) <= 1e+291) tmp = Float64(sqrt(Float64(d_m / h)) * Float64(sqrt(Float64(d_m / l)) * Float64(1.0 - Float64(t_1 * Float64(h / l))))); else tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(t_1 * h) / l))); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = (D / (d_m + d_m)) * M; t_1 = (0.5 * t_0) * t_0; 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)))) <= 1e+291) tmp = sqrt((d_m / h)) * (sqrt((d_m / l)) * (1.0 - (t_1 * (h / l)))); else tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((t_1 * h) / 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[(N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]}, 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], 1e+291], N[(N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$1 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$1 * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \frac{D}{d\_m + d\_m} \cdot M\\
t_1 := \left(0.5 \cdot t\_0\right) \cdot t\_0\\
\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 10^{+291}:\\
\;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \left(\sqrt{\frac{d\_m}{\ell}} \cdot \left(1 - t\_1 \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{t\_1 \cdot h}{\ell}\right)\\
\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)))) < 9.9999999999999996e290Initial program 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6433.6
Applied rewrites33.4%
if 9.9999999999999996e290 < (*.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 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites74.1%
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)))))
(t_1 (* (/ D (+ d_m d_m)) M))
(t_2
(*
(* d_m (sqrt (/ 1.0 (* h l))))
(- 1.0 (/ (* (* (* 0.5 t_1) t_1) h) l)))))
(if (<= t_0 5e-225)
t_2
(if (<= t_0 1e+291) (* (* (sqrt (/ d_m l)) (sqrt (/ d_m h))) 1.0) t_2))))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 t_1 = (D / (d_m + d_m)) * M;
double t_2 = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / l));
double tmp;
if (t_0 <= 5e-225) {
tmp = t_2;
} else if (t_0 <= 1e+291) {
tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0;
} else {
tmp = t_2;
}
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) :: t_2
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)))
t_1 = (d / (d_m + d_m)) * m
t_2 = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - ((((0.5d0 * t_1) * t_1) * h) / l))
if (t_0 <= 5d-225) then
tmp = t_2
else if (t_0 <= 1d+291) then
tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0d0
else
tmp = t_2
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 t_1 = (D / (d_m + d_m)) * M;
double t_2 = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / l));
double tmp;
if (t_0 <= 5e-225) {
tmp = t_2;
} else if (t_0 <= 1e+291) {
tmp = (Math.sqrt((d_m / l)) * Math.sqrt((d_m / h))) * 1.0;
} else {
tmp = t_2;
}
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))) t_1 = (D / (d_m + d_m)) * M t_2 = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / l)) tmp = 0 if t_0 <= 5e-225: tmp = t_2 elif t_0 <= 1e+291: tmp = (math.sqrt((d_m / l)) * math.sqrt((d_m / h))) * 1.0 else: tmp = t_2 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)))) t_1 = Float64(Float64(D / Float64(d_m + d_m)) * M) t_2 = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(0.5 * t_1) * t_1) * h) / l))) tmp = 0.0 if (t_0 <= 5e-225) tmp = t_2; elseif (t_0 <= 1e+291) tmp = Float64(Float64(sqrt(Float64(d_m / l)) * sqrt(Float64(d_m / h))) * 1.0); else tmp = t_2; 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))); t_1 = (D / (d_m + d_m)) * M; t_2 = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((0.5 * t_1) * t_1) * h) / l)); tmp = 0.0; if (t_0 <= 5e-225) tmp = t_2; elseif (t_0 <= 1e+291) tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0; else tmp = t_2; 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]}, Block[{t$95$1 = N[(N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(0.5 * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-225], t$95$2, If[LessEqual[t$95$0, 1e+291], N[(N[(N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$2]]]]]
\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)\\
t_1 := \frac{D}{d\_m + d\_m} \cdot M\\
t_2 := \left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(0.5 \cdot t\_1\right) \cdot t\_1\right) \cdot h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-225}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 10^{+291}:\\
\;\;\;\;\left(\sqrt{\frac{d\_m}{\ell}} \cdot \sqrt{\frac{d\_m}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\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)))) < 5.0000000000000001e-225 or 9.9999999999999996e290 < (*.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 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites74.1%
if 5.0000000000000001e-225 < (*.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.9999999999999996e290Initial program 35.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.9
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
Applied rewrites33.7%
Taylor expanded in d around inf
Applied rewrites20.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)))))
(t_1 (/ D (+ d_m d_m)))
(t_2
(*
(* d_m (sqrt (/ 1.0 (* h l))))
(- 1.0 (* (* (* M (* t_1 (* t_1 M))) 0.5) (/ h l))))))
(if (<= t_0 5e-225)
t_2
(if (<= t_0 1e+291) (* (* (sqrt (/ d_m l)) (sqrt (/ d_m h))) 1.0) t_2))))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 t_1 = D / (d_m + d_m);
double t_2 = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((M * (t_1 * (t_1 * M))) * 0.5) * (h / l)));
double tmp;
if (t_0 <= 5e-225) {
tmp = t_2;
} else if (t_0 <= 1e+291) {
tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0;
} else {
tmp = t_2;
}
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) :: t_2
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)))
t_1 = d / (d_m + d_m)
t_2 = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - (((m * (t_1 * (t_1 * m))) * 0.5d0) * (h / l)))
if (t_0 <= 5d-225) then
tmp = t_2
else if (t_0 <= 1d+291) then
tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0d0
else
tmp = t_2
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 t_1 = D / (d_m + d_m);
double t_2 = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - (((M * (t_1 * (t_1 * M))) * 0.5) * (h / l)));
double tmp;
if (t_0 <= 5e-225) {
tmp = t_2;
} else if (t_0 <= 1e+291) {
tmp = (Math.sqrt((d_m / l)) * Math.sqrt((d_m / h))) * 1.0;
} else {
tmp = t_2;
}
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))) t_1 = D / (d_m + d_m) t_2 = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - (((M * (t_1 * (t_1 * M))) * 0.5) * (h / l))) tmp = 0 if t_0 <= 5e-225: tmp = t_2 elif t_0 <= 1e+291: tmp = (math.sqrt((d_m / l)) * math.sqrt((d_m / h))) * 1.0 else: tmp = t_2 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)))) t_1 = Float64(D / Float64(d_m + d_m)) t_2 = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(M * Float64(t_1 * Float64(t_1 * M))) * 0.5) * Float64(h / l)))) tmp = 0.0 if (t_0 <= 5e-225) tmp = t_2; elseif (t_0 <= 1e+291) tmp = Float64(Float64(sqrt(Float64(d_m / l)) * sqrt(Float64(d_m / h))) * 1.0); else tmp = t_2; 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))); t_1 = D / (d_m + d_m); t_2 = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((M * (t_1 * (t_1 * M))) * 0.5) * (h / l))); tmp = 0.0; if (t_0 <= 5e-225) tmp = t_2; elseif (t_0 <= 1e+291) tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0; else tmp = t_2; 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]}, Block[{t$95$1 = N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 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]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-225], t$95$2, If[LessEqual[t$95$0, 1e+291], N[(N[(N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$2]]]]]
\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)\\
t_1 := \frac{D}{d\_m + d\_m}\\
t_2 := \left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \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)\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-225}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 10^{+291}:\\
\;\;\;\;\left(\sqrt{\frac{d\_m}{\ell}} \cdot \sqrt{\frac{d\_m}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\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)))) < 5.0000000000000001e-225 or 9.9999999999999996e290 < (*.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 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.3%
if 5.0000000000000001e-225 < (*.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.9999999999999996e290Initial program 35.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.9
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
Applied rewrites33.7%
Taylor expanded in d around inf
Applied rewrites20.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 -1e-127)
(*
(fma
(* (/ (* (* D M) (* D M)) (* (+ d_m d_m) (+ d_m d_m))) -0.5)
(/ h l)
1.0)
(sqrt (/ (* d_m d_m) (* h l))))
(if (<= t_0 1e+291)
(* (* (sqrt (/ d_m l)) (sqrt (/ d_m h))) 1.0)
(* (* d_m (sqrt (/ 1.0 (* h l)))) 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 <= -1e-127) {
tmp = fma(((((D * M) * (D * M)) / ((d_m + d_m) * (d_m + d_m))) * -0.5), (h / l), 1.0) * sqrt(((d_m * d_m) / (h * l)));
} else if (t_0 <= 1e+291) {
tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0;
} else {
tmp = (d_m * sqrt((1.0 / (h * l)))) * 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 <= -1e-127) tmp = Float64(fma(Float64(Float64(Float64(Float64(D * M) * Float64(D * M)) / Float64(Float64(d_m + d_m) * Float64(d_m + d_m))) * -0.5), Float64(h / l), 1.0) * sqrt(Float64(Float64(d_m * d_m) / Float64(h * l)))); elseif (t_0 <= 1e+291) tmp = Float64(Float64(sqrt(Float64(d_m / l)) * sqrt(Float64(d_m / h))) * 1.0); else tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * 1.0); end return 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, -1e-127], N[(N[(N[(N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d$95$m * d$95$m), $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+291], N[(N[(N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $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 -1 \cdot 10^{-127}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)} \cdot -0.5, \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d\_m \cdot d\_m}{h \cdot \ell}}\\
\mathbf{elif}\;t\_0 \leq 10^{+291}:\\
\;\;\;\;\left(\sqrt{\frac{d\_m}{\ell}} \cdot \sqrt{\frac{d\_m}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \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)))) < -1e-127Initial program 35.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.9
Applied rewrites34.8%
if -1e-127 < (*.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.9999999999999996e290Initial program 35.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.9
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
Applied rewrites33.7%
Taylor expanded in d around inf
Applied rewrites20.2%
if 9.9999999999999996e290 < (*.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 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
Taylor expanded in d around inf
Applied rewrites42.9%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d_m h)))
(t_1
(*
(* (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_1 -1e-127)
(/ (* -1.0 (* h (* t_0 (* d_m (sqrt (/ 1.0 (* d_m l))))))) h)
(if (<= t_1 1e+291)
(* (* (sqrt (/ d_m l)) t_0) 1.0)
(* (* d_m (sqrt (/ 1.0 (* h l)))) 1.0)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = sqrt((d_m / h));
double t_1 = (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_1 <= -1e-127) {
tmp = (-1.0 * (h * (t_0 * (d_m * sqrt((1.0 / (d_m * l))))))) / h;
} else if (t_1 <= 1e+291) {
tmp = (sqrt((d_m / l)) * t_0) * 1.0;
} else {
tmp = (d_m * sqrt((1.0 / (h * l)))) * 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) :: t_1
real(8) :: tmp
t_0 = sqrt((d_m / h))
t_1 = (((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_1 <= (-1d-127)) then
tmp = ((-1.0d0) * (h * (t_0 * (d_m * sqrt((1.0d0 / (d_m * l))))))) / h
else if (t_1 <= 1d+291) then
tmp = (sqrt((d_m / l)) * t_0) * 1.0d0
else
tmp = (d_m * sqrt((1.0d0 / (h * l)))) * 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.sqrt((d_m / h));
double t_1 = (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_1 <= -1e-127) {
tmp = (-1.0 * (h * (t_0 * (d_m * Math.sqrt((1.0 / (d_m * l))))))) / h;
} else if (t_1 <= 1e+291) {
tmp = (Math.sqrt((d_m / l)) * t_0) * 1.0;
} else {
tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * 1.0;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = math.sqrt((d_m / h)) t_1 = (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_1 <= -1e-127: tmp = (-1.0 * (h * (t_0 * (d_m * math.sqrt((1.0 / (d_m * l))))))) / h elif t_1 <= 1e+291: tmp = (math.sqrt((d_m / l)) * t_0) * 1.0 else: tmp = (d_m * math.sqrt((1.0 / (h * l)))) * 1.0 return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = sqrt(Float64(d_m / h)) t_1 = 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_1 <= -1e-127) tmp = Float64(Float64(-1.0 * Float64(h * Float64(t_0 * Float64(d_m * sqrt(Float64(1.0 / Float64(d_m * l))))))) / h); elseif (t_1 <= 1e+291) tmp = Float64(Float64(sqrt(Float64(d_m / l)) * t_0) * 1.0); else tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * 1.0); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = sqrt((d_m / h)); t_1 = (((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_1 <= -1e-127) tmp = (-1.0 * (h * (t_0 * (d_m * sqrt((1.0 / (d_m * l))))))) / h; elseif (t_1 <= 1e+291) tmp = (sqrt((d_m / l)) * t_0) * 1.0; else tmp = (d_m * sqrt((1.0 / (h * l)))) * 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[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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$1, -1e-127], N[(N[(-1.0 * N[(h * N[(t$95$0 * N[(d$95$m * N[Sqrt[N[(1.0 / N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, 1e+291], N[(N[(N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d\_m}{h}}\\
t_1 := \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\_1 \leq -1 \cdot 10^{-127}:\\
\;\;\;\;\frac{-1 \cdot \left(h \cdot \left(t\_0 \cdot \left(d\_m \cdot \sqrt{\frac{1}{d\_m \cdot \ell}}\right)\right)\right)}{h}\\
\mathbf{elif}\;t\_1 \leq 10^{+291}:\\
\;\;\;\;\left(\sqrt{\frac{d\_m}{\ell}} \cdot t\_0\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \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)))) < -1e-127Initial program 35.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f645.4
Applied rewrites5.4%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f646.7
Applied rewrites6.7%
if -1e-127 < (*.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.9999999999999996e290Initial program 35.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.9
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
Applied rewrites33.7%
Taylor expanded in d around inf
Applied rewrites20.2%
if 9.9999999999999996e290 < (*.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 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
Taylor expanded in d around inf
Applied rewrites42.9%
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 -1e-127)
(/ (- (* (sqrt (/ (* d_m d_m) (* l h))) h)) h)
(if (<= t_0 1e+291)
(* (* (sqrt (/ d_m l)) (sqrt (/ d_m h))) 1.0)
(* (* d_m (sqrt (/ 1.0 (* h l)))) 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 <= -1e-127) {
tmp = -(sqrt(((d_m * d_m) / (l * h))) * h) / h;
} else if (t_0 <= 1e+291) {
tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0;
} else {
tmp = (d_m * sqrt((1.0 / (h * l)))) * 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 <= (-1d-127)) then
tmp = -(sqrt(((d_m * d_m) / (l * h))) * h) / h
else if (t_0 <= 1d+291) then
tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0d0
else
tmp = (d_m * sqrt((1.0d0 / (h * l)))) * 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 <= -1e-127) {
tmp = -(Math.sqrt(((d_m * d_m) / (l * h))) * h) / h;
} else if (t_0 <= 1e+291) {
tmp = (Math.sqrt((d_m / l)) * Math.sqrt((d_m / h))) * 1.0;
} else {
tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * 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 <= -1e-127: tmp = -(math.sqrt(((d_m * d_m) / (l * h))) * h) / h elif t_0 <= 1e+291: tmp = (math.sqrt((d_m / l)) * math.sqrt((d_m / h))) * 1.0 else: tmp = (d_m * math.sqrt((1.0 / (h * l)))) * 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 <= -1e-127) tmp = Float64(Float64(-Float64(sqrt(Float64(Float64(d_m * d_m) / Float64(l * h))) * h)) / h); elseif (t_0 <= 1e+291) tmp = Float64(Float64(sqrt(Float64(d_m / l)) * sqrt(Float64(d_m / h))) * 1.0); else tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * 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 <= -1e-127) tmp = -(sqrt(((d_m * d_m) / (l * h))) * h) / h; elseif (t_0 <= 1e+291) tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0; else tmp = (d_m * sqrt((1.0 / (h * l)))) * 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, -1e-127], N[((-N[(N[Sqrt[N[(N[(d$95$m * d$95$m), $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * h), $MachinePrecision]) / h), $MachinePrecision], If[LessEqual[t$95$0, 1e+291], N[(N[(N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $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 -1 \cdot 10^{-127}:\\
\;\;\;\;\frac{-\sqrt{\frac{d\_m \cdot d\_m}{\ell \cdot h}} \cdot h}{h}\\
\mathbf{elif}\;t\_0 \leq 10^{+291}:\\
\;\;\;\;\left(\sqrt{\frac{d\_m}{\ell}} \cdot \sqrt{\frac{d\_m}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \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)))) < -1e-127Initial program 35.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f645.4
Applied rewrites5.4%
Applied rewrites12.2%
if -1e-127 < (*.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.9999999999999996e290Initial program 35.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.9
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
Applied rewrites33.7%
Taylor expanded in d around inf
Applied rewrites20.2%
if 9.9999999999999996e290 < (*.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 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
Taylor expanded in d around inf
Applied rewrites42.9%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (* d_m (sqrt (/ 1.0 (* h l)))))
(t_1
(*
(* (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_1 -1e-127)
(* -1.0 t_0)
(if (<= t_1 1e+291)
(* (* (sqrt (/ d_m l)) (sqrt (/ d_m h))) 1.0)
(* t_0 1.0)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = d_m * sqrt((1.0 / (h * l)));
double t_1 = (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_1 <= -1e-127) {
tmp = -1.0 * t_0;
} else if (t_1 <= 1e+291) {
tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0;
} else {
tmp = t_0 * 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) :: t_1
real(8) :: tmp
t_0 = d_m * sqrt((1.0d0 / (h * l)))
t_1 = (((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_1 <= (-1d-127)) then
tmp = (-1.0d0) * t_0
else if (t_1 <= 1d+291) then
tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0d0
else
tmp = t_0 * 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 = d_m * Math.sqrt((1.0 / (h * l)));
double t_1 = (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_1 <= -1e-127) {
tmp = -1.0 * t_0;
} else if (t_1 <= 1e+291) {
tmp = (Math.sqrt((d_m / l)) * Math.sqrt((d_m / h))) * 1.0;
} else {
tmp = t_0 * 1.0;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = d_m * math.sqrt((1.0 / (h * l))) t_1 = (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_1 <= -1e-127: tmp = -1.0 * t_0 elif t_1 <= 1e+291: tmp = (math.sqrt((d_m / l)) * math.sqrt((d_m / h))) * 1.0 else: tmp = t_0 * 1.0 return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) t_1 = 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_1 <= -1e-127) tmp = Float64(-1.0 * t_0); elseif (t_1 <= 1e+291) tmp = Float64(Float64(sqrt(Float64(d_m / l)) * sqrt(Float64(d_m / h))) * 1.0); else tmp = Float64(t_0 * 1.0); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = d_m * sqrt((1.0 / (h * l))); t_1 = (((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_1 <= -1e-127) tmp = -1.0 * t_0; elseif (t_1 <= 1e+291) tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * 1.0; else tmp = t_0 * 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[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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$1, -1e-127], N[(-1.0 * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 1e+291], N[(N[(N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(t$95$0 * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
t_1 := \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\_1 \leq -1 \cdot 10^{-127}:\\
\;\;\;\;-1 \cdot t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{+291}:\\
\;\;\;\;\left(\sqrt{\frac{d\_m}{\ell}} \cdot \sqrt{\frac{d\_m}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_0 \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)))) < -1e-127Initial program 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6410.2
Applied rewrites10.2%
if -1e-127 < (*.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.9999999999999996e290Initial program 35.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6435.9
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6433.7
Applied rewrites33.7%
Taylor expanded in d around inf
Applied rewrites20.2%
if 9.9999999999999996e290 < (*.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 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
Taylor expanded in d around inf
Applied rewrites42.9%
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
:precision binary64
(let* ((t_0 (* d_m (sqrt (/ 1.0 (* h l)))))
(t_1
(*
(* (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_1 0.0)
(* -1.0 t_0)
(if (<= t_1 1e+291) (/ (* d_m (/ (sqrt h) (sqrt l))) h) (* t_0 1.0)))))d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double t_0 = d_m * sqrt((1.0 / (h * l)));
double t_1 = (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_1 <= 0.0) {
tmp = -1.0 * t_0;
} else if (t_1 <= 1e+291) {
tmp = (d_m * (sqrt(h) / sqrt(l))) / h;
} else {
tmp = t_0 * 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) :: t_1
real(8) :: tmp
t_0 = d_m * sqrt((1.0d0 / (h * l)))
t_1 = (((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_1 <= 0.0d0) then
tmp = (-1.0d0) * t_0
else if (t_1 <= 1d+291) then
tmp = (d_m * (sqrt(h) / sqrt(l))) / h
else
tmp = t_0 * 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 = d_m * Math.sqrt((1.0 / (h * l)));
double t_1 = (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_1 <= 0.0) {
tmp = -1.0 * t_0;
} else if (t_1 <= 1e+291) {
tmp = (d_m * (Math.sqrt(h) / Math.sqrt(l))) / h;
} else {
tmp = t_0 * 1.0;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): t_0 = d_m * math.sqrt((1.0 / (h * l))) t_1 = (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_1 <= 0.0: tmp = -1.0 * t_0 elif t_1 <= 1e+291: tmp = (d_m * (math.sqrt(h) / math.sqrt(l))) / h else: tmp = t_0 * 1.0 return tmp
d_m = abs(d) function code(d_m, h, l, M, D) t_0 = Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) t_1 = 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_1 <= 0.0) tmp = Float64(-1.0 * t_0); elseif (t_1 <= 1e+291) tmp = Float64(Float64(d_m * Float64(sqrt(h) / sqrt(l))) / h); else tmp = Float64(t_0 * 1.0); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) t_0 = d_m * sqrt((1.0 / (h * l))); t_1 = (((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_1 <= 0.0) tmp = -1.0 * t_0; elseif (t_1 <= 1e+291) tmp = (d_m * (sqrt(h) / sqrt(l))) / h; else tmp = t_0 * 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[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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$1, 0.0], N[(-1.0 * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 1e+291], N[(N[(d$95$m * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$0 * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
t_0 := d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
t_1 := \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\_1 \leq 0:\\
\;\;\;\;-1 \cdot t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{+291}:\\
\;\;\;\;\frac{d\_m \cdot \frac{\sqrt{h}}{\sqrt{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \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)))) < -0.0Initial program 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6410.2
Applied rewrites10.2%
if -0.0 < (*.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.9999999999999996e290Initial program 35.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6422.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6422.0
Applied rewrites22.0%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6425.1
Applied rewrites25.1%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6422.4
Applied rewrites22.4%
if 9.9999999999999996e290 < (*.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 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6469.7
Applied rewrites69.7%
Taylor expanded in d around inf
Applied rewrites42.9%
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 0.0)
(* -1.0 (* d_m (sqrt (/ 1.0 (* h l)))))
(if (<= t_0 INFINITY)
(/ (* d_m (/ (sqrt h) (sqrt l))) h)
(/ (* d_m (sqrt (/ h l))) h)))))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 <= 0.0) {
tmp = -1.0 * (d_m * sqrt((1.0 / (h * l))));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (d_m * (sqrt(h) / sqrt(l))) / h;
} else {
tmp = (d_m * sqrt((h / l))) / h;
}
return tmp;
}
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 <= 0.0) {
tmp = -1.0 * (d_m * Math.sqrt((1.0 / (h * l))));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (d_m * (Math.sqrt(h) / Math.sqrt(l))) / h;
} else {
tmp = (d_m * Math.sqrt((h / l))) / h;
}
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 <= 0.0: tmp = -1.0 * (d_m * math.sqrt((1.0 / (h * l)))) elif t_0 <= math.inf: tmp = (d_m * (math.sqrt(h) / math.sqrt(l))) / h else: tmp = (d_m * math.sqrt((h / l))) / h 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 <= 0.0) tmp = Float64(-1.0 * Float64(d_m * sqrt(Float64(1.0 / Float64(h * l))))); elseif (t_0 <= Inf) tmp = Float64(Float64(d_m * Float64(sqrt(h) / sqrt(l))) / h); else tmp = Float64(Float64(d_m * sqrt(Float64(h / l))) / h); 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 <= 0.0) tmp = -1.0 * (d_m * sqrt((1.0 / (h * l)))); elseif (t_0 <= Inf) tmp = (d_m * (sqrt(h) / sqrt(l))) / h; else tmp = (d_m * sqrt((h / l))) / h; 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, 0.0], N[(-1.0 * N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(d$95$m * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $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 0:\\
\;\;\;\;-1 \cdot \left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{d\_m \cdot \frac{\sqrt{h}}{\sqrt{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\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)))) < -0.0Initial program 35.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6437.9
Applied rewrites37.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6456.2
Applied rewrites56.2%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6410.2
Applied rewrites10.2%
if -0.0 < (*.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)))) < +inf.0Initial program 35.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6422.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6422.0
Applied rewrites22.0%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6425.1
Applied rewrites25.1%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6422.4
Applied rewrites22.4%
if +inf.0 < (*.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 35.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6422.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6422.0
Applied rewrites22.0%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6425.1
Applied rewrites25.1%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (if (<= h -5e-305) (/ (* d_m (sqrt (/ h l))) h) (/ (* d_m (/ (sqrt h) (sqrt l))) h)))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
double tmp;
if (h <= -5e-305) {
tmp = (d_m * sqrt((h / l))) / h;
} else {
tmp = (d_m * (sqrt(h) / sqrt(l))) / h;
}
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 (h <= (-5d-305)) then
tmp = (d_m * sqrt((h / l))) / h
else
tmp = (d_m * (sqrt(h) / sqrt(l))) / h
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 (h <= -5e-305) {
tmp = (d_m * Math.sqrt((h / l))) / h;
} else {
tmp = (d_m * (Math.sqrt(h) / Math.sqrt(l))) / h;
}
return tmp;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): tmp = 0 if h <= -5e-305: tmp = (d_m * math.sqrt((h / l))) / h else: tmp = (d_m * (math.sqrt(h) / math.sqrt(l))) / h return tmp
d_m = abs(d) function code(d_m, h, l, M, D) tmp = 0.0 if (h <= -5e-305) tmp = Float64(Float64(d_m * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(d_m * Float64(sqrt(h) / sqrt(l))) / h); end return tmp end
d_m = abs(d); function tmp_2 = code(d_m, h, l, M, D) tmp = 0.0; if (h <= -5e-305) tmp = (d_m * sqrt((h / l))) / h; else tmp = (d_m * (sqrt(h) / sqrt(l))) / h; end tmp_2 = tmp; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[h, -5e-305], N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d$95$m * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-305}:\\
\;\;\;\;\frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m \cdot \frac{\sqrt{h}}{\sqrt{\ell}}}{h}\\
\end{array}
\end{array}
if h < -4.99999999999999985e-305Initial program 35.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6422.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6422.0
Applied rewrites22.0%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6425.1
Applied rewrites25.1%
if -4.99999999999999985e-305 < h Initial program 35.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6422.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6422.0
Applied rewrites22.0%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6425.1
Applied rewrites25.1%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6422.4
Applied rewrites22.4%
d_m = (fabs.f64 d) (FPCore (d_m h l M D) :precision binary64 (/ (* d_m (sqrt (/ h l))) h))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
return (d_m * sqrt((h / l))) / h;
}
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 = (d_m * sqrt((h / l))) / h
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
return (d_m * Math.sqrt((h / l))) / h;
}
d_m = math.fabs(d) def code(d_m, h, l, M, D): return (d_m * math.sqrt((h / l))) / h
d_m = abs(d) function code(d_m, h, l, M, D) return Float64(Float64(d_m * sqrt(Float64(h / l))) / h) end
d_m = abs(d); function tmp = code(d_m, h, l, M, D) tmp = (d_m * sqrt((h / l))) / h; end
d_m = N[Abs[d], $MachinePrecision] code[d$95$m_, h_, l_, M_, D_] := N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
\frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}
\end{array}
Initial program 35.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6418.9
Applied rewrites18.9%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6422.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6422.0
Applied rewrites22.0%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6425.1
Applied rewrites25.1%
herbie shell --seed 2025151
(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)))))