
(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 18 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)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* (/ 1.0 h) l))))
(if (<= h -1e+225)
(fma
(/ (* (* M_m M_m) (* D_m D_m)) (* (* l d_m) t_0))
0.125
(/ (- d_m) (* t_0 h)))
(if (<= h 2.7e-298)
(*
(* (sqrt (/ 1.0 (* l h))) d_m)
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0)) (/ h l))))
(fma
(* (* (* (/ M_m (* l d_m)) (/ M_m t_0)) -0.125) D_m)
D_m
(/ d_m (* (sqrt l) (sqrt h))))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(((1.0 / h) * l));
double tmp;
if (h <= -1e+225) {
tmp = fma((((M_m * M_m) * (D_m * D_m)) / ((l * d_m) * t_0)), 0.125, (-d_m / (t_0 * h)));
} else if (h <= 2.7e-298) {
tmp = (sqrt((1.0 / (l * h))) * d_m) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)));
} else {
tmp = fma(((((M_m / (l * d_m)) * (M_m / t_0)) * -0.125) * D_m), D_m, (d_m / (sqrt(l) * sqrt(h))));
}
return tmp;
}
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) t_0 = sqrt(Float64(Float64(1.0 / h) * l)) tmp = 0.0 if (h <= -1e+225) tmp = fma(Float64(Float64(Float64(M_m * M_m) * Float64(D_m * D_m)) / Float64(Float64(l * d_m) * t_0)), 0.125, Float64(Float64(-d_m) / Float64(t_0 * h))); elseif (h <= 2.7e-298) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))); else tmp = fma(Float64(Float64(Float64(Float64(M_m / Float64(l * d_m)) * Float64(M_m / t_0)) * -0.125) * D_m), D_m, Float64(d_m / Float64(sqrt(l) * sqrt(h)))); end return tmp end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1e+225], N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.125 + N[((-d$95$m) / N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.7e-298], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(M$95$m / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / t$95$0), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m + N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h} \cdot \ell}\\
\mathbf{if}\;h \leq -1 \cdot 10^{+225}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(M\_m \cdot M\_m\right) \cdot \left(D\_m \cdot D\_m\right)}{\left(\ell \cdot d\_m\right) \cdot t\_0}, 0.125, \frac{-d\_m}{t\_0 \cdot h}\right)\\
\mathbf{elif}\;h \leq 2.7 \cdot 10^{-298}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\frac{M\_m}{\ell \cdot d\_m} \cdot \frac{M\_m}{t\_0}\right) \cdot -0.125\right) \cdot D\_m, D\_m, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\right)\\
\end{array}
\end{array}
if h < -9.99999999999999928e224Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites27.1%
if -9.99999999999999928e224 < h < 2.7000000000000001e-298Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
Taylor expanded in d around 0
times-fracN/A
lift-/.f64N/A
sqrt-unprodN/A
frac-2negN/A
sqrt-undivN/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.3%
if 2.7000000000000001e-298 < h Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around inf
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6437.6
Applied rewrites37.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6441.1
Applied rewrites41.1%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* (/ 1.0 h) l))))
(if (<= h -1e+225)
(fma
(/ (* (* M_m M_m) (* D_m D_m)) (* (* l d_m) t_0))
0.125
(/ (- d_m) (* t_0 h)))
(if (<= h 2.7e-298)
(*
(/ (fabs d_m) (sqrt (* l h)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0)) (/ h l))))
(fma
(* (* (* (/ M_m (* l d_m)) (/ M_m t_0)) -0.125) D_m)
D_m
(/ d_m (* (sqrt l) (sqrt h))))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(((1.0 / h) * l));
double tmp;
if (h <= -1e+225) {
tmp = fma((((M_m * M_m) * (D_m * D_m)) / ((l * d_m) * t_0)), 0.125, (-d_m / (t_0 * h)));
} else if (h <= 2.7e-298) {
tmp = (fabs(d_m) / sqrt((l * h))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)));
} else {
tmp = fma(((((M_m / (l * d_m)) * (M_m / t_0)) * -0.125) * D_m), D_m, (d_m / (sqrt(l) * sqrt(h))));
}
return tmp;
}
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) t_0 = sqrt(Float64(Float64(1.0 / h) * l)) tmp = 0.0 if (h <= -1e+225) tmp = fma(Float64(Float64(Float64(M_m * M_m) * Float64(D_m * D_m)) / Float64(Float64(l * d_m) * t_0)), 0.125, Float64(Float64(-d_m) / Float64(t_0 * h))); elseif (h <= 2.7e-298) tmp = Float64(Float64(abs(d_m) / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))); else tmp = fma(Float64(Float64(Float64(Float64(M_m / Float64(l * d_m)) * Float64(M_m / t_0)) * -0.125) * D_m), D_m, Float64(d_m / Float64(sqrt(l) * sqrt(h)))); end return tmp end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1e+225], N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.125 + N[((-d$95$m) / N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.7e-298], N[(N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(M$95$m / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / t$95$0), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m + N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h} \cdot \ell}\\
\mathbf{if}\;h \leq -1 \cdot 10^{+225}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(M\_m \cdot M\_m\right) \cdot \left(D\_m \cdot D\_m\right)}{\left(\ell \cdot d\_m\right) \cdot t\_0}, 0.125, \frac{-d\_m}{t\_0 \cdot h}\right)\\
\mathbf{elif}\;h \leq 2.7 \cdot 10^{-298}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\frac{M\_m}{\ell \cdot d\_m} \cdot \frac{M\_m}{t\_0}\right) \cdot -0.125\right) \cdot D\_m, D\_m, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\right)\\
\end{array}
\end{array}
if h < -9.99999999999999928e224Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites27.1%
if -9.99999999999999928e224 < h < 2.7000000000000001e-298Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
sqrt-unprodN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.6
Applied rewrites69.6%
if 2.7000000000000001e-298 < h Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around inf
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6437.6
Applied rewrites37.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6441.1
Applied rewrites41.1%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* (/ 1.0 h) l))) (t_1 (* M_m (/ D_m (+ d_m d_m)))))
(if (<= h -1e+225)
(fma
(/ (* (* M_m M_m) (* D_m D_m)) (* (* l d_m) t_0))
0.125
(/ (- d_m) (* t_0 h)))
(if (<= h 2.7e-298)
(*
(/ (fabs d_m) (sqrt (* l h)))
(- 1.0 (* (* (/ 1.0 2.0) (* t_1 t_1)) (/ h l))))
(fma
(* (* (* (/ M_m (* l d_m)) (/ M_m t_0)) -0.125) D_m)
D_m
(/ d_m (* (sqrt l) (sqrt h))))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(((1.0 / h) * l));
double t_1 = M_m * (D_m / (d_m + d_m));
double tmp;
if (h <= -1e+225) {
tmp = fma((((M_m * M_m) * (D_m * D_m)) / ((l * d_m) * t_0)), 0.125, (-d_m / (t_0 * h)));
} else if (h <= 2.7e-298) {
tmp = (fabs(d_m) / sqrt((l * h))) * (1.0 - (((1.0 / 2.0) * (t_1 * t_1)) * (h / l)));
} else {
tmp = fma(((((M_m / (l * d_m)) * (M_m / t_0)) * -0.125) * D_m), D_m, (d_m / (sqrt(l) * sqrt(h))));
}
return tmp;
}
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) t_0 = sqrt(Float64(Float64(1.0 / h) * l)) t_1 = Float64(M_m * Float64(D_m / Float64(d_m + d_m))) tmp = 0.0 if (h <= -1e+225) tmp = fma(Float64(Float64(Float64(M_m * M_m) * Float64(D_m * D_m)) / Float64(Float64(l * d_m) * t_0)), 0.125, Float64(Float64(-d_m) / Float64(t_0 * h))); elseif (h <= 2.7e-298) tmp = Float64(Float64(abs(d_m) / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * Float64(t_1 * t_1)) * Float64(h / l)))); else tmp = fma(Float64(Float64(Float64(Float64(M_m / Float64(l * d_m)) * Float64(M_m / t_0)) * -0.125) * D_m), D_m, Float64(d_m / Float64(sqrt(l) * sqrt(h)))); end return tmp end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(M$95$m * N[(D$95$m / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1e+225], N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.125 + N[((-d$95$m) / N[(t$95$0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.7e-298], N[(N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(M$95$m / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / t$95$0), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m + N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h} \cdot \ell}\\
t_1 := M\_m \cdot \frac{D\_m}{d\_m + d\_m}\\
\mathbf{if}\;h \leq -1 \cdot 10^{+225}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(M\_m \cdot M\_m\right) \cdot \left(D\_m \cdot D\_m\right)}{\left(\ell \cdot d\_m\right) \cdot t\_0}, 0.125, \frac{-d\_m}{t\_0 \cdot h}\right)\\
\mathbf{elif}\;h \leq 2.7 \cdot 10^{-298}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{1}{2} \cdot \left(t\_1 \cdot t\_1\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\frac{M\_m}{\ell \cdot d\_m} \cdot \frac{M\_m}{t\_0}\right) \cdot -0.125\right) \cdot D\_m, D\_m, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\right)\\
\end{array}
\end{array}
if h < -9.99999999999999928e224Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites27.1%
if -9.99999999999999928e224 < h < 2.7000000000000001e-298Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
sqrt-unprodN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.6
Applied rewrites69.6%
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
count-2-revN/A
lower-+.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
count-2-revN/A
lower-+.f6468.9
Applied rewrites68.9%
if 2.7000000000000001e-298 < h Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around inf
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6437.6
Applied rewrites37.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6441.1
Applied rewrites41.1%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= h -5e-168)
(/
(fma
(/ (* (* (* (* M_m M_m) h) D_m) D_m) (* t_0 d_m))
-0.125
(/ (* l d_m) t_0))
l)
(if (<= h -2e-226)
(*
(/ (fabs d_m) t_0)
(fma
(* (/ (* (* M_m M_m) (* D_m D_m)) (* (* d_m d_m) l)) -0.125)
h
1.0))
(if (<= h -2e-302)
(* (* (sqrt (/ 1.0 (* l h))) d_m) 1.0)
(fma
(*
(* (* (/ M_m (* l d_m)) (/ M_m (sqrt (* (/ 1.0 h) l)))) -0.125)
D_m)
D_m
(/ d_m (* (sqrt l) (sqrt h)))))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (h <= -5e-168) {
tmp = fma((((((M_m * M_m) * h) * D_m) * D_m) / (t_0 * d_m)), -0.125, ((l * d_m) / t_0)) / l;
} else if (h <= -2e-226) {
tmp = (fabs(d_m) / t_0) * fma(((((M_m * M_m) * (D_m * D_m)) / ((d_m * d_m) * l)) * -0.125), h, 1.0);
} else if (h <= -2e-302) {
tmp = (sqrt((1.0 / (l * h))) * d_m) * 1.0;
} else {
tmp = fma(((((M_m / (l * d_m)) * (M_m / sqrt(((1.0 / h) * l)))) * -0.125) * D_m), D_m, (d_m / (sqrt(l) * sqrt(h))));
}
return tmp;
}
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (h <= -5e-168) tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * D_m) / Float64(t_0 * d_m)), -0.125, Float64(Float64(l * d_m) / t_0)) / l); elseif (h <= -2e-226) tmp = Float64(Float64(abs(d_m) / t_0) * fma(Float64(Float64(Float64(Float64(M_m * M_m) * Float64(D_m * D_m)) / Float64(Float64(d_m * d_m) * l)) * -0.125), h, 1.0)); elseif (h <= -2e-302) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * 1.0); else tmp = fma(Float64(Float64(Float64(Float64(M_m / Float64(l * d_m)) * Float64(M_m / sqrt(Float64(Float64(1.0 / h) * l)))) * -0.125) * D_m), D_m, Float64(d_m / Float64(sqrt(l) * sqrt(h)))); end return tmp end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -5e-168], N[(N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / N[(t$95$0 * d$95$m), $MachinePrecision]), $MachinePrecision] * -0.125 + N[(N[(l * d$95$m), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[h, -2e-226], N[(N[(N[Abs[d$95$m], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-302], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(N[(N[(M$95$m / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m + N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-168}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{t\_0 \cdot d\_m}, -0.125, \frac{\ell \cdot d\_m}{t\_0}\right)}{\ell}\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-226}:\\
\;\;\;\;\frac{\left|d\_m\right|}{t\_0} \cdot \mathsf{fma}\left(\frac{\left(M\_m \cdot M\_m\right) \cdot \left(D\_m \cdot D\_m\right)}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot -0.125, h, 1\right)\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-302}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\frac{M\_m}{\ell \cdot d\_m} \cdot \frac{M\_m}{\sqrt{\frac{1}{h} \cdot \ell}}\right) \cdot -0.125\right) \cdot D\_m, D\_m, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\right)\\
\end{array}
\end{array}
if h < -5.00000000000000001e-168Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in l around 0
Applied rewrites55.2%
if -5.00000000000000001e-168 < h < -1.99999999999999984e-226Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
sqrt-unprodN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.6
Applied rewrites69.6%
Taylor expanded in h around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-rgt-inN/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites49.1%
if -1.99999999999999984e-226 < h < -1.9999999999999999e-302Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
Taylor expanded in d around 0
times-fracN/A
lift-/.f64N/A
sqrt-unprodN/A
frac-2negN/A
sqrt-undivN/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.3%
Taylor expanded in d around inf
Applied rewrites42.7%
if -1.9999999999999999e-302 < h Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around inf
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6437.6
Applied rewrites37.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6441.1
Applied rewrites41.1%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= l -1e+85)
(* (* (sqrt (/ 1.0 (* l h))) d_m) 1.0)
(if (<= l -5e-122)
(/
(fma
(/ (* (* (* M_m M_m) h) (* D_m D_m)) (* t_0 d_m))
-0.125
(/ (* l d_m) t_0))
l)
(if (<= l 9.5e-308)
(*
(/ (fabs d_m) t_0)
(fma
(* (/ (* (* M_m M_m) (* D_m D_m)) (* (* d_m d_m) l)) -0.125)
h
1.0))
(fma
(*
(* (* (/ M_m (* l d_m)) (/ M_m (sqrt (* (/ 1.0 h) l)))) -0.125)
D_m)
D_m
(/ d_m (* (sqrt l) (sqrt h)))))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (l <= -1e+85) {
tmp = (sqrt((1.0 / (l * h))) * d_m) * 1.0;
} else if (l <= -5e-122) {
tmp = fma(((((M_m * M_m) * h) * (D_m * D_m)) / (t_0 * d_m)), -0.125, ((l * d_m) / t_0)) / l;
} else if (l <= 9.5e-308) {
tmp = (fabs(d_m) / t_0) * fma(((((M_m * M_m) * (D_m * D_m)) / ((d_m * d_m) * l)) * -0.125), h, 1.0);
} else {
tmp = fma(((((M_m / (l * d_m)) * (M_m / sqrt(((1.0 / h) * l)))) * -0.125) * D_m), D_m, (d_m / (sqrt(l) * sqrt(h))));
}
return tmp;
}
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= -1e+85) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * 1.0); elseif (l <= -5e-122) tmp = Float64(fma(Float64(Float64(Float64(Float64(M_m * M_m) * h) * Float64(D_m * D_m)) / Float64(t_0 * d_m)), -0.125, Float64(Float64(l * d_m) / t_0)) / l); elseif (l <= 9.5e-308) tmp = Float64(Float64(abs(d_m) / t_0) * fma(Float64(Float64(Float64(Float64(M_m * M_m) * Float64(D_m * D_m)) / Float64(Float64(d_m * d_m) * l)) * -0.125), h, 1.0)); else tmp = fma(Float64(Float64(Float64(Float64(M_m / Float64(l * d_m)) * Float64(M_m / sqrt(Float64(Float64(1.0 / h) * l)))) * -0.125) * D_m), D_m, Float64(d_m / Float64(sqrt(l) * sqrt(h)))); end return tmp end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e+85], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[l, -5e-122], N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * d$95$m), $MachinePrecision]), $MachinePrecision] * -0.125 + N[(N[(l * d$95$m), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[l, 9.5e-308], N[(N[(N[Abs[d$95$m], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(M$95$m / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m + N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+85}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot 1\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-122}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot \left(D\_m \cdot D\_m\right)}{t\_0 \cdot d\_m}, -0.125, \frac{\ell \cdot d\_m}{t\_0}\right)}{\ell}\\
\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{-308}:\\
\;\;\;\;\frac{\left|d\_m\right|}{t\_0} \cdot \mathsf{fma}\left(\frac{\left(M\_m \cdot M\_m\right) \cdot \left(D\_m \cdot D\_m\right)}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot -0.125, h, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\frac{M\_m}{\ell \cdot d\_m} \cdot \frac{M\_m}{\sqrt{\frac{1}{h} \cdot \ell}}\right) \cdot -0.125\right) \cdot D\_m, D\_m, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -1e85Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
Taylor expanded in d around 0
times-fracN/A
lift-/.f64N/A
sqrt-unprodN/A
frac-2negN/A
sqrt-undivN/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.3%
Taylor expanded in d around inf
Applied rewrites42.7%
if -1e85 < l < -4.9999999999999999e-122Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites49.0%
if -4.9999999999999999e-122 < l < 9.49999999999999963e-308Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
sqrt-unprodN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.6
Applied rewrites69.6%
Taylor expanded in h around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-rgt-inN/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites49.1%
if 9.49999999999999963e-308 < l Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around inf
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6437.6
Applied rewrites37.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6441.1
Applied rewrites41.1%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(if (<= l -1e-21)
(* (* (sqrt (/ 1.0 (* l h))) d_m) 1.0)
(if (<= l 9.5e-308)
(*
(/ (fabs d_m) (sqrt (* l h)))
(fma (* (/ (* (* M_m M_m) (* D_m D_m)) (* (* d_m d_m) l)) -0.125) h 1.0))
(fma
(* (* (* (/ M_m (* l d_m)) (/ M_m (sqrt (* (/ 1.0 h) l)))) -0.125) D_m)
D_m
(/ d_m (* (sqrt l) (sqrt h)))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1e-21) {
tmp = (sqrt((1.0 / (l * h))) * d_m) * 1.0;
} else if (l <= 9.5e-308) {
tmp = (fabs(d_m) / sqrt((l * h))) * fma(((((M_m * M_m) * (D_m * D_m)) / ((d_m * d_m) * l)) * -0.125), h, 1.0);
} else {
tmp = fma(((((M_m / (l * d_m)) * (M_m / sqrt(((1.0 / h) * l)))) * -0.125) * D_m), D_m, (d_m / (sqrt(l) * sqrt(h))));
}
return tmp;
}
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) tmp = 0.0 if (l <= -1e-21) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * 1.0); elseif (l <= 9.5e-308) tmp = Float64(Float64(abs(d_m) / sqrt(Float64(l * h))) * fma(Float64(Float64(Float64(Float64(M_m * M_m) * Float64(D_m * D_m)) / Float64(Float64(d_m * d_m) * l)) * -0.125), h, 1.0)); else tmp = fma(Float64(Float64(Float64(Float64(M_m / Float64(l * d_m)) * Float64(M_m / sqrt(Float64(Float64(1.0 / h) * l)))) * -0.125) * D_m), D_m, Float64(d_m / Float64(sqrt(l) * sqrt(h)))); end return tmp end
d_m = N[Abs[d], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1e-21], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[l, 9.5e-308], N[(N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(M$95$m / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m + N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot 1\\
\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{-308}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{\left(M\_m \cdot M\_m\right) \cdot \left(D\_m \cdot D\_m\right)}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot -0.125, h, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\frac{M\_m}{\ell \cdot d\_m} \cdot \frac{M\_m}{\sqrt{\frac{1}{h} \cdot \ell}}\right) \cdot -0.125\right) \cdot D\_m, D\_m, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -9.99999999999999908e-22Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
Taylor expanded in d around 0
times-fracN/A
lift-/.f64N/A
sqrt-unprodN/A
frac-2negN/A
sqrt-undivN/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.3%
Taylor expanded in d around inf
Applied rewrites42.7%
if -9.99999999999999908e-22 < l < 9.49999999999999963e-308Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
sqrt-unprodN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.6
Applied rewrites69.6%
Taylor expanded in h around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-rgt-inN/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites49.1%
if 9.49999999999999963e-308 < l Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around inf
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6437.6
Applied rewrites37.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6441.1
Applied rewrites41.1%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(if (<= l -1e-21)
(* (* (sqrt (/ 1.0 (* l h))) d_m) 1.0)
(if (<= l 1.06e-259)
(*
(/ (fabs d_m) (sqrt (* l h)))
(fma (* (/ (* (* M_m M_m) (* D_m D_m)) (* (* d_m d_m) l)) -0.125) h 1.0))
(fma
(* (* (* M_m (/ M_m (* (* (sqrt (* (/ 1.0 h) l)) l) d_m))) -0.125) D_m)
D_m
(/ d_m (* (sqrt l) (sqrt h)))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1e-21) {
tmp = (sqrt((1.0 / (l * h))) * d_m) * 1.0;
} else if (l <= 1.06e-259) {
tmp = (fabs(d_m) / sqrt((l * h))) * fma(((((M_m * M_m) * (D_m * D_m)) / ((d_m * d_m) * l)) * -0.125), h, 1.0);
} else {
tmp = fma((((M_m * (M_m / ((sqrt(((1.0 / h) * l)) * l) * d_m))) * -0.125) * D_m), D_m, (d_m / (sqrt(l) * sqrt(h))));
}
return tmp;
}
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) tmp = 0.0 if (l <= -1e-21) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * 1.0); elseif (l <= 1.06e-259) tmp = Float64(Float64(abs(d_m) / sqrt(Float64(l * h))) * fma(Float64(Float64(Float64(Float64(M_m * M_m) * Float64(D_m * D_m)) / Float64(Float64(d_m * d_m) * l)) * -0.125), h, 1.0)); else tmp = fma(Float64(Float64(Float64(M_m * Float64(M_m / Float64(Float64(sqrt(Float64(Float64(1.0 / h) * l)) * l) * d_m))) * -0.125) * D_m), D_m, Float64(d_m / Float64(sqrt(l) * sqrt(h)))); end return tmp end
d_m = N[Abs[d], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1e-21], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[l, 1.06e-259], N[(N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(M$95$m * N[(M$95$m / N[(N[(N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] * l), $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision] * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m + N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot 1\\
\mathbf{elif}\;\ell \leq 1.06 \cdot 10^{-259}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{\left(M\_m \cdot M\_m\right) \cdot \left(D\_m \cdot D\_m\right)}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot -0.125, h, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(M\_m \cdot \frac{M\_m}{\left(\sqrt{\frac{1}{h} \cdot \ell} \cdot \ell\right) \cdot d\_m}\right) \cdot -0.125\right) \cdot D\_m, D\_m, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -9.99999999999999908e-22Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
Taylor expanded in d around 0
times-fracN/A
lift-/.f64N/A
sqrt-unprodN/A
frac-2negN/A
sqrt-undivN/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.3%
Taylor expanded in d around inf
Applied rewrites42.7%
if -9.99999999999999908e-22 < l < 1.06e-259Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
sqrt-unprodN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.6
Applied rewrites69.6%
Taylor expanded in h around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-rgt-inN/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites49.1%
if 1.06e-259 < l Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around inf
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6437.6
Applied rewrites37.6%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites39.1%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(if (<= l -1e-21)
(* (* (sqrt (/ 1.0 (* l h))) d_m) 1.0)
(if (<= l 1.62e-257)
(*
(/ (fabs d_m) (sqrt (* l h)))
(fma (* (/ (* (* M_m M_m) (* D_m D_m)) (* (* d_m d_m) l)) -0.125) h 1.0))
(fma
(* (* (/ (* M_m M_m) (* (* l d_m) (sqrt (/ l h)))) -0.125) D_m)
D_m
(/ d_m (* (sqrt l) (sqrt h)))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1e-21) {
tmp = (sqrt((1.0 / (l * h))) * d_m) * 1.0;
} else if (l <= 1.62e-257) {
tmp = (fabs(d_m) / sqrt((l * h))) * fma(((((M_m * M_m) * (D_m * D_m)) / ((d_m * d_m) * l)) * -0.125), h, 1.0);
} else {
tmp = fma(((((M_m * M_m) / ((l * d_m) * sqrt((l / h)))) * -0.125) * D_m), D_m, (d_m / (sqrt(l) * sqrt(h))));
}
return tmp;
}
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) tmp = 0.0 if (l <= -1e-21) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * 1.0); elseif (l <= 1.62e-257) tmp = Float64(Float64(abs(d_m) / sqrt(Float64(l * h))) * fma(Float64(Float64(Float64(Float64(M_m * M_m) * Float64(D_m * D_m)) / Float64(Float64(d_m * d_m) * l)) * -0.125), h, 1.0)); else tmp = fma(Float64(Float64(Float64(Float64(M_m * M_m) / Float64(Float64(l * d_m) * sqrt(Float64(l / h)))) * -0.125) * D_m), D_m, Float64(d_m / Float64(sqrt(l) * sqrt(h)))); end return tmp end
d_m = N[Abs[d], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1e-21], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[l, 1.62e-257], N[(N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m + N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot 1\\
\mathbf{elif}\;\ell \leq 1.62 \cdot 10^{-257}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{\left(M\_m \cdot M\_m\right) \cdot \left(D\_m \cdot D\_m\right)}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot -0.125, h, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{M\_m \cdot M\_m}{\left(\ell \cdot d\_m\right) \cdot \sqrt{\frac{\ell}{h}}} \cdot -0.125\right) \cdot D\_m, D\_m, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -9.99999999999999908e-22Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
Taylor expanded in d around 0
times-fracN/A
lift-/.f64N/A
sqrt-unprodN/A
frac-2negN/A
sqrt-undivN/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.3%
Taylor expanded in d around inf
Applied rewrites42.7%
if -9.99999999999999908e-22 < l < 1.6200000000000001e-257Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
sqrt-unprodN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.6
Applied rewrites69.6%
Taylor expanded in h around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-rgt-inN/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites49.1%
if 1.6200000000000001e-257 < l Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around inf
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6437.6
Applied rewrites37.6%
Taylor expanded in h around 0
lower-/.f6437.6
Applied rewrites37.6%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(if (<= l -1e-21)
(* (* (sqrt (/ 1.0 (* l h))) d_m) 1.0)
(if (<= l 1.62e-257)
(*
(/ (fabs d_m) (sqrt (* l h)))
(fma (* (* (* M_m M_m) (/ h (* (* d_m d_m) l))) -0.125) (* D_m D_m) 1.0))
(fma
(* (* (/ (* M_m M_m) (* (* l d_m) (sqrt (/ l h)))) -0.125) D_m)
D_m
(/ d_m (* (sqrt l) (sqrt h)))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1e-21) {
tmp = (sqrt((1.0 / (l * h))) * d_m) * 1.0;
} else if (l <= 1.62e-257) {
tmp = (fabs(d_m) / sqrt((l * h))) * fma((((M_m * M_m) * (h / ((d_m * d_m) * l))) * -0.125), (D_m * D_m), 1.0);
} else {
tmp = fma(((((M_m * M_m) / ((l * d_m) * sqrt((l / h)))) * -0.125) * D_m), D_m, (d_m / (sqrt(l) * sqrt(h))));
}
return tmp;
}
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) tmp = 0.0 if (l <= -1e-21) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * 1.0); elseif (l <= 1.62e-257) tmp = Float64(Float64(abs(d_m) / sqrt(Float64(l * h))) * fma(Float64(Float64(Float64(M_m * M_m) * Float64(h / Float64(Float64(d_m * d_m) * l))) * -0.125), Float64(D_m * D_m), 1.0)); else tmp = fma(Float64(Float64(Float64(Float64(M_m * M_m) / Float64(Float64(l * d_m) * sqrt(Float64(l / h)))) * -0.125) * D_m), D_m, Float64(d_m / Float64(sqrt(l) * sqrt(h)))); end return tmp end
d_m = N[Abs[d], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1e-21], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[l, 1.62e-257], N[(N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(h / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m + N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot 1\\
\mathbf{elif}\;\ell \leq 1.62 \cdot 10^{-257}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\left(\left(M\_m \cdot M\_m\right) \cdot \frac{h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right) \cdot -0.125, D\_m \cdot D\_m, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{M\_m \cdot M\_m}{\left(\ell \cdot d\_m\right) \cdot \sqrt{\frac{\ell}{h}}} \cdot -0.125\right) \cdot D\_m, D\_m, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -9.99999999999999908e-22Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
Taylor expanded in d around 0
times-fracN/A
lift-/.f64N/A
sqrt-unprodN/A
frac-2negN/A
sqrt-undivN/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.3%
Taylor expanded in d around inf
Applied rewrites42.7%
if -9.99999999999999908e-22 < l < 1.6200000000000001e-257Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
sqrt-unprodN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f6469.6
Applied rewrites69.6%
Taylor expanded in D around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
distribute-rgt-inN/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites48.1%
if 1.6200000000000001e-257 < l Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around inf
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6437.6
Applied rewrites37.6%
Taylor expanded in h around 0
lower-/.f6437.6
Applied rewrites37.6%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))))
(if (<= l -1e-21)
(* (* t_0 d_m) 1.0)
(if (<= l -2e-304)
(* (/ (* (* (* (* M_m M_m) h) t_0) (* D_m D_m)) (* l d_m)) -0.125)
(if (<= l 4.3e-260)
(/ (sqrt (* h (* d_m (/ d_m l)))) h)
(fma
(* (* (/ (* M_m M_m) (* (* l d_m) (sqrt (/ l h)))) -0.125) D_m)
D_m
(/ d_m (* (sqrt l) (sqrt h)))))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (l <= -1e-21) {
tmp = (t_0 * d_m) * 1.0;
} else if (l <= -2e-304) {
tmp = (((((M_m * M_m) * h) * t_0) * (D_m * D_m)) / (l * d_m)) * -0.125;
} else if (l <= 4.3e-260) {
tmp = sqrt((h * (d_m * (d_m / l)))) / h;
} else {
tmp = fma(((((M_m * M_m) / ((l * d_m) * sqrt((l / h)))) * -0.125) * D_m), D_m, (d_m / (sqrt(l) * sqrt(h))));
}
return tmp;
}
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (l <= -1e-21) tmp = Float64(Float64(t_0 * d_m) * 1.0); elseif (l <= -2e-304) tmp = Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) * t_0) * Float64(D_m * D_m)) / Float64(l * d_m)) * -0.125); elseif (l <= 4.3e-260) tmp = Float64(sqrt(Float64(h * Float64(d_m * Float64(d_m / l)))) / h); else tmp = fma(Float64(Float64(Float64(Float64(M_m * M_m) / Float64(Float64(l * d_m) * sqrt(Float64(l / h)))) * -0.125) * D_m), D_m, Float64(d_m / Float64(sqrt(l) * sqrt(h)))); end return tmp end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e-21], N[(N[(t$95$0 * d$95$m), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[l, -2e-304], N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision], If[LessEqual[l, 4.3e-260], N[(N[Sqrt[N[(h * N[(d$95$m * N[(d$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m + N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\left(t\_0 \cdot d\_m\right) \cdot 1\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-304}:\\
\;\;\;\;\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot t\_0\right) \cdot \left(D\_m \cdot D\_m\right)}{\ell \cdot d\_m} \cdot -0.125\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-260}:\\
\;\;\;\;\frac{\sqrt{h \cdot \left(d\_m \cdot \frac{d\_m}{\ell}\right)}}{h}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{M\_m \cdot M\_m}{\left(\ell \cdot d\_m\right) \cdot \sqrt{\frac{\ell}{h}}} \cdot -0.125\right) \cdot D\_m, D\_m, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\right)\\
\end{array}
\end{array}
if l < -9.99999999999999908e-22Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
Taylor expanded in d around 0
times-fracN/A
lift-/.f64N/A
sqrt-unprodN/A
frac-2negN/A
sqrt-undivN/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.3%
Taylor expanded in d around inf
Applied rewrites42.7%
if -9.99999999999999908e-22 < l < -1.99999999999999994e-304Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
Taylor expanded in d around 0
Applied rewrites31.1%
if -1.99999999999999994e-304 < l < 4.30000000000000021e-260Initial program 35.4%
Taylor expanded in h around 0
lower-/.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6421.4
Applied rewrites21.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6420.8
Applied rewrites20.8%
if 4.30000000000000021e-260 < l Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in h around inf
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6437.6
Applied rewrites37.6%
Taylor expanded in h around 0
lower-/.f6437.6
Applied rewrites37.6%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(if (<= M_m 7.6e-50)
(/ d_m (sqrt (* l h)))
(*
(/ (* (* (* (* M_m M_m) h) (sqrt (/ 1.0 (* l h)))) (* D_m D_m)) (* l d_m))
-0.125)))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double tmp;
if (M_m <= 7.6e-50) {
tmp = d_m / sqrt((l * h));
} else {
tmp = (((((M_m * M_m) * h) * sqrt((1.0 / (l * h)))) * (D_m * D_m)) / (l * d_m)) * -0.125;
}
return tmp;
}
d_m = private
M_m = private
D_m = private
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
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_m, d_m_1)
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_m
real(8), intent (in) :: d_m_1
real(8) :: tmp
if (m_m <= 7.6d-50) then
tmp = d_m / sqrt((l * h))
else
tmp = (((((m_m * m_m) * h) * sqrt((1.0d0 / (l * h)))) * (d_m_1 * d_m_1)) / (l * d_m)) * (-0.125d0)
end if
code = tmp
end function
d_m = Math.abs(d);
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d_m < h && h < l && l < M_m && M_m < D_m;
public static double code(double d_m, double h, double l, double M_m, double D_m) {
double tmp;
if (M_m <= 7.6e-50) {
tmp = d_m / Math.sqrt((l * h));
} else {
tmp = (((((M_m * M_m) * h) * Math.sqrt((1.0 / (l * h)))) * (D_m * D_m)) / (l * d_m)) * -0.125;
}
return tmp;
}
d_m = math.fabs(d) M_m = math.fabs(M) D_m = math.fabs(D) [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m]) def code(d_m, h, l, M_m, D_m): tmp = 0 if M_m <= 7.6e-50: tmp = d_m / math.sqrt((l * h)) else: tmp = (((((M_m * M_m) * h) * math.sqrt((1.0 / (l * h)))) * (D_m * D_m)) / (l * d_m)) * -0.125 return tmp
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) tmp = 0.0 if (M_m <= 7.6e-50) tmp = Float64(d_m / sqrt(Float64(l * h))); else tmp = Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(D_m * D_m)) / Float64(l * d_m)) * -0.125); end return tmp end
d_m = abs(d);
M_m = abs(M);
D_m = abs(D);
d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
function tmp_2 = code(d_m, h, l, M_m, D_m)
tmp = 0.0;
if (M_m <= 7.6e-50)
tmp = d_m / sqrt((l * h));
else
tmp = (((((M_m * M_m) * h) * sqrt((1.0 / (l * h)))) * (D_m * D_m)) / (l * d_m)) * -0.125;
end
tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[M$95$m, 7.6e-50], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 7.6 \cdot 10^{-50}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(D\_m \cdot D\_m\right)}{\ell \cdot d\_m} \cdot -0.125\\
\end{array}
\end{array}
if M < 7.5999999999999998e-50Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in d around inf
sqrt-prodN/A
lower-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.9
Applied rewrites42.9%
if 7.5999999999999998e-50 < M Initial program 35.4%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
frac-timesN/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6442.3
Applied rewrites42.3%
Taylor expanded in d around 0
Applied rewrites31.1%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= (* M_m D_m) 2e+112)
(/ d_m t_0)
(* (* (* D_m D_m) (/ (* (* M_m M_m) h) (* (* l d_m) t_0))) -0.125))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if ((M_m * D_m) <= 2e+112) {
tmp = d_m / t_0;
} else {
tmp = ((D_m * D_m) * (((M_m * M_m) * h) / ((l * d_m) * t_0))) * -0.125;
}
return tmp;
}
d_m = private
M_m = private
D_m = private
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
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_m, d_m_1)
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_m
real(8), intent (in) :: d_m_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if ((m_m * d_m_1) <= 2d+112) then
tmp = d_m / t_0
else
tmp = ((d_m_1 * d_m_1) * (((m_m * m_m) * h) / ((l * d_m) * t_0))) * (-0.125d0)
end if
code = tmp
end function
d_m = Math.abs(d);
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d_m < h && h < l && l < M_m && M_m < D_m;
public static double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if ((M_m * D_m) <= 2e+112) {
tmp = d_m / t_0;
} else {
tmp = ((D_m * D_m) * (((M_m * M_m) * h) / ((l * d_m) * t_0))) * -0.125;
}
return tmp;
}
d_m = math.fabs(d) M_m = math.fabs(M) D_m = math.fabs(D) [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m]) def code(d_m, h, l, M_m, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if (M_m * D_m) <= 2e+112: tmp = d_m / t_0 else: tmp = ((D_m * D_m) * (((M_m * M_m) * h) / ((l * d_m) * t_0))) * -0.125 return tmp
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (Float64(M_m * D_m) <= 2e+112) tmp = Float64(d_m / t_0); else tmp = Float64(Float64(Float64(D_m * D_m) * Float64(Float64(Float64(M_m * M_m) * h) / Float64(Float64(l * d_m) * t_0))) * -0.125); end return tmp end
d_m = abs(d);
M_m = abs(M);
D_m = abs(D);
d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
function tmp_2 = code(d_m, h, l, M_m, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if ((M_m * D_m) <= 2e+112)
tmp = d_m / t_0;
else
tmp = ((D_m * D_m) * (((M_m * M_m) * h) / ((l * d_m) * t_0))) * -0.125;
end
tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 2e+112], N[(d$95$m / t$95$0), $MachinePrecision], N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;M\_m \cdot D\_m \leq 2 \cdot 10^{+112}:\\
\;\;\;\;\frac{d\_m}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(D\_m \cdot D\_m\right) \cdot \frac{\left(M\_m \cdot M\_m\right) \cdot h}{\left(\ell \cdot d\_m\right) \cdot t\_0}\right) \cdot -0.125\\
\end{array}
\end{array}
if (*.f64 M D) < 1.9999999999999999e112Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in d around inf
sqrt-prodN/A
lower-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.9
Applied rewrites42.9%
if 1.9999999999999999e112 < (*.f64 M D) Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in d around 0
Applied rewrites30.4%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
: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_m D_m) (* 2.0 d_m)) 2.0))
(/ h l))))))
(if (<= t_0 -1e-109)
(* (/ (* (* M_m M_m) (* D_m D_m)) (* (* (sqrt (/ l h)) l) d_m)) -0.125)
(if (<= t_0 1e+126)
(/ (fabs d_m) (* (sqrt l) (sqrt h)))
(/ d_m (sqrt (* l h)))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -1e-109) {
tmp = (((M_m * M_m) * (D_m * D_m)) / ((sqrt((l / h)) * l) * d_m)) * -0.125;
} else if (t_0 <= 1e+126) {
tmp = fabs(d_m) / (sqrt(l) * sqrt(h));
} else {
tmp = d_m / sqrt((l * h));
}
return tmp;
}
d_m = private
M_m = private
D_m = private
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
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_m, d_m_1)
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_m
real(8), intent (in) :: d_m_1
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_m * d_m_1) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-1d-109)) then
tmp = (((m_m * m_m) * (d_m_1 * d_m_1)) / ((sqrt((l / h)) * l) * d_m)) * (-0.125d0)
else if (t_0 <= 1d+126) then
tmp = abs(d_m) / (sqrt(l) * sqrt(h))
else
tmp = d_m / sqrt((l * h))
end if
code = tmp
end function
d_m = Math.abs(d);
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d_m < h && h < l && l < M_m && M_m < D_m;
public static double code(double d_m, double h, double l, double M_m, double D_m) {
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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -1e-109) {
tmp = (((M_m * M_m) * (D_m * D_m)) / ((Math.sqrt((l / h)) * l) * d_m)) * -0.125;
} else if (t_0 <= 1e+126) {
tmp = Math.abs(d_m) / (Math.sqrt(l) * Math.sqrt(h));
} else {
tmp = d_m / Math.sqrt((l * h));
}
return tmp;
}
d_m = math.fabs(d) M_m = math.fabs(M) D_m = math.fabs(D) [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m]) def code(d_m, h, l, M_m, D_m): 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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -1e-109: tmp = (((M_m * M_m) * (D_m * D_m)) / ((math.sqrt((l / h)) * l) * d_m)) * -0.125 elif t_0 <= 1e+126: tmp = math.fabs(d_m) / (math.sqrt(l) * math.sqrt(h)) else: tmp = d_m / math.sqrt((l * h)) return tmp
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) 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_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -1e-109) tmp = Float64(Float64(Float64(Float64(M_m * M_m) * Float64(D_m * D_m)) / Float64(Float64(sqrt(Float64(l / h)) * l) * d_m)) * -0.125); elseif (t_0 <= 1e+126) tmp = Float64(abs(d_m) / Float64(sqrt(l) * sqrt(h))); else tmp = Float64(d_m / sqrt(Float64(l * h))); end return tmp end
d_m = abs(d);
M_m = abs(M);
D_m = abs(D);
d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
function tmp_2 = code(d_m, h, l, M_m, D_m)
t_0 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0)) * (h / l)));
tmp = 0.0;
if (t_0 <= -1e-109)
tmp = (((M_m * M_m) * (D_m * D_m)) / ((sqrt((l / h)) * l) * d_m)) * -0.125;
elseif (t_0 <= 1e+126)
tmp = abs(d_m) / (sqrt(l) * sqrt(h));
else
tmp = d_m / sqrt((l * h));
end
tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := 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$95$m * D$95$m), $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-109], N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision] * d$95$m), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision], If[LessEqual[t$95$0, 1e+126], N[(N[Abs[d$95$m], $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\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\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-109}:\\
\;\;\;\;\frac{\left(M\_m \cdot M\_m\right) \cdot \left(D\_m \cdot D\_m\right)}{\left(\sqrt{\frac{\ell}{h}} \cdot \ell\right) \cdot d\_m} \cdot -0.125\\
\mathbf{elif}\;t\_0 \leq 10^{+126}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{\ell} \cdot \sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot 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)))) < -9.9999999999999999e-110Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in h around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6418.3
Applied rewrites18.3%
if -9.9999999999999999e-110 < (*.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.99999999999999925e125Initial program 35.4%
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f640.0
Applied rewrites0.0%
Taylor expanded in h around 0
Applied rewrites42.9%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-*.f6425.0
Applied rewrites25.0%
if 9.99999999999999925e125 < (*.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.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in d around inf
sqrt-prodN/A
lower-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.9
Applied rewrites42.9%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
: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_m D_m) (* 2.0 d_m)) 2.0))
(/ h l))))))
(if (<= t_0 -1e-109)
(- (sqrt (/ (* (- d_m) (/ d_m l)) (- h))))
(if (<= t_0 1e+126)
(/ (fabs d_m) (* (sqrt l) (sqrt h)))
(/ d_m (sqrt (* l h)))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -1e-109) {
tmp = -sqrt(((-d_m * (d_m / l)) / -h));
} else if (t_0 <= 1e+126) {
tmp = fabs(d_m) / (sqrt(l) * sqrt(h));
} else {
tmp = d_m / sqrt((l * h));
}
return tmp;
}
d_m = private
M_m = private
D_m = private
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
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_m, d_m_1)
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_m
real(8), intent (in) :: d_m_1
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_m * d_m_1) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-1d-109)) then
tmp = -sqrt(((-d_m * (d_m / l)) / -h))
else if (t_0 <= 1d+126) then
tmp = abs(d_m) / (sqrt(l) * sqrt(h))
else
tmp = d_m / sqrt((l * h))
end if
code = tmp
end function
d_m = Math.abs(d);
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d_m < h && h < l && l < M_m && M_m < D_m;
public static double code(double d_m, double h, double l, double M_m, double D_m) {
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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -1e-109) {
tmp = -Math.sqrt(((-d_m * (d_m / l)) / -h));
} else if (t_0 <= 1e+126) {
tmp = Math.abs(d_m) / (Math.sqrt(l) * Math.sqrt(h));
} else {
tmp = d_m / Math.sqrt((l * h));
}
return tmp;
}
d_m = math.fabs(d) M_m = math.fabs(M) D_m = math.fabs(D) [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m]) def code(d_m, h, l, M_m, D_m): 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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -1e-109: tmp = -math.sqrt(((-d_m * (d_m / l)) / -h)) elif t_0 <= 1e+126: tmp = math.fabs(d_m) / (math.sqrt(l) * math.sqrt(h)) else: tmp = d_m / math.sqrt((l * h)) return tmp
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) 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_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -1e-109) tmp = Float64(-sqrt(Float64(Float64(Float64(-d_m) * Float64(d_m / l)) / Float64(-h)))); elseif (t_0 <= 1e+126) tmp = Float64(abs(d_m) / Float64(sqrt(l) * sqrt(h))); else tmp = Float64(d_m / sqrt(Float64(l * h))); end return tmp end
d_m = abs(d);
M_m = abs(M);
D_m = abs(D);
d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
function tmp_2 = code(d_m, h, l, M_m, D_m)
t_0 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0)) * (h / l)));
tmp = 0.0;
if (t_0 <= -1e-109)
tmp = -sqrt(((-d_m * (d_m / l)) / -h));
elseif (t_0 <= 1e+126)
tmp = abs(d_m) / (sqrt(l) * sqrt(h));
else
tmp = d_m / sqrt((l * h));
end
tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := 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$95$m * D$95$m), $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-109], (-N[Sqrt[N[(N[((-d$95$m) * N[(d$95$m / l), $MachinePrecision]), $MachinePrecision] / (-h)), $MachinePrecision]], $MachinePrecision]), If[LessEqual[t$95$0, 1e+126], N[(N[Abs[d$95$m], $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\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\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-109}:\\
\;\;\;\;-\sqrt{\frac{\left(-d\_m\right) \cdot \frac{d\_m}{\ell}}{-h}}\\
\mathbf{elif}\;t\_0 \leq 10^{+126}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{\ell} \cdot \sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot 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)))) < -9.9999999999999999e-110Initial program 35.4%
Taylor expanded in h around 0
lower-/.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6421.4
Applied rewrites21.4%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-prodN/A
*-commutativeN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6418.9
Applied rewrites18.9%
Taylor expanded in h around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
sqrt-prodN/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-fabs.f649.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f649.6
Applied rewrites9.6%
lift-fabs.f64N/A
lift-/.f64N/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
frac-timesN/A
sqrt-divN/A
frac-2negN/A
sqrt-undivN/A
sqrt-divN/A
associate-*l/N/A
sqrt-unprodN/A
sqrt-undivN/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lift-/.f64N/A
lower-neg.f6411.5
Applied rewrites11.5%
if -9.9999999999999999e-110 < (*.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.99999999999999925e125Initial program 35.4%
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f640.0
Applied rewrites0.0%
Taylor expanded in h around 0
Applied rewrites42.9%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-*.f6425.0
Applied rewrites25.0%
if 9.99999999999999925e125 < (*.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.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in d around inf
sqrt-prodN/A
lower-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.9
Applied rewrites42.9%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
: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_m D_m) (* 2.0 d_m)) 2.0))
(/ h l))))))
(if (<= t_0 -1e-109)
(- (sqrt (/ (* d_m d_m) (* l h))))
(if (<= t_0 1e+126)
(/ (fabs d_m) (* (sqrt l) (sqrt h)))
(/ d_m (sqrt (* l h)))))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -1e-109) {
tmp = -sqrt(((d_m * d_m) / (l * h)));
} else if (t_0 <= 1e+126) {
tmp = fabs(d_m) / (sqrt(l) * sqrt(h));
} else {
tmp = d_m / sqrt((l * h));
}
return tmp;
}
d_m = private
M_m = private
D_m = private
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
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_m, d_m_1)
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_m
real(8), intent (in) :: d_m_1
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_m * d_m_1) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-1d-109)) then
tmp = -sqrt(((d_m * d_m) / (l * h)))
else if (t_0 <= 1d+126) then
tmp = abs(d_m) / (sqrt(l) * sqrt(h))
else
tmp = d_m / sqrt((l * h))
end if
code = tmp
end function
d_m = Math.abs(d);
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d_m < h && h < l && l < M_m && M_m < D_m;
public static double code(double d_m, double h, double l, double M_m, double D_m) {
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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_0 <= -1e-109) {
tmp = -Math.sqrt(((d_m * d_m) / (l * h)));
} else if (t_0 <= 1e+126) {
tmp = Math.abs(d_m) / (Math.sqrt(l) * Math.sqrt(h));
} else {
tmp = d_m / Math.sqrt((l * h));
}
return tmp;
}
d_m = math.fabs(d) M_m = math.fabs(M) D_m = math.fabs(D) [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m]) def code(d_m, h, l, M_m, D_m): 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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -1e-109: tmp = -math.sqrt(((d_m * d_m) / (l * h))) elif t_0 <= 1e+126: tmp = math.fabs(d_m) / (math.sqrt(l) * math.sqrt(h)) else: tmp = d_m / math.sqrt((l * h)) return tmp
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) 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_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_0 <= -1e-109) tmp = Float64(-sqrt(Float64(Float64(d_m * d_m) / Float64(l * h)))); elseif (t_0 <= 1e+126) tmp = Float64(abs(d_m) / Float64(sqrt(l) * sqrt(h))); else tmp = Float64(d_m / sqrt(Float64(l * h))); end return tmp end
d_m = abs(d);
M_m = abs(M);
D_m = abs(D);
d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
function tmp_2 = code(d_m, h, l, M_m, D_m)
t_0 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0)) * (h / l)));
tmp = 0.0;
if (t_0 <= -1e-109)
tmp = -sqrt(((d_m * d_m) / (l * h)));
elseif (t_0 <= 1e+126)
tmp = abs(d_m) / (sqrt(l) * sqrt(h));
else
tmp = d_m / sqrt((l * h));
end
tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := 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$95$m * D$95$m), $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-109], (-N[Sqrt[N[(N[(d$95$m * d$95$m), $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[t$95$0, 1e+126], N[(N[Abs[d$95$m], $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\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\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-109}:\\
\;\;\;\;-\sqrt{\frac{d\_m \cdot d\_m}{\ell \cdot h}}\\
\mathbf{elif}\;t\_0 \leq 10^{+126}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{\ell} \cdot \sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot 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)))) < -9.9999999999999999e-110Initial program 35.4%
Taylor expanded in h around 0
lower-/.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6421.4
Applied rewrites21.4%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-prodN/A
*-commutativeN/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lower-sqrt.f64N/A
*-commutativeN/A
lift-*.f6418.9
Applied rewrites18.9%
Taylor expanded in h around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
sqrt-divN/A
sqrt-divN/A
frac-timesN/A
sqrt-prodN/A
rem-sqrt-square-revN/A
sqrt-prodN/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-fabs.f649.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f649.6
Applied rewrites9.6%
lift-fabs.f64N/A
lift-/.f64N/A
rem-sqrt-square-revN/A
pow2N/A
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-undivN/A
pow2N/A
frac-timesN/A
rem-square-sqrtN/A
sqrt-unprodN/A
frac-2negN/A
sqrt-undivN/A
associate-*l/N/A
sqrt-unprodN/A
frac-2negN/A
sqrt-undivN/A
associate-*l/N/A
Applied rewrites11.5%
if -9.9999999999999999e-110 < (*.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.99999999999999925e125Initial program 35.4%
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f640.0
Applied rewrites0.0%
Taylor expanded in h around 0
Applied rewrites42.9%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-*.f6425.0
Applied rewrites25.0%
if 9.99999999999999925e125 < (*.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.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in d around inf
sqrt-prodN/A
lower-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.9
Applied rewrites42.9%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* l 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_m D_m) (* 2.0 d_m)) 2.0))
(/ h l))))))
(if (<= t_1 -1e-109)
(- (/ (fabs d_m) t_0))
(if (<= t_1 1e+126) (/ (fabs d_m) (* (sqrt l) (sqrt h))) (/ d_m t_0)))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * 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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= -1e-109) {
tmp = -(fabs(d_m) / t_0);
} else if (t_1 <= 1e+126) {
tmp = fabs(d_m) / (sqrt(l) * sqrt(h));
} else {
tmp = d_m / t_0;
}
return tmp;
}
d_m = private
M_m = private
D_m = private
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
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_m, d_m_1)
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_m
real(8), intent (in) :: d_m_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((l * h))
t_1 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m_m * d_m_1) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
if (t_1 <= (-1d-109)) then
tmp = -(abs(d_m) / t_0)
else if (t_1 <= 1d+126) then
tmp = abs(d_m) / (sqrt(l) * sqrt(h))
else
tmp = d_m / t_0
end if
code = tmp
end function
d_m = Math.abs(d);
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d_m < h && h < l && l < M_m && M_m < D_m;
public static double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * 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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= -1e-109) {
tmp = -(Math.abs(d_m) / t_0);
} else if (t_1 <= 1e+126) {
tmp = Math.abs(d_m) / (Math.sqrt(l) * Math.sqrt(h));
} else {
tmp = d_m / t_0;
}
return tmp;
}
d_m = math.fabs(d) M_m = math.fabs(M) D_m = math.fabs(D) [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m]) def code(d_m, h, l, M_m, D_m): t_0 = math.sqrt((l * 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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l))) tmp = 0 if t_1 <= -1e-109: tmp = -(math.fabs(d_m) / t_0) elif t_1 <= 1e+126: tmp = math.fabs(d_m) / (math.sqrt(l) * math.sqrt(h)) else: tmp = d_m / t_0 return tmp
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) t_0 = sqrt(Float64(l * 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_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_1 <= -1e-109) tmp = Float64(-Float64(abs(d_m) / t_0)); elseif (t_1 <= 1e+126) tmp = Float64(abs(d_m) / Float64(sqrt(l) * sqrt(h))); else tmp = Float64(d_m / t_0); end return tmp end
d_m = abs(d);
M_m = abs(M);
D_m = abs(D);
d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
function tmp_2 = code(d_m, h, l, M_m, D_m)
t_0 = sqrt((l * h));
t_1 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0)) * (h / l)));
tmp = 0.0;
if (t_1 <= -1e-109)
tmp = -(abs(d_m) / t_0);
elseif (t_1 <= 1e+126)
tmp = abs(d_m) / (sqrt(l) * sqrt(h));
else
tmp = d_m / t_0;
end
tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * 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$95$m * D$95$m), $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-109], (-N[(N[Abs[d$95$m], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[t$95$1, 1e+126], N[(N[Abs[d$95$m], $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d$95$m / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot 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\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-109}:\\
\;\;\;\;-\frac{\left|d\_m\right|}{t\_0}\\
\mathbf{elif}\;t\_1 \leq 10^{+126}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{\ell} \cdot \sqrt{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{t\_0}\\
\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.9999999999999999e-110Initial program 35.4%
Taylor expanded in h around 0
lower-/.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6421.4
Applied rewrites21.4%
Taylor expanded in h around -inf
mul-1-negN/A
pow2N/A
times-fracN/A
lift-/.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lower-neg.f64N/A
lift-/.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
times-fracN/A
pow2N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
sqrt-unprodN/A
Applied rewrites9.6%
if -9.9999999999999999e-110 < (*.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.99999999999999925e125Initial program 35.4%
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f640.0
Applied rewrites0.0%
Taylor expanded in h around 0
Applied rewrites42.9%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-*.f6425.0
Applied rewrites25.0%
if 9.99999999999999925e125 < (*.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.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in d around inf
sqrt-prodN/A
lower-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.9
Applied rewrites42.9%
d_m = (fabs.f64 d)
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d_m h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(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_m D_m) (* 2.0 d_m)) 2.0)) (/ h l))))
-1e-109)
(- (/ (fabs d_m) t_0))
(/ d_m t_0))))d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -1e-109) {
tmp = -(fabs(d_m) / t_0);
} else {
tmp = d_m / t_0;
}
return tmp;
}
d_m = private
M_m = private
D_m = private
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
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_m, d_m_1)
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_m
real(8), intent (in) :: d_m_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m_m * d_m_1) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))) <= (-1d-109)) then
tmp = -(abs(d_m) / t_0)
else
tmp = d_m / t_0
end if
code = tmp
end function
d_m = Math.abs(d);
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d_m < h && h < l && l < M_m && M_m < D_m;
public static double code(double d_m, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * h));
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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -1e-109) {
tmp = -(Math.abs(d_m) / t_0);
} else {
tmp = d_m / t_0;
}
return tmp;
}
d_m = math.fabs(d) M_m = math.fabs(M) D_m = math.fabs(D) [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m]) def code(d_m, h, l, M_m, D_m): t_0 = math.sqrt((l * h)) 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_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -1e-109: tmp = -(math.fabs(d_m) / t_0) else: tmp = d_m / t_0 return tmp
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) 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_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) <= -1e-109) tmp = Float64(-Float64(abs(d_m) / t_0)); else tmp = Float64(d_m / t_0); end return tmp end
d_m = abs(d);
M_m = abs(M);
D_m = abs(D);
d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
function tmp_2 = code(d_m, h, l, M_m, D_m)
t_0 = sqrt((l * h));
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_m * D_m) / (2.0 * d_m)) ^ 2.0)) * (h / l)))) <= -1e-109)
tmp = -(abs(d_m) / t_0);
else
tmp = d_m / t_0;
end
tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $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$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-109], (-N[(N[Abs[d$95$m], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(d$95$m / t$95$0), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\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\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -1 \cdot 10^{-109}:\\
\;\;\;\;-\frac{\left|d\_m\right|}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{t\_0}\\
\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.9999999999999999e-110Initial program 35.4%
Taylor expanded in h around 0
lower-/.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6421.4
Applied rewrites21.4%
Taylor expanded in h around -inf
mul-1-negN/A
pow2N/A
times-fracN/A
lift-/.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lower-neg.f64N/A
lift-/.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
times-fracN/A
pow2N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
sqrt-unprodN/A
Applied rewrites9.6%
if -9.9999999999999999e-110 < (*.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.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in d around inf
sqrt-prodN/A
lower-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.9
Applied rewrites42.9%
d_m = (fabs.f64 d) M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d_m h l M_m D_m) :precision binary64 (/ d_m (sqrt (* l h))))
d_m = fabs(d);
M_m = fabs(M);
D_m = fabs(D);
assert(d_m < h && h < l && l < M_m && M_m < D_m);
double code(double d_m, double h, double l, double M_m, double D_m) {
return d_m / sqrt((l * h));
}
d_m = private
M_m = private
D_m = private
NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
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_m, d_m_1)
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_m
real(8), intent (in) :: d_m_1
code = d_m / sqrt((l * h))
end function
d_m = Math.abs(d);
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d_m < h && h < l && l < M_m && M_m < D_m;
public static double code(double d_m, double h, double l, double M_m, double D_m) {
return d_m / Math.sqrt((l * h));
}
d_m = math.fabs(d) M_m = math.fabs(M) D_m = math.fabs(D) [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m]) def code(d_m, h, l, M_m, D_m): return d_m / math.sqrt((l * h))
d_m = abs(d) M_m = abs(M) D_m = abs(D) d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m]) function code(d_m, h, l, M_m, D_m) return Float64(d_m / sqrt(Float64(l * h))) end
d_m = abs(d);
M_m = abs(M);
D_m = abs(D);
d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
function tmp = code(d_m, h, l, M_m, D_m)
tmp = d_m / sqrt((l * h));
end
d_m = N[Abs[d], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|
\\
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
\\
\frac{d\_m}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 35.4%
Taylor expanded in l around inf
Applied rewrites28.1%
Taylor expanded in D around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in d around inf
sqrt-prodN/A
lower-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lift-*.f6442.9
Applied rewrites42.9%
herbie shell --seed 2025140
(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)))))