
(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)));
}
real(8) function code(d, h, l, m, d_1)
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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
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 (* D_m (* M_m (/ 0.5 d))))
(t_1 (sqrt (- d)))
(t_2 (* h (/ M_m d))))
(if (<= l -4e-310)
(/
(*
(* (/ t_1 (sqrt (- l))) (fma (/ t_0 (- l)) (* (* 0.25 D_m) t_2) 1.0))
t_1)
(sqrt (- h)))
(if (<= l 1.3e-74)
(*
(-
1.0
(*
(/ (* (* (* D_m 0.5) 0.5) (/ M_m d)) (pow h -1.0))
(/ (* (* D_m (/ 0.5 d)) M_m) l)))
(* (sqrt (/ d l)) (/ (sqrt d) (sqrt h))))
(*
(sqrt (/ d h))
(*
(/ (sqrt d) (sqrt l))
(fma (/ t_0 l) (* (- 0.25) (* t_2 D_m)) 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 = D_m * (M_m * (0.5 / d));
double t_1 = sqrt(-d);
double t_2 = h * (M_m / d);
double tmp;
if (l <= -4e-310) {
tmp = (((t_1 / sqrt(-l)) * fma((t_0 / -l), ((0.25 * D_m) * t_2), 1.0)) * t_1) / sqrt(-h);
} else if (l <= 1.3e-74) {
tmp = (1.0 - (((((D_m * 0.5) * 0.5) * (M_m / d)) / pow(h, -1.0)) * (((D_m * (0.5 / d)) * M_m) / l))) * (sqrt((d / l)) * (sqrt(d) / sqrt(h)));
} else {
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * fma((t_0 / l), (-0.25 * (t_2 * D_m)), 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 = Float64(D_m * Float64(M_m * Float64(0.5 / d))) t_1 = sqrt(Float64(-d)) t_2 = Float64(h * Float64(M_m / d)) tmp = 0.0 if (l <= -4e-310) tmp = Float64(Float64(Float64(Float64(t_1 / sqrt(Float64(-l))) * fma(Float64(t_0 / Float64(-l)), Float64(Float64(0.25 * D_m) * t_2), 1.0)) * t_1) / sqrt(Float64(-h))); elseif (l <= 1.3e-74) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D_m * 0.5) * 0.5) * Float64(M_m / d)) / (h ^ -1.0)) * Float64(Float64(Float64(D_m * Float64(0.5 / d)) * M_m) / l))) * Float64(sqrt(Float64(d / l)) * Float64(sqrt(d) / sqrt(h)))); else tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(d) / sqrt(l)) * fma(Float64(t_0 / l), Float64(Float64(-0.25) * Float64(t_2 * D_m)), 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[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(N[(N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / (-l)), $MachinePrecision] * N[(N[(0.25 * D$95$m), $MachinePrecision] * t$95$2), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.3e-74], N[(N[(1.0 - N[(N[(N[(N[(N[(D$95$m * 0.5), $MachinePrecision] * 0.5), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] / N[Power[h, -1.0], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / l), $MachinePrecision] * N[((-0.25) * N[(t$95$2 * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $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 := D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\\
t_1 := \sqrt{-d}\\
t_2 := h \cdot \frac{M\_m}{d}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\frac{t\_1}{\sqrt{-\ell}} \cdot \mathsf{fma}\left(\frac{t\_0}{-\ell}, \left(0.25 \cdot D\_m\right) \cdot t\_2, 1\right)\right) \cdot t\_1}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-74}:\\
\;\;\;\;\left(1 - \frac{\left(\left(D\_m \cdot 0.5\right) \cdot 0.5\right) \cdot \frac{M\_m}{d}}{{h}^{-1}} \cdot \frac{\left(D\_m \cdot \frac{0.5}{d}\right) \cdot M\_m}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \mathsf{fma}\left(\frac{t\_0}{\ell}, \left(-0.25\right) \cdot \left(t\_2 \cdot D\_m\right), 1\right)\right)\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 67.8%
Applied rewrites72.7%
Applied rewrites73.6%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6482.6
Applied rewrites82.6%
if -3.999999999999988e-310 < l < 1.3e-74Initial program 70.5%
Applied rewrites73.2%
lift-/.f64N/A
metadata-eval73.2
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6473.2
Applied rewrites73.2%
lift-/.f64N/A
metadata-eval73.2
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
lower-sqrt.f6495.8
Applied rewrites95.8%
if 1.3e-74 < l Initial program 55.5%
Applied rewrites0.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6455.5
Applied rewrites55.5%
Applied rewrites58.4%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6469.1
Applied rewrites69.1%
Final simplification80.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
(*
(-
1.0
(* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ d h))))
(if (<= t_0 -2e+15)
(*
(* (/ (* (* (* (/ M_m d) M_m) h) (/ (* -0.125 (* D_m D_m)) l)) d) t_1)
t_2)
(if (<= t_0 5e+296) (* t_1 t_2) (/ 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 = (1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h));
double tmp;
if (t_0 <= -2e+15) {
tmp = ((((((M_m / d) * M_m) * h) * ((-0.125 * (D_m * D_m)) / l)) / d) * t_1) * t_2;
} else if (t_0 <= 5e+296) {
tmp = t_1 * t_2;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (1.0d0 - ((h / l) * ((((d_m * m_m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
t_1 = sqrt((d / l))
t_2 = sqrt((d / h))
if (t_0 <= (-2d+15)) then
tmp = ((((((m_m / d) * m_m) * h) * (((-0.125d0) * (d_m * d_m)) / l)) / d) * t_1) * t_2
else if (t_0 <= 5d+296) then
tmp = t_1 * t_2
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 = (1.0 - ((h / l) * (Math.pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)));
double t_1 = Math.sqrt((d / l));
double t_2 = Math.sqrt((d / h));
double tmp;
if (t_0 <= -2e+15) {
tmp = ((((((M_m / d) * M_m) * h) * ((-0.125 * (D_m * D_m)) / l)) / d) * t_1) * t_2;
} else if (t_0 <= 5e+296) {
tmp = t_1 * t_2;
} 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 = (1.0 - ((h / l) * (math.pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) t_1 = math.sqrt((d / l)) t_2 = math.sqrt((d / h)) tmp = 0 if t_0 <= -2e+15: tmp = ((((((M_m / d) * M_m) * h) * ((-0.125 * (D_m * D_m)) / l)) / d) * t_1) * t_2 elif t_0 <= 5e+296: tmp = t_1 * t_2 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 = Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(d / h)) tmp = 0.0 if (t_0 <= -2e+15) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(M_m / d) * M_m) * h) * Float64(Float64(-0.125 * Float64(D_m * D_m)) / l)) / d) * t_1) * t_2); elseif (t_0 <= 5e+296) tmp = Float64(t_1 * t_2); 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 = (1.0 - ((h / l) * ((((D_m * M_m) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
t_1 = sqrt((d / l));
t_2 = sqrt((d / h));
tmp = 0.0;
if (t_0 <= -2e+15)
tmp = ((((((M_m / d) * M_m) * h) * ((-0.125 * (D_m * D_m)) / l)) / d) * t_1) * t_2;
elseif (t_0 <= 5e+296)
tmp = t_1 * t_2;
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[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -2e+15], N[(N[(N[(N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] * h), $MachinePrecision] * N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 5e+296], N[(t$95$1 * t$95$2), $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 := \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+15}:\\
\;\;\;\;\left(\frac{\left(\left(\frac{M\_m}{d} \cdot M\_m\right) \cdot h\right) \cdot \frac{-0.125 \cdot \left(D\_m \cdot D\_m\right)}{\ell}}{d} \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+296}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{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)))) < -2e15Initial program 87.4%
Applied rewrites36.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6485.0
Applied rewrites85.1%
Taylor expanded in h around inf
associate-*r/N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6461.9
Applied rewrites61.9%
Applied rewrites68.1%
if -2e15 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e296Initial program 90.5%
Applied rewrites53.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6489.4
Applied rewrites89.4%
Taylor expanded in h around 0
lower-sqrt.f64N/A
lower-/.f6486.9
Applied rewrites86.9%
if 5.0000000000000001e296 < (*.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 12.0%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.7
Applied rewrites24.7%
Applied rewrites24.7%
Applied rewrites24.9%
Final simplification61.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
(*
(-
1.0
(* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ d h))))
(if (<= t_0 -2e+15)
(*
(* (/ (* (* (* (/ M_m d) M_m) h) (* -0.125 (* D_m D_m))) (* d l)) t_1)
t_2)
(if (<= t_0 5e+296) (* t_1 t_2) (/ 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 = (1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h));
double tmp;
if (t_0 <= -2e+15) {
tmp = ((((((M_m / d) * M_m) * h) * (-0.125 * (D_m * D_m))) / (d * l)) * t_1) * t_2;
} else if (t_0 <= 5e+296) {
tmp = t_1 * t_2;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (1.0d0 - ((h / l) * ((((d_m * m_m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
t_1 = sqrt((d / l))
t_2 = sqrt((d / h))
if (t_0 <= (-2d+15)) then
tmp = ((((((m_m / d) * m_m) * h) * ((-0.125d0) * (d_m * d_m))) / (d * l)) * t_1) * t_2
else if (t_0 <= 5d+296) then
tmp = t_1 * t_2
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 = (1.0 - ((h / l) * (Math.pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)));
double t_1 = Math.sqrt((d / l));
double t_2 = Math.sqrt((d / h));
double tmp;
if (t_0 <= -2e+15) {
tmp = ((((((M_m / d) * M_m) * h) * (-0.125 * (D_m * D_m))) / (d * l)) * t_1) * t_2;
} else if (t_0 <= 5e+296) {
tmp = t_1 * t_2;
} 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 = (1.0 - ((h / l) * (math.pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) t_1 = math.sqrt((d / l)) t_2 = math.sqrt((d / h)) tmp = 0 if t_0 <= -2e+15: tmp = ((((((M_m / d) * M_m) * h) * (-0.125 * (D_m * D_m))) / (d * l)) * t_1) * t_2 elif t_0 <= 5e+296: tmp = t_1 * t_2 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 = Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(d / h)) tmp = 0.0 if (t_0 <= -2e+15) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(M_m / d) * M_m) * h) * Float64(-0.125 * Float64(D_m * D_m))) / Float64(d * l)) * t_1) * t_2); elseif (t_0 <= 5e+296) tmp = Float64(t_1 * t_2); 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 = (1.0 - ((h / l) * ((((D_m * M_m) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
t_1 = sqrt((d / l));
t_2 = sqrt((d / h));
tmp = 0.0;
if (t_0 <= -2e+15)
tmp = ((((((M_m / d) * M_m) * h) * (-0.125 * (D_m * D_m))) / (d * l)) * t_1) * t_2;
elseif (t_0 <= 5e+296)
tmp = t_1 * t_2;
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[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -2e+15], N[(N[(N[(N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] * h), $MachinePrecision] * N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 5e+296], N[(t$95$1 * t$95$2), $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 := \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+15}:\\
\;\;\;\;\left(\frac{\left(\left(\frac{M\_m}{d} \cdot M\_m\right) \cdot h\right) \cdot \left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right)}{d \cdot \ell} \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+296}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{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)))) < -2e15Initial program 87.4%
Applied rewrites36.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6485.0
Applied rewrites85.1%
Taylor expanded in h around inf
associate-*r/N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6461.9
Applied rewrites61.9%
Applied rewrites65.6%
if -2e15 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e296Initial program 90.5%
Applied rewrites53.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6489.4
Applied rewrites89.4%
Taylor expanded in h around 0
lower-sqrt.f64N/A
lower-/.f6486.9
Applied rewrites86.9%
if 5.0000000000000001e296 < (*.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 12.0%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.7
Applied rewrites24.7%
Applied rewrites24.7%
Applied rewrites24.9%
Final simplification60.2%
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
(*
(-
1.0
(* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))))
(if (<= t_0 -5e+25)
(*
(/ (sqrt (/ h l)) (fabs l))
(* (/ (* M_m M_m) d) (* 0.125 (* D_m D_m))))
(if (<= t_0 5e+296)
(* (sqrt (/ d l)) (sqrt (/ d 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 t_0 = (1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double tmp;
if (t_0 <= -5e+25) {
tmp = (sqrt((h / l)) / fabs(l)) * (((M_m * M_m) / d) * (0.125 * (D_m * D_m)));
} else if (t_0 <= 5e+296) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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 = (1.0d0 - ((h / l) * ((((d_m * m_m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
if (t_0 <= (-5d+25)) then
tmp = (sqrt((h / l)) / abs(l)) * (((m_m * m_m) / d) * (0.125d0 * (d_m * d_m)))
else if (t_0 <= 5d+296) then
tmp = sqrt((d / l)) * sqrt((d / 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 t_0 = (1.0 - ((h / l) * (Math.pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)));
double tmp;
if (t_0 <= -5e+25) {
tmp = (Math.sqrt((h / l)) / Math.abs(l)) * (((M_m * M_m) / d) * (0.125 * (D_m * D_m)));
} else if (t_0 <= 5e+296) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / 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): t_0 = (1.0 - ((h / l) * (math.pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) tmp = 0 if t_0 <= -5e+25: tmp = (math.sqrt((h / l)) / math.fabs(l)) * (((M_m * M_m) / d) * (0.125 * (D_m * D_m))) elif t_0 <= 5e+296: tmp = math.sqrt((d / l)) * math.sqrt((d / 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) t_0 = Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) tmp = 0.0 if (t_0 <= -5e+25) tmp = Float64(Float64(sqrt(Float64(h / l)) / abs(l)) * Float64(Float64(Float64(M_m * M_m) / d) * Float64(0.125 * Float64(D_m * D_m)))); elseif (t_0 <= 5e+296) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / 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)
t_0 = (1.0 - ((h / l) * ((((D_m * M_m) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
tmp = 0.0;
if (t_0 <= -5e+25)
tmp = (sqrt((h / l)) / abs(l)) * (((M_m * M_m) / d) * (0.125 * (D_m * D_m)));
elseif (t_0 <= 5e+296)
tmp = sqrt((d / l)) * sqrt((d / 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_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+25], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / N[Abs[l], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision] * N[(0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+296], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $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 := \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+25}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}}}{\left|\ell\right|} \cdot \left(\frac{M\_m \cdot M\_m}{d} \cdot \left(0.125 \cdot \left(D\_m \cdot D\_m\right)\right)\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+296}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{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)))) < -5.00000000000000024e25Initial program 87.1%
Taylor expanded in h around -inf
associate-*r*N/A
lower-*.f64N/A
Applied rewrites26.7%
Applied rewrites33.0%
if -5.00000000000000024e25 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000001e296Initial program 90.7%
Applied rewrites52.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6489.6
Applied rewrites89.6%
Taylor expanded in h around 0
lower-sqrt.f64N/A
lower-/.f6485.1
Applied rewrites85.1%
if 5.0000000000000001e296 < (*.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 12.0%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.7
Applied rewrites24.7%
Applied rewrites24.7%
Applied rewrites24.9%
Final simplification49.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 (* D_m (* M_m (/ 0.5 d))))
(t_1 (sqrt (- d)))
(t_2 (* h (/ M_m d))))
(if (<= l -4e-310)
(/
(*
(* (/ t_1 (sqrt (- l))) (fma (/ t_0 (- l)) (* (* 0.25 D_m) t_2) 1.0))
t_1)
(sqrt (- h)))
(*
(* (fma (/ t_0 l) (* (- 0.25) (* t_2 D_m)) 1.0) (sqrt (/ d l)))
(/ (sqrt d) (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 = D_m * (M_m * (0.5 / d));
double t_1 = sqrt(-d);
double t_2 = h * (M_m / d);
double tmp;
if (l <= -4e-310) {
tmp = (((t_1 / sqrt(-l)) * fma((t_0 / -l), ((0.25 * D_m) * t_2), 1.0)) * t_1) / sqrt(-h);
} else {
tmp = (fma((t_0 / l), (-0.25 * (t_2 * D_m)), 1.0) * sqrt((d / l))) * (sqrt(d) / 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 = Float64(D_m * Float64(M_m * Float64(0.5 / d))) t_1 = sqrt(Float64(-d)) t_2 = Float64(h * Float64(M_m / d)) tmp = 0.0 if (l <= -4e-310) tmp = Float64(Float64(Float64(Float64(t_1 / sqrt(Float64(-l))) * fma(Float64(t_0 / Float64(-l)), Float64(Float64(0.25 * D_m) * t_2), 1.0)) * t_1) / sqrt(Float64(-h))); else tmp = Float64(Float64(fma(Float64(t_0 / l), Float64(Float64(-0.25) * Float64(t_2 * D_m)), 1.0) * sqrt(Float64(d / l))) * Float64(sqrt(d) / sqrt(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[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(N[(N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / (-l)), $MachinePrecision] * N[(N[(0.25 * D$95$m), $MachinePrecision] * t$95$2), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * N[((-0.25) * N[(t$95$2 * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $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 := D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)\\
t_1 := \sqrt{-d}\\
t_2 := h \cdot \frac{M\_m}{d}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\frac{t\_1}{\sqrt{-\ell}} \cdot \mathsf{fma}\left(\frac{t\_0}{-\ell}, \left(0.25 \cdot D\_m\right) \cdot t\_2, 1\right)\right) \cdot t\_1}{\sqrt{-h}}\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{t\_0}{\ell}, \left(-0.25\right) \cdot \left(t\_2 \cdot D\_m\right), 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 67.8%
Applied rewrites72.7%
Applied rewrites73.6%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6482.6
Applied rewrites82.6%
if -3.999999999999988e-310 < l Initial program 60.9%
Applied rewrites0.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6460.2
Applied rewrites60.2%
Applied rewrites62.2%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6474.8
Applied rewrites74.8%
Final simplification78.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
(fma
(/ (* D_m (* M_m (/ 0.5 d))) l)
(* (- 0.25) (* (* h (/ M_m d)) D_m))
1.0)))
(if (<= l -4e-310)
(* (* t_0 (/ (sqrt (- d)) (sqrt (- l)))) (sqrt (/ d h)))
(* (* t_0 (sqrt (/ d l))) (/ (sqrt d) (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 = fma(((D_m * (M_m * (0.5 / d))) / l), (-0.25 * ((h * (M_m / d)) * D_m)), 1.0);
double tmp;
if (l <= -4e-310) {
tmp = (t_0 * (sqrt(-d) / sqrt(-l))) * sqrt((d / h));
} else {
tmp = (t_0 * sqrt((d / l))) * (sqrt(d) / 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 = fma(Float64(Float64(D_m * Float64(M_m * Float64(0.5 / d))) / l), Float64(Float64(-0.25) * Float64(Float64(h * Float64(M_m / d)) * D_m)), 1.0) tmp = 0.0 if (l <= -4e-310) tmp = Float64(Float64(t_0 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * sqrt(Float64(d / h))); else tmp = Float64(Float64(t_0 * sqrt(Float64(d / l))) * Float64(sqrt(d) / sqrt(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[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[((-0.25) * N[(N[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(N[(t$95$0 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $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 := \mathsf{fma}\left(\frac{D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)}{\ell}, \left(-0.25\right) \cdot \left(\left(h \cdot \frac{M\_m}{d}\right) \cdot D\_m\right), 1\right)\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\left(t\_0 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 67.8%
Applied rewrites72.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
Applied rewrites67.3%
lift-sqrt.f64N/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.f6475.9
Applied rewrites75.9%
if -3.999999999999988e-310 < l Initial program 60.9%
Applied rewrites0.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6460.2
Applied rewrites60.2%
Applied rewrites62.2%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6474.8
Applied rewrites74.8%
Final simplification75.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 (sqrt (/ d l))) (t_1 (* (* h (/ M_m d)) D_m)))
(if (<= h -5e-310)
(*
(fma (/ (* (* D_m (/ 0.5 d)) M_m) l) (* -0.25 t_1) 1.0)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0))
(*
(* (fma (/ (* D_m (* M_m (/ 0.5 d))) l) (* (- 0.25) t_1) 1.0) t_0)
(/ (sqrt d) (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((d / l));
double t_1 = (h * (M_m / d)) * D_m;
double tmp;
if (h <= -5e-310) {
tmp = fma((((D_m * (0.5 / d)) * M_m) / l), (-0.25 * t_1), 1.0) * ((sqrt(-d) / sqrt(-h)) * t_0);
} else {
tmp = (fma(((D_m * (M_m * (0.5 / d))) / l), (-0.25 * t_1), 1.0) * t_0) * (sqrt(d) / 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(d / l)) t_1 = Float64(Float64(h * Float64(M_m / d)) * D_m) tmp = 0.0 if (h <= -5e-310) tmp = Float64(fma(Float64(Float64(Float64(D_m * Float64(0.5 / d)) * M_m) / l), Float64(-0.25 * t_1), 1.0) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0)); else tmp = Float64(Float64(fma(Float64(Float64(D_m * Float64(M_m * Float64(0.5 / d))) / l), Float64(Float64(-0.25) * t_1), 1.0) * t_0) * Float64(sqrt(d) / sqrt(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[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(N[(N[(N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] / l), $MachinePrecision] * N[(-0.25 * t$95$1), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[((-0.25) * t$95$1), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(N[Sqrt[d], $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{\frac{d}{\ell}}\\
t_1 := \left(h \cdot \frac{M\_m}{d}\right) \cdot D\_m\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot \frac{0.5}{d}\right) \cdot M\_m}{\ell}, -0.25 \cdot t\_1, 1\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)}{\ell}, \left(-0.25\right) \cdot t\_1, 1\right) \cdot t\_0\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 67.8%
Applied rewrites68.8%
lift-/.f64N/A
metadata-eval68.8
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6468.8
Applied rewrites68.8%
lift-/.f64N/A
metadata-eval68.8
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lower-/.f6475.7
Applied rewrites75.7%
Applied rewrites73.4%
if -4.999999999999985e-310 < h Initial program 60.9%
Applied rewrites0.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6460.2
Applied rewrites60.2%
Applied rewrites62.2%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6474.8
Applied rewrites74.8%
Final simplification74.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 (* h (/ M_m d))) (t_1 (sqrt (/ d l))))
(if (<= d -2.1e-303)
(/
(*
(*
(fma (/ (* (* M_m 0.5) D_m) (* (- d) l)) (* (* 0.25 D_m) t_0) 1.0)
t_1)
(sqrt (- d)))
(sqrt (- h)))
(*
(*
(fma (/ (* D_m (* M_m (/ 0.5 d))) l) (* (- 0.25) (* t_0 D_m)) 1.0)
t_1)
(/ (sqrt d) (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 = h * (M_m / d);
double t_1 = sqrt((d / l));
double tmp;
if (d <= -2.1e-303) {
tmp = ((fma((((M_m * 0.5) * D_m) / (-d * l)), ((0.25 * D_m) * t_0), 1.0) * t_1) * sqrt(-d)) / sqrt(-h);
} else {
tmp = (fma(((D_m * (M_m * (0.5 / d))) / l), (-0.25 * (t_0 * D_m)), 1.0) * t_1) * (sqrt(d) / 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 = Float64(h * Float64(M_m / d)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -2.1e-303) tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(M_m * 0.5) * D_m) / Float64(Float64(-d) * l)), Float64(Float64(0.25 * D_m) * t_0), 1.0) * t_1) * sqrt(Float64(-d))) / sqrt(Float64(-h))); else tmp = Float64(Float64(fma(Float64(Float64(D_m * Float64(M_m * Float64(0.5 / d))) / l), Float64(Float64(-0.25) * Float64(t_0 * D_m)), 1.0) * t_1) * Float64(sqrt(d) / sqrt(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[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.1e-303], N[(N[(N[(N[(N[(N[(N[(M$95$m * 0.5), $MachinePrecision] * D$95$m), $MachinePrecision] / N[((-d) * l), $MachinePrecision]), $MachinePrecision] * N[(N[(0.25 * D$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[((-0.25) * N[(t$95$0 * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(N[Sqrt[d], $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 := h \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -2.1 \cdot 10^{-303}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{\left(M\_m \cdot 0.5\right) \cdot D\_m}{\left(-d\right) \cdot \ell}, \left(0.25 \cdot D\_m\right) \cdot t\_0, 1\right) \cdot t\_1\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)}{\ell}, \left(-0.25\right) \cdot \left(t\_0 \cdot D\_m\right), 1\right) \cdot t\_1\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -2.1e-303Initial program 68.3%
Applied rewrites73.2%
Applied rewrites74.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
lower-/.f64N/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6470.9
Applied rewrites70.9%
if -2.1e-303 < d Initial program 60.5%
Applied rewrites0.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
Applied rewrites61.7%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6474.2
Applied rewrites74.2%
Final simplification72.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 (* h (/ M_m d))) (t_1 (sqrt (/ d l))))
(if (<= l -1.45e-125)
(/
(*
(*
(fma (/ (* (* M_m 0.5) D_m) (* (- d) l)) (* (* 0.25 D_m) t_0) 1.0)
t_1)
(sqrt (- d)))
(sqrt (- h)))
(if (<= l 4.2e+217)
(*
(* (fma (/ (* D_m (* M_m (/ 0.5 d))) l) (* (* -0.25 D_m) t_0) 1.0) t_1)
(sqrt (/ d 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 t_0 = h * (M_m / d);
double t_1 = sqrt((d / l));
double tmp;
if (l <= -1.45e-125) {
tmp = ((fma((((M_m * 0.5) * D_m) / (-d * l)), ((0.25 * D_m) * t_0), 1.0) * t_1) * sqrt(-d)) / sqrt(-h);
} else if (l <= 4.2e+217) {
tmp = (fma(((D_m * (M_m * (0.5 / d))) / l), ((-0.25 * D_m) * t_0), 1.0) * t_1) * sqrt((d / h));
} else {
tmp = d / (sqrt(l) * 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 = Float64(h * Float64(M_m / d)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1.45e-125) tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(M_m * 0.5) * D_m) / Float64(Float64(-d) * l)), Float64(Float64(0.25 * D_m) * t_0), 1.0) * t_1) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (l <= 4.2e+217) tmp = Float64(Float64(fma(Float64(Float64(D_m * Float64(M_m * Float64(0.5 / d))) / l), Float64(Float64(-0.25 * D_m) * t_0), 1.0) * t_1) * sqrt(Float64(d / h))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(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[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.45e-125], N[(N[(N[(N[(N[(N[(N[(M$95$m * 0.5), $MachinePrecision] * D$95$m), $MachinePrecision] / N[((-d) * l), $MachinePrecision]), $MachinePrecision] * N[(N[(0.25 * D$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.2e+217], N[(N[(N[(N[(N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(-0.25 * D$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $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 := h \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1.45 \cdot 10^{-125}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{\left(M\_m \cdot 0.5\right) \cdot D\_m}{\left(-d\right) \cdot \ell}, \left(0.25 \cdot D\_m\right) \cdot t\_0, 1\right) \cdot t\_1\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+217}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)}{\ell}, \left(-0.25 \cdot D\_m\right) \cdot t\_0, 1\right) \cdot t\_1\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.4500000000000001e-125Initial program 64.1%
Applied rewrites70.4%
Applied rewrites70.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
lower-/.f64N/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6469.3
Applied rewrites69.3%
if -1.4500000000000001e-125 < l < 4.2000000000000002e217Initial program 69.6%
Applied rewrites16.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6468.9
Applied rewrites68.9%
Applied rewrites71.4%
lift-neg.f64N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval71.4
Applied rewrites71.4%
if 4.2000000000000002e217 < l Initial program 19.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6461.2
Applied rewrites61.2%
Applied rewrites61.1%
Applied rewrites63.1%
Final simplification70.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
(if (<= l 4.2e+217)
(*
(*
(fma
(/ (* D_m (* M_m (/ 0.5 d))) l)
(* (* -0.25 D_m) (* h (/ M_m d)))
1.0)
(sqrt (/ d l)))
(sqrt (/ d 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 <= 4.2e+217) {
tmp = (fma(((D_m * (M_m * (0.5 / d))) / l), ((-0.25 * D_m) * (h * (M_m / d))), 1.0) * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = d / (sqrt(l) * 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 <= 4.2e+217) tmp = Float64(Float64(fma(Float64(Float64(D_m * Float64(M_m * Float64(0.5 / d))) / l), Float64(Float64(-0.25 * D_m) * Float64(h * Float64(M_m / d))), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(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_] := If[LessEqual[l, 4.2e+217], N[(N[(N[(N[(N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(-0.25 * D$95$m), $MachinePrecision] * N[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $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 4.2 \cdot 10^{+217}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{D\_m \cdot \left(M\_m \cdot \frac{0.5}{d}\right)}{\ell}, \left(-0.25 \cdot D\_m\right) \cdot \left(h \cdot \frac{M\_m}{d}\right), 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 4.2000000000000002e217Initial program 67.3%
Applied rewrites38.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6466.6
Applied rewrites66.6%
Applied rewrites67.7%
lift-neg.f64N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval67.7
Applied rewrites67.7%
if 4.2000000000000002e217 < l Initial program 19.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6461.2
Applied rewrites61.2%
Applied rewrites61.1%
Applied rewrites63.1%
Final simplification67.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
(if (<= l 2.6e+214)
(*
(*
(fma
(* (* D_m (/ 0.5 d)) M_m)
(/ (* -0.25 (* (* h (/ M_m d)) D_m)) l)
1.0)
(sqrt (/ d l)))
(sqrt (/ d 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.6e+214) {
tmp = (fma(((D_m * (0.5 / d)) * M_m), ((-0.25 * ((h * (M_m / d)) * D_m)) / l), 1.0) * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = d / (sqrt(l) * 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.6e+214) tmp = Float64(Float64(fma(Float64(Float64(D_m * Float64(0.5 / d)) * M_m), Float64(Float64(-0.25 * Float64(Float64(h * Float64(M_m / d)) * D_m)) / l), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(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_] := If[LessEqual[l, 2.6e+214], N[(N[(N[(N[(N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[(-0.25 * N[(N[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $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.6 \cdot 10^{+214}:\\
\;\;\;\;\left(\mathsf{fma}\left(\left(D\_m \cdot \frac{0.5}{d}\right) \cdot M\_m, \frac{-0.25 \cdot \left(\left(h \cdot \frac{M\_m}{d}\right) \cdot D\_m\right)}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 2.59999999999999993e214Initial program 67.9%
Applied rewrites38.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6467.1
Applied rewrites67.1%
Applied rewrites68.2%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites67.4%
if 2.59999999999999993e214 < l Initial program 17.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6454.7
Applied rewrites54.7%
Applied rewrites54.6%
Applied rewrites56.4%
Final simplification66.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
(if (<= l 4.2e+217)
(*
(*
(fma
(/ (* (* M_m 0.5) D_m) (* d l))
(* (- 0.25) (* (* h (/ M_m d)) D_m))
1.0)
(sqrt (/ d l)))
(sqrt (/ d 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 <= 4.2e+217) {
tmp = (fma((((M_m * 0.5) * D_m) / (d * l)), (-0.25 * ((h * (M_m / d)) * D_m)), 1.0) * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = d / (sqrt(l) * 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 <= 4.2e+217) tmp = Float64(Float64(fma(Float64(Float64(Float64(M_m * 0.5) * D_m) / Float64(d * l)), Float64(Float64(-0.25) * Float64(Float64(h * Float64(M_m / d)) * D_m)), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(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_] := If[LessEqual[l, 4.2e+217], N[(N[(N[(N[(N[(N[(M$95$m * 0.5), $MachinePrecision] * D$95$m), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] * N[((-0.25) * N[(N[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $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 4.2 \cdot 10^{+217}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(M\_m \cdot 0.5\right) \cdot D\_m}{d \cdot \ell}, \left(-0.25\right) \cdot \left(\left(h \cdot \frac{M\_m}{d}\right) \cdot D\_m\right), 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 4.2000000000000002e217Initial program 67.3%
Applied rewrites38.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-neg.f64N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
unpow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6466.6
Applied rewrites66.6%
Applied rewrites67.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6463.9
Applied rewrites63.9%
if 4.2000000000000002e217 < l Initial program 19.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6461.2
Applied rewrites61.2%
Applied rewrites61.1%
Applied rewrites63.1%
Final simplification63.8%
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 -1.55e-291)
(/ (* (sqrt (/ d l)) (sqrt (- d))) (sqrt (- h)))
(if (<= l 1.8e-262)
(/ (* (sqrt (/ h l)) (- d)) 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 <= -1.55e-291) {
tmp = (sqrt((d / l)) * sqrt(-d)) / sqrt(-h);
} else if (l <= 1.8e-262) {
tmp = (sqrt((h / l)) * -d) / h;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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 <= (-1.55d-291)) then
tmp = (sqrt((d / l)) * sqrt(-d)) / sqrt(-h)
else if (l <= 1.8d-262) then
tmp = (sqrt((h / l)) * -d) / 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 <= -1.55e-291) {
tmp = (Math.sqrt((d / l)) * Math.sqrt(-d)) / Math.sqrt(-h);
} else if (l <= 1.8e-262) {
tmp = (Math.sqrt((h / l)) * -d) / 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 <= -1.55e-291: tmp = (math.sqrt((d / l)) * math.sqrt(-d)) / math.sqrt(-h) elif l <= 1.8e-262: tmp = (math.sqrt((h / l)) * -d) / 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 <= -1.55e-291) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (l <= 1.8e-262) tmp = Float64(Float64(sqrt(Float64(h / l)) * Float64(-d)) / 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 <= -1.55e-291)
tmp = (sqrt((d / l)) * sqrt(-d)) / sqrt(-h);
elseif (l <= 1.8e-262)
tmp = (sqrt((h / l)) * -d) / 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, -1.55e-291], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.8e-262], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * (-d)), $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 -1.55 \cdot 10^{-291}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}} \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{-262}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \left(-d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.55000000000000006e-291Initial program 67.3%
Applied rewrites72.2%
Taylor expanded in h around 0
lower-sqrt.f64N/A
lower-/.f6447.3
Applied rewrites47.3%
if -1.55000000000000006e-291 < l < 1.7999999999999999e-262Initial program 85.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites42.9%
Taylor expanded in l around -inf
Applied rewrites58.5%
if 1.7999999999999999e-262 < l Initial program 58.6%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.2
Applied rewrites42.2%
Applied rewrites42.2%
Applied rewrites47.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
(if (<= l -1.55e-291)
(* (sqrt (/ 1.0 (* h l))) (- d))
(if (<= l 1.8e-262)
(/ (* (sqrt (/ h l)) (- d)) 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 <= -1.55e-291) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else if (l <= 1.8e-262) {
tmp = (sqrt((h / l)) * -d) / h;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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 <= (-1.55d-291)) then
tmp = sqrt((1.0d0 / (h * l))) * -d
else if (l <= 1.8d-262) then
tmp = (sqrt((h / l)) * -d) / 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 <= -1.55e-291) {
tmp = Math.sqrt((1.0 / (h * l))) * -d;
} else if (l <= 1.8e-262) {
tmp = (Math.sqrt((h / l)) * -d) / 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 <= -1.55e-291: tmp = math.sqrt((1.0 / (h * l))) * -d elif l <= 1.8e-262: tmp = (math.sqrt((h / l)) * -d) / 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 <= -1.55e-291) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)); elseif (l <= 1.8e-262) tmp = Float64(Float64(sqrt(Float64(h / l)) * Float64(-d)) / 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 <= -1.55e-291)
tmp = sqrt((1.0 / (h * l))) * -d;
elseif (l <= 1.8e-262)
tmp = (sqrt((h / l)) * -d) / 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, -1.55e-291], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[l, 1.8e-262], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * (-d)), $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 -1.55 \cdot 10^{-291}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{-262}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \left(-d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.55000000000000006e-291Initial program 67.3%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.9
Applied rewrites46.9%
if -1.55000000000000006e-291 < l < 1.7999999999999999e-262Initial program 85.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites42.9%
Taylor expanded in l around -inf
Applied rewrites58.5%
if 1.7999999999999999e-262 < l Initial program 58.6%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.2
Applied rewrites42.2%
Applied rewrites42.2%
Applied rewrites47.4%
Final simplification47.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 (if (<= l 4.8e-248) (* (sqrt (/ 1.0 (* h l))) (- 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 tmp;
if (l <= 4.8e-248) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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 <= 4.8d-248) then
tmp = sqrt((1.0d0 / (h * l))) * -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 tmp;
if (l <= 4.8e-248) {
tmp = Math.sqrt((1.0 / (h * l))) * -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): tmp = 0 if l <= 4.8e-248: tmp = math.sqrt((1.0 / (h * l))) * -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) tmp = 0.0 if (l <= 4.8e-248) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-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)
tmp = 0.0;
if (l <= 4.8e-248)
tmp = sqrt((1.0 / (h * l))) * -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_] := If[LessEqual[l, 4.8e-248], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-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}
\mathbf{if}\;\ell \leq 4.8 \cdot 10^{-248}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 4.80000000000000006e-248Initial program 69.1%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6444.3
Applied rewrites44.3%
if 4.80000000000000006e-248 < l Initial program 58.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.5
Applied rewrites42.5%
Applied rewrites42.4%
Applied rewrites47.8%
Final simplification45.8%
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 (/ 1.0 (* h l))))) (if (<= l -7e-278) (* t_0 (- d)) (* 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((1.0 / (h * l)));
double tmp;
if (l <= -7e-278) {
tmp = t_0 * -d;
} else {
tmp = t_0 * d;
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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((1.0d0 / (h * l)))
if (l <= (-7d-278)) then
tmp = t_0 * -d
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((1.0 / (h * l)));
double tmp;
if (l <= -7e-278) {
tmp = t_0 * -d;
} 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((1.0 / (h * l))) tmp = 0 if l <= -7e-278: tmp = t_0 * -d 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(1.0 / Float64(h * l))) tmp = 0.0 if (l <= -7e-278) tmp = Float64(t_0 * Float64(-d)); 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((1.0 / (h * l)));
tmp = 0.0;
if (l <= -7e-278)
tmp = t_0 * -d;
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[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -7e-278], N[(t$95$0 * (-d)), $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{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;\ell \leq -7 \cdot 10^{-278}:\\
\;\;\;\;t\_0 \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot d\\
\end{array}
\end{array}
if l < -6.99999999999999941e-278Initial program 66.2%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6448.3
Applied rewrites48.3%
if -6.99999999999999941e-278 < l Initial program 62.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6440.3
Applied rewrites40.3%
Final simplification44.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 (* (sqrt (/ 1.0 (* h l))) 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((1.0 / (h * l))) * d;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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((1.0d0 / (h * l))) * 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((1.0 / (h * l))) * 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((1.0 / (h * l))) * 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(1.0 / Float64(h * l))) * 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((1.0 / (h * l))) * 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[(1.0 / N[(h * l), $MachinePrecision]), $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{\frac{1}{h \cdot \ell}} \cdot d
\end{array}
Initial program 64.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.9
Applied rewrites24.9%
Final simplification24.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 (/ d (sqrt (* h l))))
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((h * l));
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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((h * l))
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((h * l));
}
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((h * l))
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(h * l))) 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((h * l));
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[(h * l), $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{h \cdot \ell}}
\end{array}
Initial program 64.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.9
Applied rewrites24.9%
Applied rewrites24.9%
Final simplification24.9%
herbie shell --seed 2024284
(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)))))