
(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}
Sampling outcomes in binary64 precision:
Herbie found 21 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)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= d -2.4e-201)
(*
(* (/ t_0 (sqrt (- h))) (/ t_0 (sqrt (- l))))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l))))
(if (<= d 1.18e-200)
(/
(fma
(* (pow (/ h l) 1.5) (* (* D_m D_m) -0.125))
(* (/ M_m d) M_m)
(* (sqrt (/ h l)) d))
h)
(*
(/ (/ d (sqrt l)) (sqrt h))
(fma
(* (/ h l) (* (* 0.5 (/ D_m 2.0)) (/ M_m d)))
(* (/ D_m -2.0) (/ M_m d))
1.0))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (d <= -2.4e-201) {
tmp = ((t_0 / sqrt(-h)) * (t_0 / sqrt(-l))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
} else if (d <= 1.18e-200) {
tmp = fma((pow((h / l), 1.5) * ((D_m * D_m) * -0.125)), ((M_m / d) * M_m), (sqrt((h / l)) * d)) / h;
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * fma(((h / l) * ((0.5 * (D_m / 2.0)) * (M_m / d))), ((D_m / -2.0) * (M_m / d)), 1.0);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -2.4e-201) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(t_0 / sqrt(Float64(-l)))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); elseif (d <= 1.18e-200) tmp = Float64(fma(Float64((Float64(h / l) ^ 1.5) * Float64(Float64(D_m * D_m) * -0.125)), Float64(Float64(M_m / d) * M_m), Float64(sqrt(Float64(h / l)) * d)) / h); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * fma(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D_m / 2.0)) * Float64(M_m / d))), Float64(Float64(D_m / -2.0) * Float64(M_m / d)), 1.0)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -2.4e-201], N[(N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.18e-200], N[(N[(N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / -2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;d \leq -2.4 \cdot 10^{-201}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-h}} \cdot \frac{t\_0}{\sqrt{-\ell}}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;d \leq 1.18 \cdot 10^{-200}:\\
\;\;\;\;\frac{\mathsf{fma}\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot -0.125\right), \frac{M\_m}{d} \cdot M\_m, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \frac{D\_m}{2}\right) \cdot \frac{M\_m}{d}\right), \frac{D\_m}{-2} \cdot \frac{M\_m}{d}, 1\right)\\
\end{array}
\end{array}
if d < -2.40000000000000009e-201Initial program 73.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6478.5
Applied rewrites78.5%
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6489.8
Applied rewrites89.8%
if -2.40000000000000009e-201 < d < 1.17999999999999996e-200Initial program 37.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6417.3
Applied rewrites17.3%
Applied rewrites17.4%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites33.4%
Applied rewrites55.2%
if 1.17999999999999996e-200 < d Initial program 70.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6470.5
Applied rewrites70.5%
Applied rewrites71.5%
lift-/.f64N/A
metadata-eval71.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6471.5
Applied rewrites71.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6482.3
Applied rewrites82.3%
Final simplification80.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(*
(* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
(/ h l)))))
(t_1 (sqrt (* l h)))
(t_2 (/ d t_1)))
(if (<= t_0 (- INFINITY))
(*
(fma (/ (* (* (* (* 0.25 D_m) D_m) M_m) M_m) d) (* -0.5 (/ h l)) 1.0)
t_2)
(if (<= t_0 2e-242)
(/
(fma
(* d (* (/ M_m d) (* D_m 0.25)))
(* (* (/ D_m d) (/ M_m -2.0)) (/ h l))
d)
t_1)
(if (<= t_0 1e+161)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_0 INFINITY)
(/ (* (sqrt (/ h l)) d) h)
(*
(fma
(* (/ (* (* M_m (* D_m 0.25)) h) (* d l)) (/ D_m d))
(/ M_m -2.0)
1.0)
t_2)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = sqrt((l * h));
double t_2 = d / t_1;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma((((((0.25 * D_m) * D_m) * M_m) * M_m) / d), (-0.5 * (h / l)), 1.0) * t_2;
} else if (t_0 <= 2e-242) {
tmp = fma((d * ((M_m / d) * (D_m * 0.25))), (((D_m / d) * (M_m / -2.0)) * (h / l)), d) / t_1;
} else if (t_0 <= 1e+161) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (sqrt((h / l)) * d) / h;
} else {
tmp = fma(((((M_m * (D_m * 0.25)) * h) / (d * l)) * (D_m / d)), (M_m / -2.0), 1.0) * t_2;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = sqrt(Float64(l * h)) t_2 = Float64(d / t_1) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(0.25 * D_m) * D_m) * M_m) * M_m) / d), Float64(-0.5 * Float64(h / l)), 1.0) * t_2); elseif (t_0 <= 2e-242) tmp = Float64(fma(Float64(d * Float64(Float64(M_m / d) * Float64(D_m * 0.25))), Float64(Float64(Float64(D_m / d) * Float64(M_m / -2.0)) * Float64(h / l)), d) / t_1); elseif (t_0 <= 1e+161) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_0 <= Inf) tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); else tmp = Float64(fma(Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.25)) * h) / Float64(d * l)) * Float64(D_m / d)), Float64(M_m / -2.0), 1.0) * t_2); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(d / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(N[(N[(0.25 * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] / d), $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 2e-242], N[(N[(N[(d * N[(N[(M$95$m / d), $MachinePrecision] * N[(D$95$m * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(M$95$m / -2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] + d), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 1e+161], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.25), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / -2.0), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{\ell \cdot h}\\
t_2 := \frac{d}{t\_1}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(\left(0.25 \cdot D\_m\right) \cdot D\_m\right) \cdot M\_m\right) \cdot M\_m}{d}, -0.5 \cdot \frac{h}{\ell}, 1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-242}:\\
\;\;\;\;\frac{\mathsf{fma}\left(d \cdot \left(\frac{M\_m}{d} \cdot \left(D\_m \cdot 0.25\right)\right), \left(\frac{D\_m}{d} \cdot \frac{M\_m}{-2}\right) \cdot \frac{h}{\ell}, d\right)}{t\_1}\\
\mathbf{elif}\;t\_0 \leq 10^{+161}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(M\_m \cdot \left(D\_m \cdot 0.25\right)\right) \cdot h}{d \cdot \ell} \cdot \frac{D\_m}{d}, \frac{M\_m}{-2}, 1\right) \cdot t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -inf.0Initial program 83.4%
Applied rewrites32.8%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6432.8
Applied rewrites80.6%
Taylor expanded in M around 0
associate-*r*N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6475.3
Applied rewrites75.3%
if -inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2e-242Initial program 68.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6468.9
Applied rewrites68.9%
Applied rewrites68.3%
lift-/.f64N/A
metadata-eval68.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6468.3
Applied rewrites68.3%
Applied rewrites47.4%
if 2e-242 < (*.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)))) < 1e161Initial program 99.2%
Applied rewrites92.4%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
if 1e161 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 53.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6437.0
Applied rewrites37.0%
Applied rewrites37.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites48.9%
Taylor expanded in d around inf
Applied rewrites79.3%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites0.3%
lift-/.f64N/A
metadata-eval0.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f640.3
Applied rewrites0.3%
Applied rewrites26.9%
Final simplification69.5%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (sqrt (/ d l)))
(t_2
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(*
(* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
(/ h l)))))
(t_3 (* (/ D_m -2.0) (/ M_m d))))
(if (<= t_2 -4e-51)
(* (* t_0 t_1) (fma (/ (* (/ h l) (* M_m (* D_m 0.25))) d) t_3 1.0))
(if (or (<= t_2 2e-242) (not (<= t_2 5e+260)))
(*
(fabs (/ d (sqrt (* l h))))
(fma (* (/ h l) (* (* 0.5 (/ D_m 2.0)) (/ M_m d))) t_3 1.0))
(* t_1 t_0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
double t_3 = (D_m / -2.0) * (M_m / d);
double tmp;
if (t_2 <= -4e-51) {
tmp = (t_0 * t_1) * fma((((h / l) * (M_m * (D_m * 0.25))) / d), t_3, 1.0);
} else if ((t_2 <= 2e-242) || !(t_2 <= 5e+260)) {
tmp = fabs((d / sqrt((l * h)))) * fma(((h / l) * ((0.5 * (D_m / 2.0)) * (M_m / d))), t_3, 1.0);
} else {
tmp = t_1 * t_0;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_3 = Float64(Float64(D_m / -2.0) * Float64(M_m / d)) tmp = 0.0 if (t_2 <= -4e-51) tmp = Float64(Float64(t_0 * t_1) * fma(Float64(Float64(Float64(h / l) * Float64(M_m * Float64(D_m * 0.25))) / d), t_3, 1.0)); elseif ((t_2 <= 2e-242) || !(t_2 <= 5e+260)) tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * fma(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D_m / 2.0)) * Float64(M_m / d))), t_3, 1.0)); else tmp = Float64(t_1 * t_0); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(D$95$m / -2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-51], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(N[(N[(N[(h / l), $MachinePrecision] * N[(M$95$m * N[(D$95$m * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * t$95$3 + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$2, 2e-242], N[Not[LessEqual[t$95$2, 5e+260]], $MachinePrecision]], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$3 + 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_3 := \frac{D\_m}{-2} \cdot \frac{M\_m}{d}\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{-51}:\\
\;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \mathsf{fma}\left(\frac{\frac{h}{\ell} \cdot \left(M\_m \cdot \left(D\_m \cdot 0.25\right)\right)}{d}, t\_3, 1\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-242} \lor \neg \left(t\_2 \leq 5 \cdot 10^{+260}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \frac{D\_m}{2}\right) \cdot \frac{M\_m}{d}\right), t\_3, 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot 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)))) < -4e-51Initial program 86.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6486.1
Applied rewrites86.1%
Applied rewrites90.3%
lift-/.f64N/A
metadata-eval90.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6490.3
Applied rewrites90.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f6489.3
lower-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-*r/N/A
Applied rewrites88.2%
if -4e-51 < (*.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)))) < 2e-242 or 4.9999999999999996e260 < (*.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 21.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6421.6
Applied rewrites21.6%
Applied rewrites22.5%
lift-/.f64N/A
metadata-eval22.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6422.5
Applied rewrites22.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-square-revN/A
lower-fabs.f6462.4
Applied rewrites62.4%
if 2e-242 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999996e260Initial program 99.2%
Applied rewrites91.8%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
Final simplification81.5%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(*
(* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
(/ h l)))))
(t_1 (/ d (sqrt (* l h)))))
(if (<= t_0 2e-242)
(*
(fma
(* (* (/ M_m 2.0) D_m) (* (/ (/ D_m d) 2.0) M_m))
(* -0.5 (/ h l))
1.0)
t_1)
(if (<= t_0 1e+161)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_0 INFINITY)
(/ (* (sqrt (/ h l)) d) h)
(*
(fma
(* (/ (* (* M_m (* D_m 0.25)) h) (* d l)) (/ D_m d))
(/ M_m -2.0)
1.0)
t_1))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = d / sqrt((l * h));
double tmp;
if (t_0 <= 2e-242) {
tmp = fma((((M_m / 2.0) * D_m) * (((D_m / d) / 2.0) * M_m)), (-0.5 * (h / l)), 1.0) * t_1;
} else if (t_0 <= 1e+161) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (sqrt((h / l)) * d) / h;
} else {
tmp = fma(((((M_m * (D_m * 0.25)) * h) / (d * l)) * (D_m / d)), (M_m / -2.0), 1.0) * t_1;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (t_0 <= 2e-242) tmp = Float64(fma(Float64(Float64(Float64(M_m / 2.0) * D_m) * Float64(Float64(Float64(D_m / d) / 2.0) * M_m)), Float64(-0.5 * Float64(h / l)), 1.0) * t_1); elseif (t_0 <= 1e+161) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_0 <= Inf) tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); else tmp = Float64(fma(Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.25)) * h) / Float64(d * l)) * Float64(D_m / d)), Float64(M_m / -2.0), 1.0) * t_1); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-242], N[(N[(N[(N[(N[(M$95$m / 2.0), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(N[(N[(D$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 1e+161], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.25), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / -2.0), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-242}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{M\_m}{2} \cdot D\_m\right) \cdot \left(\frac{\frac{D\_m}{d}}{2} \cdot M\_m\right), -0.5 \cdot \frac{h}{\ell}, 1\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+161}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(M\_m \cdot \left(D\_m \cdot 0.25\right)\right) \cdot h}{d \cdot \ell} \cdot \frac{D\_m}{d}, \frac{M\_m}{-2}, 1\right) \cdot t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2e-242Initial program 78.9%
Applied rewrites27.2%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6427.2
Applied rewrites64.6%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/r*N/A
lower-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6464.6
Applied rewrites64.6%
if 2e-242 < (*.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)))) < 1e161Initial program 99.2%
Applied rewrites92.4%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
if 1e161 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 53.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6437.0
Applied rewrites37.0%
Applied rewrites37.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites48.9%
Taylor expanded in d around inf
Applied rewrites79.3%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites0.3%
lift-/.f64N/A
metadata-eval0.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f640.3
Applied rewrites0.3%
Applied rewrites26.9%
Final simplification68.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(*
(* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
(/ h l)))))
(t_1 (/ d (sqrt (* l h)))))
(if (<= t_0 2e-242)
(*
(fma (/ (* (* (* (* 0.25 D_m) D_m) M_m) M_m) d) (* -0.5 (/ h l)) 1.0)
t_1)
(if (<= t_0 1e+161)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_0 INFINITY)
(/ (* (sqrt (/ h l)) d) h)
(*
(fma
(* (/ (* (* M_m (* D_m 0.25)) h) (* d l)) (/ D_m d))
(/ M_m -2.0)
1.0)
t_1))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = d / sqrt((l * h));
double tmp;
if (t_0 <= 2e-242) {
tmp = fma((((((0.25 * D_m) * D_m) * M_m) * M_m) / d), (-0.5 * (h / l)), 1.0) * t_1;
} else if (t_0 <= 1e+161) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (sqrt((h / l)) * d) / h;
} else {
tmp = fma(((((M_m * (D_m * 0.25)) * h) / (d * l)) * (D_m / d)), (M_m / -2.0), 1.0) * t_1;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (t_0 <= 2e-242) tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(0.25 * D_m) * D_m) * M_m) * M_m) / d), Float64(-0.5 * Float64(h / l)), 1.0) * t_1); elseif (t_0 <= 1e+161) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_0 <= Inf) tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); else tmp = Float64(fma(Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.25)) * h) / Float64(d * l)) * Float64(D_m / d)), Float64(M_m / -2.0), 1.0) * t_1); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-242], N[(N[(N[(N[(N[(N[(N[(0.25 * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] / d), $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 1e+161], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.25), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / -2.0), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-242}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(\left(0.25 \cdot D\_m\right) \cdot D\_m\right) \cdot M\_m\right) \cdot M\_m}{d}, -0.5 \cdot \frac{h}{\ell}, 1\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+161}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(M\_m \cdot \left(D\_m \cdot 0.25\right)\right) \cdot h}{d \cdot \ell} \cdot \frac{D\_m}{d}, \frac{M\_m}{-2}, 1\right) \cdot t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2e-242Initial program 78.9%
Applied rewrites27.2%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6427.2
Applied rewrites64.6%
Taylor expanded in M around 0
associate-*r*N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6460.7
Applied rewrites60.7%
if 2e-242 < (*.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)))) < 1e161Initial program 99.2%
Applied rewrites92.4%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
if 1e161 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 53.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6437.0
Applied rewrites37.0%
Applied rewrites37.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites48.9%
Taylor expanded in d around inf
Applied rewrites79.3%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites0.3%
lift-/.f64N/A
metadata-eval0.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f640.3
Applied rewrites0.3%
Applied rewrites26.9%
Final simplification67.0%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(*
(* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
(/ h l)))))
(t_1
(*
(fma (/ (* (* (* (* 0.25 D_m) D_m) M_m) M_m) d) (* -0.5 (/ h l)) 1.0)
(/ d (sqrt (* l h))))))
(if (<= t_0 2e-242)
t_1
(if (<= t_0 1e+161)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_0 INFINITY) (/ (* (sqrt (/ h l)) d) h) t_1)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = fma((((((0.25 * D_m) * D_m) * M_m) * M_m) / d), (-0.5 * (h / l)), 1.0) * (d / sqrt((l * h)));
double tmp;
if (t_0 <= 2e-242) {
tmp = t_1;
} else if (t_0 <= 1e+161) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (sqrt((h / l)) * d) / h;
} else {
tmp = t_1;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(fma(Float64(Float64(Float64(Float64(Float64(0.25 * D_m) * D_m) * M_m) * M_m) / d), Float64(-0.5 * Float64(h / l)), 1.0) * Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= 2e-242) tmp = t_1; elseif (t_0 <= 1e+161) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_0 <= Inf) tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); else tmp = t_1; end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(N[(N[(0.25 * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] / d), $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-242], t$95$1, If[LessEqual[t$95$0, 1e+161], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \mathsf{fma}\left(\frac{\left(\left(\left(0.25 \cdot D\_m\right) \cdot D\_m\right) \cdot M\_m\right) \cdot M\_m}{d}, -0.5 \cdot \frac{h}{\ell}, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-242}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+161}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2e-242 or +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 55.5%
Applied rewrites19.4%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6419.4
Applied rewrites53.0%
Taylor expanded in M around 0
associate-*r*N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6449.0
Applied rewrites49.0%
if 2e-242 < (*.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)))) < 1e161Initial program 99.2%
Applied rewrites92.4%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
if 1e161 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 53.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6437.0
Applied rewrites37.0%
Applied rewrites37.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites48.9%
Taylor expanded in d around inf
Applied rewrites79.3%
Final simplification65.9%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(*
(* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
(/ h l)))))
(t_1 (/ d (sqrt (* l h)))))
(if (<= t_0 2e-242)
(*
(fma (* (* (* 0.25 D_m) D_m) (/ (* M_m M_m) d)) (* -0.5 (/ h l)) 1.0)
t_1)
(if (<= t_0 1e+161)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_0 INFINITY) (/ (* (sqrt (/ h l)) d) h) t_1)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = d / sqrt((l * h));
double tmp;
if (t_0 <= 2e-242) {
tmp = fma((((0.25 * D_m) * D_m) * ((M_m * M_m) / d)), (-0.5 * (h / l)), 1.0) * t_1;
} else if (t_0 <= 1e+161) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (sqrt((h / l)) * d) / h;
} else {
tmp = t_1;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (t_0 <= 2e-242) tmp = Float64(fma(Float64(Float64(Float64(0.25 * D_m) * D_m) * Float64(Float64(M_m * M_m) / d)), Float64(-0.5 * Float64(h / l)), 1.0) * t_1); elseif (t_0 <= 1e+161) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_0 <= Inf) tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); else tmp = t_1; end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-242], N[(N[(N[(N[(N[(0.25 * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 1e+161], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-242}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(0.25 \cdot D\_m\right) \cdot D\_m\right) \cdot \frac{M\_m \cdot M\_m}{d}, -0.5 \cdot \frac{h}{\ell}, 1\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+161}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2e-242Initial program 78.9%
Applied rewrites27.2%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lift-/.f64N/A
metadata-evalN/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6427.2
Applied rewrites64.6%
Taylor expanded in d around 0
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6456.5
Applied rewrites56.5%
if 2e-242 < (*.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)))) < 1e161Initial program 99.2%
Applied rewrites92.4%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
if 1e161 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 53.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6437.0
Applied rewrites37.0%
Applied rewrites37.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites48.9%
Taylor expanded in d around inf
Applied rewrites79.3%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6421.5
Applied rewrites21.5%
Applied rewrites21.5%
Final simplification64.3%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (/ d (sqrt (* l h))))
(t_1
(fma
(* (/ h l) (* (* 0.5 (/ D_m 2.0)) (/ M_m d)))
(* (/ D_m -2.0) (/ M_m d))
1.0))
(t_2
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(*
(* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
(/ h l))))))
(if (<= t_2 5e+260)
(* (* (sqrt (/ d h)) (sqrt (/ d l))) t_1)
(if (<= t_2 INFINITY)
(* (fabs t_0) t_1)
(fma
t_0
(* (* (/ (pow (* (/ M_m 2.0) D_m) 2.0) d) h) (/ -0.5 l))
t_0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d / sqrt((l * h));
double t_1 = fma(((h / l) * ((0.5 * (D_m / 2.0)) * (M_m / d))), ((D_m / -2.0) * (M_m / d)), 1.0);
double t_2 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_2 <= 5e+260) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * t_1;
} else if (t_2 <= ((double) INFINITY)) {
tmp = fabs(t_0) * t_1;
} else {
tmp = fma(t_0, (((pow(((M_m / 2.0) * D_m), 2.0) / d) * h) * (-0.5 / l)), t_0);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d / sqrt(Float64(l * h))) t_1 = fma(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D_m / 2.0)) * Float64(M_m / d))), Float64(Float64(D_m / -2.0) * Float64(M_m / d)), 1.0) t_2 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_2 <= 5e+260) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * t_1); elseif (t_2 <= Inf) tmp = Float64(abs(t_0) * t_1); else tmp = fma(t_0, Float64(Float64(Float64((Float64(Float64(M_m / 2.0) * D_m) ^ 2.0) / d) * h) * Float64(-0.5 / l)), t_0); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / -2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 5e+260], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[Abs[t$95$0], $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$0 * N[(N[(N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * D$95$m), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
t_1 := \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \frac{D\_m}{2}\right) \cdot \frac{M\_m}{d}\right), \frac{D\_m}{-2} \cdot \frac{M\_m}{d}, 1\right)\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_2 \leq 5 \cdot 10^{+260}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\left|t\_0\right| \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \left(\frac{{\left(\frac{M\_m}{2} \cdot D\_m\right)}^{2}}{d} \cdot h\right) \cdot \frac{-0.5}{\ell}, t\_0\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999996e260Initial program 87.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6487.0
Applied rewrites87.0%
Applied rewrites89.0%
lift-/.f64N/A
metadata-eval89.0
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6489.0
Applied rewrites89.0%
if 4.9999999999999996e260 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 41.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6441.1
Applied rewrites41.1%
Applied rewrites41.1%
lift-/.f64N/A
metadata-eval41.1
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6441.1
Applied rewrites41.1%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-square-revN/A
lower-fabs.f6499.7
Applied rewrites99.7%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Applied rewrites0.7%
Applied rewrites47.6%
Final simplification83.1%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(*
(* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
(/ h l))))))
(if (or (<= t_0 2e-242) (not (<= t_0 5e+260)))
(*
(fabs (/ d (sqrt (* l h))))
(fma
(* (/ h l) (* (* 0.5 (/ D_m 2.0)) (/ M_m d)))
(* (/ D_m -2.0) (/ M_m d))
1.0))
(* (sqrt (/ d l)) (sqrt (/ d h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if ((t_0 <= 2e-242) || !(t_0 <= 5e+260)) {
tmp = fabs((d / sqrt((l * h)))) * fma(((h / l) * ((0.5 * (D_m / 2.0)) * (M_m / d))), ((D_m / -2.0) * (M_m / d)), 1.0);
} else {
tmp = sqrt((d / l)) * sqrt((d / h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if ((t_0 <= 2e-242) || !(t_0 <= 5e+260)) tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * fma(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D_m / 2.0)) * Float64(M_m / d))), Float64(Float64(D_m / -2.0) * Float64(M_m / d)), 1.0)); else tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 2e-242], N[Not[LessEqual[t$95$0, 5e+260]], $MachinePrecision]], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / -2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-242} \lor \neg \left(t\_0 \leq 5 \cdot 10^{+260}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \frac{D\_m}{2}\right) \cdot \frac{M\_m}{d}\right), \frac{D\_m}{-2} \cdot \frac{M\_m}{d}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{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)))) < 2e-242 or 4.9999999999999996e260 < (*.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 53.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6453.0
Applied rewrites53.0%
Applied rewrites55.5%
lift-/.f64N/A
metadata-eval55.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6455.5
Applied rewrites55.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-square-revN/A
lower-fabs.f6472.4
Applied rewrites72.4%
if 2e-242 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999996e260Initial program 99.2%
Applied rewrites91.8%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
mul-1-negN/A
remove-double-negN/A
lower-sqrt.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
Final simplification79.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(fma
(* (/ h l) (* (* 0.5 (/ D_m 2.0)) (/ M_m d)))
(* (/ D_m -2.0) (/ M_m d))
1.0)))
(if (<=
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l))))
5e+260)
(* (* (sqrt (/ d h)) (sqrt (/ d l))) t_0)
(* (fabs (/ d (sqrt (* l h)))) t_0))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = fma(((h / l) * ((0.5 * (D_m / 2.0)) * (M_m / d))), ((D_m / -2.0) * (M_m / d)), 1.0);
double tmp;
if (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+260) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * t_0;
} else {
tmp = fabs((d / sqrt((l * h)))) * t_0;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = fma(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D_m / 2.0)) * Float64(M_m / d))), Float64(Float64(D_m / -2.0) * Float64(M_m / d)), 1.0) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+260) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * t_0); else tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * t_0); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / -2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+260], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \frac{D\_m}{2}\right) \cdot \frac{M\_m}{d}\right), \frac{D\_m}{-2} \cdot \frac{M\_m}{d}, 1\right)\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+260}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot 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)))) < 4.9999999999999996e260Initial program 87.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6487.0
Applied rewrites87.0%
Applied rewrites89.0%
lift-/.f64N/A
metadata-eval89.0
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6489.0
Applied rewrites89.0%
if 4.9999999999999996e260 < (*.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 17.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6417.4
Applied rewrites17.4%
Applied rewrites17.5%
lift-/.f64N/A
metadata-eval17.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6417.5
Applied rewrites17.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-square-revN/A
lower-fabs.f6458.0
Applied rewrites58.0%
Final simplification79.5%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(fma
(* (/ h l) (* (* 0.5 (/ D_m 2.0)) (/ M_m d)))
(* (/ D_m -2.0) (/ M_m d))
1.0)))
(if (<= d -1.2e-246)
(* (* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))) t_0)
(if (<= d 1.18e-200)
(/
(fma
(* (pow (/ h l) 1.5) (* (* D_m D_m) -0.125))
(* (/ M_m d) M_m)
(* (sqrt (/ h l)) d))
h)
(* (/ (/ d (sqrt l)) (sqrt h)) t_0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = fma(((h / l) * ((0.5 * (D_m / 2.0)) * (M_m / d))), ((D_m / -2.0) * (M_m / d)), 1.0);
double tmp;
if (d <= -1.2e-246) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * t_0;
} else if (d <= 1.18e-200) {
tmp = fma((pow((h / l), 1.5) * ((D_m * D_m) * -0.125)), ((M_m / d) * M_m), (sqrt((h / l)) * d)) / h;
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * t_0;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = fma(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D_m / 2.0)) * Float64(M_m / d))), Float64(Float64(D_m / -2.0) * Float64(M_m / d)), 1.0) tmp = 0.0 if (d <= -1.2e-246) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * t_0); elseif (d <= 1.18e-200) tmp = Float64(fma(Float64((Float64(h / l) ^ 1.5) * Float64(Float64(D_m * D_m) * -0.125)), Float64(Float64(M_m / d) * M_m), Float64(sqrt(Float64(h / l)) * d)) / h); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * t_0); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / -2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[d, -1.2e-246], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 1.18e-200], N[(N[(N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \frac{D\_m}{2}\right) \cdot \frac{M\_m}{d}\right), \frac{D\_m}{-2} \cdot \frac{M\_m}{d}, 1\right)\\
\mathbf{if}\;d \leq -1.2 \cdot 10^{-246}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_0\\
\mathbf{elif}\;d \leq 1.18 \cdot 10^{-200}:\\
\;\;\;\;\frac{\mathsf{fma}\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot -0.125\right), \frac{M\_m}{d} \cdot M\_m, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot t\_0\\
\end{array}
\end{array}
if d < -1.1999999999999999e-246Initial program 69.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6469.6
Applied rewrites69.6%
Applied rewrites71.9%
lift-/.f64N/A
metadata-eval71.9
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6485.0
Applied rewrites85.0%
if -1.1999999999999999e-246 < d < 1.17999999999999996e-200Initial program 34.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6415.5
Applied rewrites15.5%
Applied rewrites15.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites30.9%
Applied rewrites47.9%
if 1.17999999999999996e-200 < d Initial program 70.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6470.5
Applied rewrites70.5%
Applied rewrites71.5%
lift-/.f64N/A
metadata-eval71.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6471.5
Applied rewrites71.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6482.3
Applied rewrites82.3%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(fma
(* (/ h l) (* (* 0.5 (/ D_m 2.0)) (/ M_m d)))
(* (/ D_m -2.0) (/ M_m d))
1.0)))
(if (<= d -1.2e-246)
(* (* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))) t_0)
(if (<= d 1.18e-200)
(/
(fma
D_m
(* (* -0.125 D_m) (* (pow (/ h l) 1.5) (* (/ M_m d) M_m)))
(* (sqrt (/ h l)) d))
h)
(* (/ (/ d (sqrt l)) (sqrt h)) t_0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = fma(((h / l) * ((0.5 * (D_m / 2.0)) * (M_m / d))), ((D_m / -2.0) * (M_m / d)), 1.0);
double tmp;
if (d <= -1.2e-246) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * t_0;
} else if (d <= 1.18e-200) {
tmp = fma(D_m, ((-0.125 * D_m) * (pow((h / l), 1.5) * ((M_m / d) * M_m))), (sqrt((h / l)) * d)) / h;
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * t_0;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = fma(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D_m / 2.0)) * Float64(M_m / d))), Float64(Float64(D_m / -2.0) * Float64(M_m / d)), 1.0) tmp = 0.0 if (d <= -1.2e-246) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * t_0); elseif (d <= 1.18e-200) tmp = Float64(fma(D_m, Float64(Float64(-0.125 * D_m) * Float64((Float64(h / l) ^ 1.5) * Float64(Float64(M_m / d) * M_m))), Float64(sqrt(Float64(h / l)) * d)) / h); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * t_0); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / -2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[d, -1.2e-246], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 1.18e-200], N[(N[(D$95$m * N[(N[(-0.125 * D$95$m), $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \frac{D\_m}{2}\right) \cdot \frac{M\_m}{d}\right), \frac{D\_m}{-2} \cdot \frac{M\_m}{d}, 1\right)\\
\mathbf{if}\;d \leq -1.2 \cdot 10^{-246}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_0\\
\mathbf{elif}\;d \leq 1.18 \cdot 10^{-200}:\\
\;\;\;\;\frac{\mathsf{fma}\left(D\_m, \left(-0.125 \cdot D\_m\right) \cdot \left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \left(\frac{M\_m}{d} \cdot M\_m\right)\right), \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot t\_0\\
\end{array}
\end{array}
if d < -1.1999999999999999e-246Initial program 69.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6469.6
Applied rewrites69.6%
Applied rewrites71.9%
lift-/.f64N/A
metadata-eval71.9
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6485.0
Applied rewrites85.0%
if -1.1999999999999999e-246 < d < 1.17999999999999996e-200Initial program 34.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6415.5
Applied rewrites15.5%
Applied rewrites15.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites30.9%
Applied rewrites54.7%
if 1.17999999999999996e-200 < d Initial program 70.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6470.5
Applied rewrites70.5%
Applied rewrites71.5%
lift-/.f64N/A
metadata-eval71.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6471.5
Applied rewrites71.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6482.3
Applied rewrites82.3%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(fma
(* (/ h l) (* (* 0.5 (/ D_m 2.0)) (/ M_m d)))
(* (/ D_m -2.0) (/ M_m d))
1.0)))
(if (<= h -5e-310)
(* (* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))) t_0)
(* (/ (/ d (sqrt l)) (sqrt h)) t_0))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = fma(((h / l) * ((0.5 * (D_m / 2.0)) * (M_m / d))), ((D_m / -2.0) * (M_m / d)), 1.0);
double tmp;
if (h <= -5e-310) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * t_0;
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * t_0;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = fma(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D_m / 2.0)) * Float64(M_m / d))), Float64(Float64(D_m / -2.0) * Float64(M_m / d)), 1.0) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * t_0); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * t_0); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / -2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \frac{D\_m}{2}\right) \cdot \frac{M\_m}{d}\right), \frac{D\_m}{-2} \cdot \frac{M\_m}{d}, 1\right)\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot t\_0\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 66.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.7
Applied rewrites66.7%
Applied rewrites69.3%
lift-/.f64N/A
metadata-eval69.3
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6481.9
Applied rewrites81.9%
if -4.999999999999985e-310 < h Initial program 64.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6464.8
Applied rewrites64.8%
Applied rewrites64.8%
lift-/.f64N/A
metadata-eval64.8
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6464.8
Applied rewrites64.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6477.6
Applied rewrites77.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(fma
(* (/ h l) (* (* 0.5 (/ D_m 2.0)) (/ M_m d)))
(* (/ D_m -2.0) (/ M_m d))
1.0)))
(if (<= d 7.5e-211)
(* (fabs (/ d (sqrt (* l h)))) t_0)
(* (/ (/ d (sqrt l)) (sqrt h)) t_0))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = fma(((h / l) * ((0.5 * (D_m / 2.0)) * (M_m / d))), ((D_m / -2.0) * (M_m / d)), 1.0);
double tmp;
if (d <= 7.5e-211) {
tmp = fabs((d / sqrt((l * h)))) * t_0;
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * t_0;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = fma(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D_m / 2.0)) * Float64(M_m / d))), Float64(Float64(D_m / -2.0) * Float64(M_m / d)), 1.0) tmp = 0.0 if (d <= 7.5e-211) tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * t_0); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * t_0); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / -2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[d, 7.5e-211], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \frac{D\_m}{2}\right) \cdot \frac{M\_m}{d}\right), \frac{D\_m}{-2} \cdot \frac{M\_m}{d}, 1\right)\\
\mathbf{if}\;d \leq 7.5 \cdot 10^{-211}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot t\_0\\
\end{array}
\end{array}
if d < 7.5000000000000003e-211Initial program 62.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6462.8
Applied rewrites62.8%
Applied rewrites64.6%
lift-/.f64N/A
metadata-eval64.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6464.6
Applied rewrites64.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-square-revN/A
lower-fabs.f6476.3
Applied rewrites76.3%
if 7.5000000000000003e-211 < d Initial program 70.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6470.1
Applied rewrites70.1%
Applied rewrites71.1%
lift-/.f64N/A
metadata-eval71.1
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6471.1
Applied rewrites71.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
sqrt-divN/A
frac-timesN/A
rem-square-sqrtN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6481.7
Applied rewrites81.7%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (pow (* l h) -1.0))))
(if (<= l -6.5e-212)
(* (- d) t_0)
(if (<= l 1e-307) (* t_0 d) (/ d (* (sqrt l) (sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(pow((l * h), -1.0));
double tmp;
if (l <= -6.5e-212) {
tmp = -d * t_0;
} else if (l <= 1e-307) {
tmp = t_0 * d;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = private
M_m = private
NOTE: d, 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, h, l, m_m, d_m)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((l * h) ** (-1.0d0)))
if (l <= (-6.5d-212)) then
tmp = -d * t_0
else if (l <= 1d-307) then
tmp = t_0 * d
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(Math.pow((l * h), -1.0));
double tmp;
if (l <= -6.5e-212) {
tmp = -d * t_0;
} else if (l <= 1e-307) {
tmp = t_0 * d;
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(math.pow((l * h), -1.0)) tmp = 0 if l <= -6.5e-212: tmp = -d * t_0 elif l <= 1e-307: tmp = t_0 * d else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt((Float64(l * h) ^ -1.0)) tmp = 0.0 if (l <= -6.5e-212) tmp = Float64(Float64(-d) * t_0); elseif (l <= 1e-307) tmp = Float64(t_0 * d); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(((l * h) ^ -1.0));
tmp = 0.0;
if (l <= -6.5e-212)
tmp = -d * t_0;
elseif (l <= 1e-307)
tmp = t_0 * d;
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -6.5e-212], N[((-d) * t$95$0), $MachinePrecision], If[LessEqual[l, 1e-307], N[(t$95$0 * d), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{if}\;\ell \leq -6.5 \cdot 10^{-212}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{elif}\;\ell \leq 10^{-307}:\\
\;\;\;\;t\_0 \cdot d\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -6.5e-212Initial program 62.8%
Taylor expanded in l around -inf
*-commutativeN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6445.9
Applied rewrites45.9%
if -6.5e-212 < l < 9.99999999999999909e-308Initial program 80.7%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6440.2
Applied rewrites40.2%
if 9.99999999999999909e-308 < l Initial program 65.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6445.1
Applied rewrites45.1%
Applied rewrites45.2%
Applied rewrites51.5%
Final simplification47.9%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -2.5e-202)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= l 5.7e-259)
(/ (* (- d) (sqrt (/ h l))) h)
(/ d (* (sqrt l) (sqrt h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.5e-202) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (l <= 5.7e-259) {
tmp = (-d * sqrt((h / l))) / h;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = private
M_m = private
NOTE: d, 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, h, l, m_m, d_m)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-2.5d-202)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else if (l <= 5.7d-259) then
tmp = (-d * sqrt((h / l))) / h
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.5e-202) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else if (l <= 5.7e-259) {
tmp = (-d * Math.sqrt((h / l))) / h;
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -2.5e-202: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) elif l <= 5.7e-259: tmp = (-d * math.sqrt((h / l))) / h else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -2.5e-202) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (l <= 5.7e-259) tmp = Float64(Float64(Float64(-d) * sqrt(Float64(h / l))) / h); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -2.5e-202)
tmp = -d * sqrt(((l * h) ^ -1.0));
elseif (l <= 5.7e-259)
tmp = (-d * sqrt((h / l))) / h;
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -2.5e-202], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.7e-259], N[(N[((-d) * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{-202}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;\ell \leq 5.7 \cdot 10^{-259}:\\
\;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -2.49999999999999986e-202Initial program 63.0%
Taylor expanded in l around -inf
*-commutativeN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6445.9
Applied rewrites45.9%
if -2.49999999999999986e-202 < l < 5.69999999999999947e-259Initial program 83.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6432.1
Applied rewrites32.1%
Applied rewrites29.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites41.7%
Taylor expanded in l around -inf
Applied rewrites37.9%
if 5.69999999999999947e-259 < l Initial program 62.8%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6447.4
Applied rewrites47.4%
Applied rewrites47.5%
Applied rewrites53.4%
Final simplification48.0%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (sqrt (pow (* l h) -1.0)))) (if (<= l -6.5e-212) (* (- d) t_0) (* t_0 d))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(pow((l * h), -1.0));
double tmp;
if (l <= -6.5e-212) {
tmp = -d * t_0;
} else {
tmp = t_0 * d;
}
return tmp;
}
D_m = private
M_m = private
NOTE: d, 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, h, l, m_m, d_m)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((l * h) ** (-1.0d0)))
if (l <= (-6.5d-212)) then
tmp = -d * t_0
else
tmp = t_0 * d
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(Math.pow((l * h), -1.0));
double tmp;
if (l <= -6.5e-212) {
tmp = -d * t_0;
} else {
tmp = t_0 * d;
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(math.pow((l * h), -1.0)) tmp = 0 if l <= -6.5e-212: tmp = -d * t_0 else: tmp = t_0 * d return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt((Float64(l * h) ^ -1.0)) tmp = 0.0 if (l <= -6.5e-212) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(t_0 * d); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(((l * h) ^ -1.0));
tmp = 0.0;
if (l <= -6.5e-212)
tmp = -d * t_0;
else
tmp = t_0 * d;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -6.5e-212], N[((-d) * t$95$0), $MachinePrecision], N[(t$95$0 * d), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{if}\;\ell \leq -6.5 \cdot 10^{-212}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot d\\
\end{array}
\end{array}
if l < -6.5e-212Initial program 62.8%
Taylor expanded in l around -inf
*-commutativeN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6445.9
Applied rewrites45.9%
if -6.5e-212 < l Initial program 68.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6444.2
Applied rewrites44.2%
Final simplification45.0%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (/ (* (* M_m (* D_m 0.25)) h) (* d l)))
(t_1 (/ d (sqrt (* l h))))
(t_2 (* (/ D_m -2.0) (/ M_m d))))
(if (<= d 7.8e-165)
(* (fabs t_1) (fma (* (/ h l) (* (* 0.5 (/ D_m 2.0)) (/ M_m d))) t_2 1.0))
(if (<= d 5.8e+100)
(* (* (sqrt (/ d h)) (sqrt (/ d l))) (fma t_0 t_2 1.0))
(* (fma (* t_0 (/ D_m d)) (/ M_m -2.0) 1.0) t_1)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = ((M_m * (D_m * 0.25)) * h) / (d * l);
double t_1 = d / sqrt((l * h));
double t_2 = (D_m / -2.0) * (M_m / d);
double tmp;
if (d <= 7.8e-165) {
tmp = fabs(t_1) * fma(((h / l) * ((0.5 * (D_m / 2.0)) * (M_m / d))), t_2, 1.0);
} else if (d <= 5.8e+100) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * fma(t_0, t_2, 1.0);
} else {
tmp = fma((t_0 * (D_m / d)), (M_m / -2.0), 1.0) * t_1;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(Float64(M_m * Float64(D_m * 0.25)) * h) / Float64(d * l)) t_1 = Float64(d / sqrt(Float64(l * h))) t_2 = Float64(Float64(D_m / -2.0) * Float64(M_m / d)) tmp = 0.0 if (d <= 7.8e-165) tmp = Float64(abs(t_1) * fma(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D_m / 2.0)) * Float64(M_m / d))), t_2, 1.0)); elseif (d <= 5.8e+100) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * fma(t_0, t_2, 1.0)); else tmp = Float64(fma(Float64(t_0 * Float64(D_m / d)), Float64(M_m / -2.0), 1.0) * t_1); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(M$95$m * N[(D$95$m * 0.25), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(D$95$m / -2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, 7.8e-165], N[(N[Abs[t$95$1], $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.8e+100], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$2 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / -2.0), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{\left(M\_m \cdot \left(D\_m \cdot 0.25\right)\right) \cdot h}{d \cdot \ell}\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
t_2 := \frac{D\_m}{-2} \cdot \frac{M\_m}{d}\\
\mathbf{if}\;d \leq 7.8 \cdot 10^{-165}:\\
\;\;\;\;\left|t\_1\right| \cdot \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \frac{D\_m}{2}\right) \cdot \frac{M\_m}{d}\right), t\_2, 1\right)\\
\mathbf{elif}\;d \leq 5.8 \cdot 10^{+100}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(t\_0, t\_2, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \frac{D\_m}{d}, \frac{M\_m}{-2}, 1\right) \cdot t\_1\\
\end{array}
\end{array}
if d < 7.7999999999999997e-165Initial program 60.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6460.8
Applied rewrites60.8%
Applied rewrites62.4%
lift-/.f64N/A
metadata-eval62.4
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6462.4
Applied rewrites62.4%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-square-revN/A
lower-fabs.f6475.0
Applied rewrites75.0%
if 7.7999999999999997e-165 < d < 5.8000000000000001e100Initial program 82.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6482.6
Applied rewrites82.6%
Applied rewrites84.3%
lift-/.f64N/A
metadata-eval84.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6484.3
Applied rewrites84.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
metadata-evalN/A
lower-*.f6487.9
Applied rewrites87.9%
if 5.8000000000000001e100 < d Initial program 64.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6464.3
Applied rewrites64.3%
Applied rewrites64.5%
lift-/.f64N/A
metadata-eval64.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6464.5
Applied rewrites64.5%
Applied rewrites85.4%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (/ d (sqrt (* l h))))
(t_1 (/ (* (* M_m (* D_m 0.25)) h) (* d l))))
(if (<= d 2.7e-123)
(*
(fabs t_0)
(fma
(* (/ h l) (* (* 0.5 (/ D_m 2.0)) (/ M_m d)))
(* (/ D_m -2.0) (/ M_m d))
1.0))
(if (<= d 5.8e+100)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(fma (/ D_m d) (* (/ M_m -2.0) t_1) 1.0))
(* (fma (* t_1 (/ D_m d)) (/ M_m -2.0) 1.0) t_0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d / sqrt((l * h));
double t_1 = ((M_m * (D_m * 0.25)) * h) / (d * l);
double tmp;
if (d <= 2.7e-123) {
tmp = fabs(t_0) * fma(((h / l) * ((0.5 * (D_m / 2.0)) * (M_m / d))), ((D_m / -2.0) * (M_m / d)), 1.0);
} else if (d <= 5.8e+100) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * fma((D_m / d), ((M_m / -2.0) * t_1), 1.0);
} else {
tmp = fma((t_1 * (D_m / d)), (M_m / -2.0), 1.0) * t_0;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d / sqrt(Float64(l * h))) t_1 = Float64(Float64(Float64(M_m * Float64(D_m * 0.25)) * h) / Float64(d * l)) tmp = 0.0 if (d <= 2.7e-123) tmp = Float64(abs(t_0) * fma(Float64(Float64(h / l) * Float64(Float64(0.5 * Float64(D_m / 2.0)) * Float64(M_m / d))), Float64(Float64(D_m / -2.0) * Float64(M_m / d)), 1.0)); elseif (d <= 5.8e+100) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * fma(Float64(D_m / d), Float64(Float64(M_m / -2.0) * t_1), 1.0)); else tmp = Float64(fma(Float64(t_1 * Float64(D_m / d)), Float64(M_m / -2.0), 1.0) * t_0); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(M$95$m * N[(D$95$m * 0.25), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, 2.7e-123], N[(N[Abs[t$95$0], $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * N[(N[(0.5 * N[(D$95$m / 2.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / -2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.8e+100], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * N[(N[(M$95$m / -2.0), $MachinePrecision] * t$95$1), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$1 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / -2.0), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
t_1 := \frac{\left(M\_m \cdot \left(D\_m \cdot 0.25\right)\right) \cdot h}{d \cdot \ell}\\
\mathbf{if}\;d \leq 2.7 \cdot 10^{-123}:\\
\;\;\;\;\left|t\_0\right| \cdot \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\left(0.5 \cdot \frac{D\_m}{2}\right) \cdot \frac{M\_m}{d}\right), \frac{D\_m}{-2} \cdot \frac{M\_m}{d}, 1\right)\\
\mathbf{elif}\;d \leq 5.8 \cdot 10^{+100}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(\frac{D\_m}{d}, \frac{M\_m}{-2} \cdot t\_1, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \frac{D\_m}{d}, \frac{M\_m}{-2}, 1\right) \cdot t\_0\\
\end{array}
\end{array}
if d < 2.7000000000000001e-123Initial program 61.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6461.1
Applied rewrites61.1%
Applied rewrites62.6%
lift-/.f64N/A
metadata-eval62.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6462.6
Applied rewrites62.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
rem-sqrt-square-revN/A
lower-fabs.f6474.7
Applied rewrites74.7%
if 2.7000000000000001e-123 < d < 5.8000000000000001e100Initial program 84.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6484.5
Applied rewrites84.5%
Applied rewrites86.6%
lift-/.f64N/A
metadata-eval86.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6486.6
Applied rewrites86.6%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites88.6%
if 5.8000000000000001e100 < d Initial program 64.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6464.3
Applied rewrites64.3%
Applied rewrites64.5%
lift-/.f64N/A
metadata-eval64.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6464.5
Applied rewrites64.5%
Applied rewrites85.4%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (* (sqrt (pow (* l h) -1.0)) d))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return sqrt(pow((l * h), -1.0)) * d;
}
D_m = private
M_m = private
NOTE: d, 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, h, l, m_m, d_m)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = sqrt(((l * h) ** (-1.0d0))) * d
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return Math.sqrt(Math.pow((l * h), -1.0)) * d;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return math.sqrt(math.pow((l * h), -1.0)) * d
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(sqrt((Float64(l * h) ^ -1.0)) * d) end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = sqrt(((l * h) ^ -1.0)) * d;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d
\end{array}
Initial program 65.8%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6426.3
Applied rewrites26.3%
Final simplification26.3%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* l h))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d / sqrt((l * h));
}
D_m = private
M_m = private
NOTE: d, 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, h, l, m_m, d_m)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d / sqrt((l * h))
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d / Math.sqrt((l * h));
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d / math.sqrt((l * h))
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d / sqrt(Float64(l * h))) end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d / sqrt((l * h));
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 65.8%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6426.3
Applied rewrites26.3%
Applied rewrites26.0%
herbie shell --seed 2024361
(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)))))