
(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 19 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
(if (<= l -2e-311)
(*
(* (* (sqrt (- d)) (sqrt (/ -1.0 h))) (sqrt (/ d l)))
(+ 1.0 (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))
(if (<= l 1.75e+62)
(*
(/ d (sqrt (* l h)))
(-
1.0
(* h (/ (* (* M_m D_m) (* (/ (* M_m D_m) d) 0.25)) (* d (* l 2.0))))))
(/
(*
(fma (- D_m) (/ (* (* h 0.125) (* D_m (* M_m M_m))) (* d (* l d))) 1.0)
(/ 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 <= -2e-311) {
tmp = ((sqrt(-d) * sqrt((-1.0 / h))) * sqrt((d / l))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
} else if (l <= 1.75e+62) {
tmp = (d / sqrt((l * h))) * (1.0 - (h * (((M_m * D_m) * (((M_m * D_m) / d) * 0.25)) / (d * (l * 2.0)))));
} else {
tmp = (fma(-D_m, (((h * 0.125) * (D_m * (M_m * M_m))) / (d * (l * d))), 1.0) * (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 <= -2e-311) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) * sqrt(Float64(-1.0 / h))) * sqrt(Float64(d / l))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))); elseif (l <= 1.75e+62) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 - Float64(h * Float64(Float64(Float64(M_m * D_m) * Float64(Float64(Float64(M_m * D_m) / d) * 0.25)) / Float64(d * Float64(l * 2.0)))))); else tmp = Float64(Float64(fma(Float64(-D_m), Float64(Float64(Float64(h * 0.125) * Float64(D_m * Float64(M_m * M_m))) / Float64(d * Float64(l * d))), 1.0) * Float64(d / 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, -2e-311], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(-1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.75e+62], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-D$95$m) * N[(N[(N[(h * 0.125), $MachinePrecision] * N[(D$95$m * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $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 \cdot 10^{-311}:\\
\;\;\;\;\left(\left(\sqrt{-d} \cdot \sqrt{\frac{-1}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.75 \cdot 10^{+62}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - h \cdot \frac{\left(M\_m \cdot D\_m\right) \cdot \left(\frac{M\_m \cdot D\_m}{d} \cdot 0.25\right)}{d \cdot \left(\ell \cdot 2\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-D\_m, \frac{\left(h \cdot 0.125\right) \cdot \left(D\_m \cdot \left(M\_m \cdot M\_m\right)\right)}{d \cdot \left(\ell \cdot d\right)}, 1\right) \cdot \frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.9999999999999e-311Initial program 72.5%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6483.6
Applied egg-rr83.6%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6483.6
Applied egg-rr83.6%
if -1.9999999999999e-311 < l < 1.74999999999999992e62Initial program 72.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr79.1%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6479.1
Applied egg-rr79.1%
Applied egg-rr75.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied egg-rr91.7%
if 1.74999999999999992e62 < l Initial program 56.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6443.5
Simplified43.5%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6453.8
Applied egg-rr53.8%
Applied egg-rr64.7%
Final simplification82.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
(*
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0))))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))))
(if (<= t_0 0.0)
(* (sqrt (/ h (* l (* l l)))) (* 0.125 (* D_m (* D_m (/ (* M_m M_m) d)))))
(if (<= t_0 4e+281)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(* (- d) (sqrt (/ 1.0 (* 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) {
double t_0 = (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)));
double tmp;
if (t_0 <= 0.0) {
tmp = sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else if (t_0 <= 4e+281) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = -d * sqrt((1.0 / (l * 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) * ((((m_m * d_m) / (d * 2.0d0)) ** 2.0d0) * ((-1.0d0) / 2.0d0)))) * (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0)))
if (t_0 <= 0.0d0) then
tmp = sqrt((h / (l * (l * l)))) * (0.125d0 * (d_m * (d_m * ((m_m * m_m) / d))))
else if (t_0 <= 4d+281) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = -d * sqrt((1.0d0 / (l * 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(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) * (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0)));
double tmp;
if (t_0 <= 0.0) {
tmp = Math.sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else if (t_0 <= 4e+281) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = -d * Math.sqrt((1.0 / (l * 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(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) * (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) tmp = 0 if t_0 <= 0.0: tmp = math.sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d)))) elif t_0 <= 4e+281: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = -d * math.sqrt((1.0 / (l * 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(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(0.125 * Float64(D_m * Float64(D_m * Float64(Float64(M_m * M_m) / d))))); elseif (t_0 <= 4e+281) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * 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) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0)))) * (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0)));
tmp = 0.0;
if (t_0 <= 0.0)
tmp = sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
elseif (t_0 <= 4e+281)
tmp = sqrt((d / l)) * sqrt((d / h));
else
tmp = -d * sqrt((1.0 / (l * 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[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 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]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(D$95$m * N[(D$95$m * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+281], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $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{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(0.125 \cdot \left(D\_m \cdot \left(D\_m \cdot \frac{M\_m \cdot M\_m}{d}\right)\right)\right)\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+281}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 84.2%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6460.5
Simplified60.5%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
Simplified34.6%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.0000000000000001e281Initial program 98.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6463.9
Simplified63.9%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6435.5
Simplified35.5%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
un-div-invN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
frac-timesN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-undivN/A
lift-/.f64N/A
unpow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
Applied egg-rr97.4%
if 4.0000000000000001e281 < (*.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.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6422.3
Simplified22.3%
Taylor expanded in l around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-neg.f6432.4
Simplified32.4%
Final simplification50.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 -2e-311)
(*
(* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l))))
(+
1.0
(*
(/ (/ (* M_m D_m) (* d 2.0)) l)
(/ (/ (* (* M_m D_m) 0.5) (* d 2.0)) (/ -1.0 h)))))
(if (<= l 1.5e+62)
(*
(/ d (sqrt (* l h)))
(-
1.0
(* h (/ (* (* M_m D_m) (* (/ (* M_m D_m) d) 0.25)) (* d (* l 2.0))))))
(/
(*
(fma (- D_m) (/ (* (* h 0.125) (* D_m (* M_m M_m))) (* d (* l d))) 1.0)
(/ 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 <= -2e-311) {
tmp = (sqrt((d / h)) * (sqrt(-d) / sqrt(-l))) * (1.0 + ((((M_m * D_m) / (d * 2.0)) / l) * ((((M_m * D_m) * 0.5) / (d * 2.0)) / (-1.0 / h))));
} else if (l <= 1.5e+62) {
tmp = (d / sqrt((l * h))) * (1.0 - (h * (((M_m * D_m) * (((M_m * D_m) / d) * 0.25)) / (d * (l * 2.0)))));
} else {
tmp = (fma(-D_m, (((h * 0.125) * (D_m * (M_m * M_m))) / (d * (l * d))), 1.0) * (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 <= -2e-311) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * Float64(1.0 + Float64(Float64(Float64(Float64(M_m * D_m) / Float64(d * 2.0)) / l) * Float64(Float64(Float64(Float64(M_m * D_m) * 0.5) / Float64(d * 2.0)) / Float64(-1.0 / h))))); elseif (l <= 1.5e+62) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 - Float64(h * Float64(Float64(Float64(M_m * D_m) * Float64(Float64(Float64(M_m * D_m) / d) * 0.25)) / Float64(d * Float64(l * 2.0)))))); else tmp = Float64(Float64(fma(Float64(-D_m), Float64(Float64(Float64(h * 0.125) * Float64(D_m * Float64(M_m * M_m))) / Float64(d * Float64(l * d))), 1.0) * Float64(d / 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, -2e-311], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * 0.5), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e+62], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-D$95$m) * N[(N[(N[(h * 0.125), $MachinePrecision] * N[(D$95$m * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $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 \cdot 10^{-311}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \left(1 + \frac{\frac{M\_m \cdot D\_m}{d \cdot 2}}{\ell} \cdot \frac{\frac{\left(M\_m \cdot D\_m\right) \cdot 0.5}{d \cdot 2}}{\frac{-1}{h}}\right)\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+62}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - h \cdot \frac{\left(M\_m \cdot D\_m\right) \cdot \left(\frac{M\_m \cdot D\_m}{d} \cdot 0.25\right)}{d \cdot \left(\ell \cdot 2\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-D\_m, \frac{\left(h \cdot 0.125\right) \cdot \left(D\_m \cdot \left(M\_m \cdot M\_m\right)\right)}{d \cdot \left(\ell \cdot d\right)}, 1\right) \cdot \frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.9999999999999e-311Initial program 72.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr76.6%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6476.6
Applied egg-rr76.6%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6476.6
Applied egg-rr76.6%
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f6481.5
Applied egg-rr81.5%
if -1.9999999999999e-311 < l < 1.5e62Initial program 72.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr79.1%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6479.1
Applied egg-rr79.1%
Applied egg-rr75.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied egg-rr91.7%
if 1.5e62 < l Initial program 56.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6443.5
Simplified43.5%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6453.8
Applied egg-rr53.8%
Applied egg-rr64.7%
Final simplification81.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 (* h (* (/ (* M_m D_m) d) 0.25))) (t_1 (* (* M_m D_m) 0.5)))
(if (<= h -1.4e-161)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* t_0 (/ (* M_m D_m) (* d (* l 2.0))))))
(if (<= h -5e-310)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (/ (* D_m (* D_m (* 0.125 (* h (* M_m M_m))))) (* d (* l d)))))
(if (<= h 6.6e+277)
(* (/ d (sqrt (* l h))) (- 1.0 (* (/ t_1 d) (/ t_0 l))))
(/
(*
(/ d (sqrt h))
(- 1.0 (* h (/ (* (* M_m D_m) t_1) (* (* d 2.0) (* l (* d 2.0)))))))
(sqrt 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) {
double t_0 = h * (((M_m * D_m) / d) * 0.25);
double t_1 = (M_m * D_m) * 0.5;
double tmp;
if (h <= -1.4e-161) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (t_0 * ((M_m * D_m) / (d * (l * 2.0)))));
} else if (h <= -5e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
} else if (h <= 6.6e+277) {
tmp = (d / sqrt((l * h))) * (1.0 - ((t_1 / d) * (t_0 / l)));
} else {
tmp = ((d / sqrt(h)) * (1.0 - (h * (((M_m * D_m) * t_1) / ((d * 2.0) * (l * (d * 2.0))))))) / sqrt(l);
}
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) :: tmp
t_0 = h * (((m_m * d_m) / d) * 0.25d0)
t_1 = (m_m * d_m) * 0.5d0
if (h <= (-1.4d-161)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (t_0 * ((m_m * d_m) / (d * (l * 2.0d0)))))
else if (h <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + ((d_m * (d_m * (0.125d0 * (h * (m_m * m_m))))) / (d * (l * d))))
else if (h <= 6.6d+277) then
tmp = (d / sqrt((l * h))) * (1.0d0 - ((t_1 / d) * (t_0 / l)))
else
tmp = ((d / sqrt(h)) * (1.0d0 - (h * (((m_m * d_m) * t_1) / ((d * 2.0d0) * (l * (d * 2.0d0))))))) / sqrt(l)
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 = h * (((M_m * D_m) / d) * 0.25);
double t_1 = (M_m * D_m) * 0.5;
double tmp;
if (h <= -1.4e-161) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (t_0 * ((M_m * D_m) / (d * (l * 2.0)))));
} else if (h <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
} else if (h <= 6.6e+277) {
tmp = (d / Math.sqrt((l * h))) * (1.0 - ((t_1 / d) * (t_0 / l)));
} else {
tmp = ((d / Math.sqrt(h)) * (1.0 - (h * (((M_m * D_m) * t_1) / ((d * 2.0) * (l * (d * 2.0))))))) / Math.sqrt(l);
}
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 = h * (((M_m * D_m) / d) * 0.25) t_1 = (M_m * D_m) * 0.5 tmp = 0 if h <= -1.4e-161: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (t_0 * ((M_m * D_m) / (d * (l * 2.0))))) elif h <= -5e-310: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d)))) elif h <= 6.6e+277: tmp = (d / math.sqrt((l * h))) * (1.0 - ((t_1 / d) * (t_0 / l))) else: tmp = ((d / math.sqrt(h)) * (1.0 - (h * (((M_m * D_m) * t_1) / ((d * 2.0) * (l * (d * 2.0))))))) / math.sqrt(l) 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(Float64(Float64(M_m * D_m) / d) * 0.25)) t_1 = Float64(Float64(M_m * D_m) * 0.5) tmp = 0.0 if (h <= -1.4e-161) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(t_0 * Float64(Float64(M_m * D_m) / Float64(d * Float64(l * 2.0)))))); elseif (h <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(Float64(D_m * Float64(D_m * Float64(0.125 * Float64(h * Float64(M_m * M_m))))) / Float64(d * Float64(l * d))))); elseif (h <= 6.6e+277) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(t_1 / d) * Float64(t_0 / l)))); else tmp = Float64(Float64(Float64(d / sqrt(h)) * Float64(1.0 - Float64(h * Float64(Float64(Float64(M_m * D_m) * t_1) / Float64(Float64(d * 2.0) * Float64(l * Float64(d * 2.0))))))) / sqrt(l)); 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 = h * (((M_m * D_m) / d) * 0.25);
t_1 = (M_m * D_m) * 0.5;
tmp = 0.0;
if (h <= -1.4e-161)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (t_0 * ((M_m * D_m) / (d * (l * 2.0)))));
elseif (h <= -5e-310)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
elseif (h <= 6.6e+277)
tmp = (d / sqrt((l * h))) * (1.0 - ((t_1 / d) * (t_0 / l)));
else
tmp = ((d / sqrt(h)) * (1.0 - (h * (((M_m * D_m) * t_1) / ((d * 2.0) * (l * (d * 2.0))))))) / sqrt(l);
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[(h * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(M$95$m * D$95$m), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[h, -1.4e-161], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(t$95$0 * N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D$95$m * N[(D$95$m * N[(0.125 * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 6.6e+277], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$1 / d), $MachinePrecision] * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * t$95$1), $MachinePrecision] / N[(N[(d * 2.0), $MachinePrecision] * N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $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 \left(\frac{M\_m \cdot D\_m}{d} \cdot 0.25\right)\\
t_1 := \left(M\_m \cdot D\_m\right) \cdot 0.5\\
\mathbf{if}\;h \leq -1.4 \cdot 10^{-161}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - t\_0 \cdot \frac{M\_m \cdot D\_m}{d \cdot \left(\ell \cdot 2\right)}\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + \frac{D\_m \cdot \left(D\_m \cdot \left(0.125 \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)\right)}{d \cdot \left(\ell \cdot d\right)}\right)\\
\mathbf{elif}\;h \leq 6.6 \cdot 10^{+277}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{t\_1}{d} \cdot \frac{t\_0}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}} \cdot \left(1 - h \cdot \frac{\left(M\_m \cdot D\_m\right) \cdot t\_1}{\left(d \cdot 2\right) \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -1.39999999999999996e-161Initial program 77.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr81.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6481.4
Applied egg-rr81.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6481.4
Applied egg-rr81.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
Applied egg-rr79.4%
if -1.39999999999999996e-161 < h < -4.999999999999985e-310Initial program 59.8%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6443.6
Simplified43.6%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied egg-rr0.0%
Taylor expanded in l around -inf
*-commutativeN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f6468.1
Simplified68.1%
if -4.999999999999985e-310 < h < 6.6000000000000003e277Initial program 69.8%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr75.2%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6475.2
Applied egg-rr75.2%
Applied egg-rr72.2%
Applied egg-rr88.1%
if 6.6000000000000003e277 < h Initial program 36.8%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr29.0%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6429.0
Applied egg-rr29.0%
Applied egg-rr72.4%
Final simplification81.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 (* (* M_m D_m) 0.5))
(t_1
(- 1.0 (* h (/ (* (* M_m D_m) t_0) (* (* d 2.0) (* l (* d 2.0))))))))
(if (<= h -2.9e-34)
(* (sqrt (/ d l)) (* (sqrt (/ d h)) t_1))
(if (<= h -5e-310)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (/ (* D_m (* D_m (* 0.125 (* h (* M_m M_m))))) (* d (* l d)))))
(if (<= h 1e+278)
(*
(/ d (sqrt (* l h)))
(- 1.0 (* (/ t_0 d) (/ (* h (* (/ (* M_m D_m) d) 0.25)) l))))
(/ (* (/ d (sqrt h)) t_1) (sqrt 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) {
double t_0 = (M_m * D_m) * 0.5;
double t_1 = 1.0 - (h * (((M_m * D_m) * t_0) / ((d * 2.0) * (l * (d * 2.0)))));
double tmp;
if (h <= -2.9e-34) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * t_1);
} else if (h <= -5e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
} else if (h <= 1e+278) {
tmp = (d / sqrt((l * h))) * (1.0 - ((t_0 / d) * ((h * (((M_m * D_m) / d) * 0.25)) / l)));
} else {
tmp = ((d / sqrt(h)) * t_1) / sqrt(l);
}
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) :: tmp
t_0 = (m_m * d_m) * 0.5d0
t_1 = 1.0d0 - (h * (((m_m * d_m) * t_0) / ((d * 2.0d0) * (l * (d * 2.0d0)))))
if (h <= (-2.9d-34)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * t_1)
else if (h <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + ((d_m * (d_m * (0.125d0 * (h * (m_m * m_m))))) / (d * (l * d))))
else if (h <= 1d+278) then
tmp = (d / sqrt((l * h))) * (1.0d0 - ((t_0 / d) * ((h * (((m_m * d_m) / d) * 0.25d0)) / l)))
else
tmp = ((d / sqrt(h)) * t_1) / sqrt(l)
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 = (M_m * D_m) * 0.5;
double t_1 = 1.0 - (h * (((M_m * D_m) * t_0) / ((d * 2.0) * (l * (d * 2.0)))));
double tmp;
if (h <= -2.9e-34) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * t_1);
} else if (h <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
} else if (h <= 1e+278) {
tmp = (d / Math.sqrt((l * h))) * (1.0 - ((t_0 / d) * ((h * (((M_m * D_m) / d) * 0.25)) / l)));
} else {
tmp = ((d / Math.sqrt(h)) * t_1) / Math.sqrt(l);
}
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 = (M_m * D_m) * 0.5 t_1 = 1.0 - (h * (((M_m * D_m) * t_0) / ((d * 2.0) * (l * (d * 2.0))))) tmp = 0 if h <= -2.9e-34: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * t_1) elif h <= -5e-310: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d)))) elif h <= 1e+278: tmp = (d / math.sqrt((l * h))) * (1.0 - ((t_0 / d) * ((h * (((M_m * D_m) / d) * 0.25)) / l))) else: tmp = ((d / math.sqrt(h)) * t_1) / math.sqrt(l) 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(M_m * D_m) * 0.5) t_1 = Float64(1.0 - Float64(h * Float64(Float64(Float64(M_m * D_m) * t_0) / Float64(Float64(d * 2.0) * Float64(l * Float64(d * 2.0)))))) tmp = 0.0 if (h <= -2.9e-34) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * t_1)); elseif (h <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(Float64(D_m * Float64(D_m * Float64(0.125 * Float64(h * Float64(M_m * M_m))))) / Float64(d * Float64(l * d))))); elseif (h <= 1e+278) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(t_0 / d) * Float64(Float64(h * Float64(Float64(Float64(M_m * D_m) / d) * 0.25)) / l)))); else tmp = Float64(Float64(Float64(d / sqrt(h)) * t_1) / sqrt(l)); 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 = (M_m * D_m) * 0.5;
t_1 = 1.0 - (h * (((M_m * D_m) * t_0) / ((d * 2.0) * (l * (d * 2.0)))));
tmp = 0.0;
if (h <= -2.9e-34)
tmp = sqrt((d / l)) * (sqrt((d / h)) * t_1);
elseif (h <= -5e-310)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
elseif (h <= 1e+278)
tmp = (d / sqrt((l * h))) * (1.0 - ((t_0 / d) * ((h * (((M_m * D_m) / d) * 0.25)) / l)));
else
tmp = ((d / sqrt(h)) * t_1) / sqrt(l);
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[(M$95$m * D$95$m), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(h * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(N[(d * 2.0), $MachinePrecision] * N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2.9e-34], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D$95$m * N[(D$95$m * N[(0.125 * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1e+278], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$0 / d), $MachinePrecision] * N[(N[(h * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / N[Sqrt[l], $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(M\_m \cdot D\_m\right) \cdot 0.5\\
t_1 := 1 - h \cdot \frac{\left(M\_m \cdot D\_m\right) \cdot t\_0}{\left(d \cdot 2\right) \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\\
\mathbf{if}\;h \leq -2.9 \cdot 10^{-34}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot t\_1\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + \frac{D\_m \cdot \left(D\_m \cdot \left(0.125 \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)\right)}{d \cdot \left(\ell \cdot d\right)}\right)\\
\mathbf{elif}\;h \leq 10^{+278}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{t\_0}{d} \cdot \frac{h \cdot \left(\frac{M\_m \cdot D\_m}{d} \cdot 0.25\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}} \cdot t\_1}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -2.9000000000000002e-34Initial program 77.8%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr82.2%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6482.2
Applied egg-rr82.2%
Applied egg-rr69.6%
if -2.9000000000000002e-34 < h < -4.999999999999985e-310Initial program 66.1%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6442.9
Simplified42.9%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied egg-rr0.0%
Taylor expanded in l around -inf
*-commutativeN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f6464.0
Simplified64.0%
if -4.999999999999985e-310 < h < 9.99999999999999964e277Initial program 69.8%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr75.2%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6475.2
Applied egg-rr75.2%
Applied egg-rr72.2%
Applied egg-rr88.1%
if 9.99999999999999964e277 < h Initial program 36.8%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr29.0%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6429.0
Applied egg-rr29.0%
Applied egg-rr72.4%
Final simplification76.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 (* h (* (/ (* M_m D_m) d) 0.25))) (t_1 (* (* M_m D_m) 0.5)))
(if (<= h 9.5e-284)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (/ t_0 (* (* d 2.0) (/ l (* M_m D_m))))))
(if (<= h 9.5e+277)
(* (/ d (sqrt (* l h))) (- 1.0 (* (/ t_1 d) (/ t_0 l))))
(/
(*
(/ d (sqrt h))
(- 1.0 (* h (/ (* (* M_m D_m) t_1) (* (* d 2.0) (* l (* d 2.0)))))))
(sqrt 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) {
double t_0 = h * (((M_m * D_m) / d) * 0.25);
double t_1 = (M_m * D_m) * 0.5;
double tmp;
if (h <= 9.5e-284) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (t_0 / ((d * 2.0) * (l / (M_m * D_m)))));
} else if (h <= 9.5e+277) {
tmp = (d / sqrt((l * h))) * (1.0 - ((t_1 / d) * (t_0 / l)));
} else {
tmp = ((d / sqrt(h)) * (1.0 - (h * (((M_m * D_m) * t_1) / ((d * 2.0) * (l * (d * 2.0))))))) / sqrt(l);
}
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) :: tmp
t_0 = h * (((m_m * d_m) / d) * 0.25d0)
t_1 = (m_m * d_m) * 0.5d0
if (h <= 9.5d-284) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (t_0 / ((d * 2.0d0) * (l / (m_m * d_m)))))
else if (h <= 9.5d+277) then
tmp = (d / sqrt((l * h))) * (1.0d0 - ((t_1 / d) * (t_0 / l)))
else
tmp = ((d / sqrt(h)) * (1.0d0 - (h * (((m_m * d_m) * t_1) / ((d * 2.0d0) * (l * (d * 2.0d0))))))) / sqrt(l)
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 = h * (((M_m * D_m) / d) * 0.25);
double t_1 = (M_m * D_m) * 0.5;
double tmp;
if (h <= 9.5e-284) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (t_0 / ((d * 2.0) * (l / (M_m * D_m)))));
} else if (h <= 9.5e+277) {
tmp = (d / Math.sqrt((l * h))) * (1.0 - ((t_1 / d) * (t_0 / l)));
} else {
tmp = ((d / Math.sqrt(h)) * (1.0 - (h * (((M_m * D_m) * t_1) / ((d * 2.0) * (l * (d * 2.0))))))) / Math.sqrt(l);
}
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 = h * (((M_m * D_m) / d) * 0.25) t_1 = (M_m * D_m) * 0.5 tmp = 0 if h <= 9.5e-284: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (t_0 / ((d * 2.0) * (l / (M_m * D_m))))) elif h <= 9.5e+277: tmp = (d / math.sqrt((l * h))) * (1.0 - ((t_1 / d) * (t_0 / l))) else: tmp = ((d / math.sqrt(h)) * (1.0 - (h * (((M_m * D_m) * t_1) / ((d * 2.0) * (l * (d * 2.0))))))) / math.sqrt(l) 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(Float64(Float64(M_m * D_m) / d) * 0.25)) t_1 = Float64(Float64(M_m * D_m) * 0.5) tmp = 0.0 if (h <= 9.5e-284) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(t_0 / Float64(Float64(d * 2.0) * Float64(l / Float64(M_m * D_m)))))); elseif (h <= 9.5e+277) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(t_1 / d) * Float64(t_0 / l)))); else tmp = Float64(Float64(Float64(d / sqrt(h)) * Float64(1.0 - Float64(h * Float64(Float64(Float64(M_m * D_m) * t_1) / Float64(Float64(d * 2.0) * Float64(l * Float64(d * 2.0))))))) / sqrt(l)); 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 = h * (((M_m * D_m) / d) * 0.25);
t_1 = (M_m * D_m) * 0.5;
tmp = 0.0;
if (h <= 9.5e-284)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (t_0 / ((d * 2.0) * (l / (M_m * D_m)))));
elseif (h <= 9.5e+277)
tmp = (d / sqrt((l * h))) * (1.0 - ((t_1 / d) * (t_0 / l)));
else
tmp = ((d / sqrt(h)) * (1.0 - (h * (((M_m * D_m) * t_1) / ((d * 2.0) * (l * (d * 2.0))))))) / sqrt(l);
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[(h * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(M$95$m * D$95$m), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[h, 9.5e-284], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(t$95$0 / N[(N[(d * 2.0), $MachinePrecision] * N[(l / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 9.5e+277], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$1 / d), $MachinePrecision] * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * t$95$1), $MachinePrecision] / N[(N[(d * 2.0), $MachinePrecision] * N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $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 \left(\frac{M\_m \cdot D\_m}{d} \cdot 0.25\right)\\
t_1 := \left(M\_m \cdot D\_m\right) \cdot 0.5\\
\mathbf{if}\;h \leq 9.5 \cdot 10^{-284}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{t\_0}{\left(d \cdot 2\right) \cdot \frac{\ell}{M\_m \cdot D\_m}}\right)\\
\mathbf{elif}\;h \leq 9.5 \cdot 10^{+277}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{t\_1}{d} \cdot \frac{t\_0}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}} \cdot \left(1 - h \cdot \frac{\left(M\_m \cdot D\_m\right) \cdot t\_1}{\left(d \cdot 2\right) \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < 9.5000000000000003e-284Initial program 72.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr76.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6476.4
Applied egg-rr76.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6476.4
Applied egg-rr76.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
Applied egg-rr76.4%
if 9.5000000000000003e-284 < h < 9.4999999999999997e277Initial program 69.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr75.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6475.4
Applied egg-rr75.4%
Applied egg-rr74.0%
Applied egg-rr89.4%
if 9.4999999999999997e277 < h Initial program 36.8%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr29.0%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6429.0
Applied egg-rr29.0%
Applied egg-rr72.4%
Final simplification82.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 (* d (* l d))))
(if (<= l -2e-311)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (/ (* D_m (* D_m (* 0.125 (* h (* M_m M_m))))) t_0)))
(if (<= l 1.8e+62)
(*
(/ d (sqrt (* l h)))
(-
1.0
(* h (/ (* (* M_m D_m) (* (/ (* M_m D_m) d) 0.25)) (* d (* l 2.0))))))
(/
(*
(fma (- D_m) (/ (* (* h 0.125) (* D_m (* M_m M_m))) t_0) 1.0)
(/ 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 = d * (l * d);
double tmp;
if (l <= -2e-311) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / t_0));
} else if (l <= 1.8e+62) {
tmp = (d / sqrt((l * h))) * (1.0 - (h * (((M_m * D_m) * (((M_m * D_m) / d) * 0.25)) / (d * (l * 2.0)))));
} else {
tmp = (fma(-D_m, (((h * 0.125) * (D_m * (M_m * M_m))) / t_0), 1.0) * (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(d * Float64(l * d)) tmp = 0.0 if (l <= -2e-311) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(Float64(D_m * Float64(D_m * Float64(0.125 * Float64(h * Float64(M_m * M_m))))) / t_0))); elseif (l <= 1.8e+62) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 - Float64(h * Float64(Float64(Float64(M_m * D_m) * Float64(Float64(Float64(M_m * D_m) / d) * 0.25)) / Float64(d * Float64(l * 2.0)))))); else tmp = Float64(Float64(fma(Float64(-D_m), Float64(Float64(Float64(h * 0.125) * Float64(D_m * Float64(M_m * M_m))) / t_0), 1.0) * Float64(d / 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[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2e-311], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D$95$m * N[(D$95$m * N[(0.125 * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.8e+62], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-D$95$m) * N[(N[(N[(h * 0.125), $MachinePrecision] * N[(D$95$m * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $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 \cdot \left(\ell \cdot d\right)\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + \frac{D\_m \cdot \left(D\_m \cdot \left(0.125 \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)\right)}{t\_0}\right)\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{+62}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - h \cdot \frac{\left(M\_m \cdot D\_m\right) \cdot \left(\frac{M\_m \cdot D\_m}{d} \cdot 0.25\right)}{d \cdot \left(\ell \cdot 2\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-D\_m, \frac{\left(h \cdot 0.125\right) \cdot \left(D\_m \cdot \left(M\_m \cdot M\_m\right)\right)}{t\_0}, 1\right) \cdot \frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.9999999999999e-311Initial program 72.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6450.5
Simplified50.5%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied egg-rr0.0%
Taylor expanded in l around -inf
*-commutativeN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f6460.6
Simplified60.6%
if -1.9999999999999e-311 < l < 1.8e62Initial program 72.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr79.1%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6479.1
Applied egg-rr79.1%
Applied egg-rr75.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied egg-rr91.7%
if 1.8e62 < l Initial program 56.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6443.5
Simplified43.5%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6453.8
Applied egg-rr53.8%
Applied egg-rr64.7%
Final simplification71.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 -1.85e-107)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l -2e-311)
(* (sqrt (/ h (* l (* l l)))) (* 0.125 (* D_m (* D_m (/ (* M_m M_m) d)))))
(if (<= l 3.1e+144)
(*
(/ d (sqrt (* l h)))
(-
1.0
(* h (* D_m (* M_m (/ (* (* M_m D_m) 0.5) (* l (* d (* d 4.0)))))))))
(/ 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.85e-107) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else if (l <= 3.1e+144) {
tmp = (d / sqrt((l * h))) * (1.0 - (h * (D_m * (M_m * (((M_m * D_m) * 0.5) / (l * (d * (d * 4.0))))))));
} 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.85d-107)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else if (l <= (-2d-311)) then
tmp = sqrt((h / (l * (l * l)))) * (0.125d0 * (d_m * (d_m * ((m_m * m_m) / d))))
else if (l <= 3.1d+144) then
tmp = (d / sqrt((l * h))) * (1.0d0 - (h * (d_m * (m_m * (((m_m * d_m) * 0.5d0) / (l * (d * (d * 4.0d0))))))))
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.85e-107) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = Math.sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else if (l <= 3.1e+144) {
tmp = (d / Math.sqrt((l * h))) * (1.0 - (h * (D_m * (M_m * (((M_m * D_m) * 0.5) / (l * (d * (d * 4.0))))))));
} 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.85e-107: tmp = -d * math.sqrt((1.0 / (l * h))) elif l <= -2e-311: tmp = math.sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d)))) elif l <= 3.1e+144: tmp = (d / math.sqrt((l * h))) * (1.0 - (h * (D_m * (M_m * (((M_m * D_m) * 0.5) / (l * (d * (d * 4.0)))))))) 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.85e-107) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= -2e-311) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(0.125 * Float64(D_m * Float64(D_m * Float64(Float64(M_m * M_m) / d))))); elseif (l <= 3.1e+144) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 - Float64(h * Float64(D_m * Float64(M_m * Float64(Float64(Float64(M_m * D_m) * 0.5) / Float64(l * Float64(d * Float64(d * 4.0))))))))); 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.85e-107)
tmp = -d * sqrt((1.0 / (l * h)));
elseif (l <= -2e-311)
tmp = sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
elseif (l <= 3.1e+144)
tmp = (d / sqrt((l * h))) * (1.0 - (h * (D_m * (M_m * (((M_m * D_m) * 0.5) / (l * (d * (d * 4.0))))))));
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.85e-107], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-311], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(D$95$m * N[(D$95$m * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.1e+144], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(D$95$m * N[(M$95$m * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * 0.5), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -1.85 \cdot 10^{-107}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(0.125 \cdot \left(D\_m \cdot \left(D\_m \cdot \frac{M\_m \cdot M\_m}{d}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 3.1 \cdot 10^{+144}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - h \cdot \left(D\_m \cdot \left(M\_m \cdot \frac{\left(M\_m \cdot D\_m\right) \cdot 0.5}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.8500000000000001e-107Initial program 68.9%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6445.6
Simplified45.6%
Taylor expanded in l around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-neg.f6452.3
Simplified52.3%
if -1.8500000000000001e-107 < l < -1.9999999999999e-311Initial program 81.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6462.6
Simplified62.6%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
Simplified56.9%
if -1.9999999999999e-311 < l < 3.1000000000000002e144Initial program 70.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr76.5%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6476.5
Applied egg-rr76.5%
Applied egg-rr73.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6476.1
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied egg-rr74.1%
if 3.1000000000000002e144 < l Initial program 52.8%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6441.4
Simplified41.4%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6460.8
Simplified60.8%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
un-div-invN/A
lower-/.f6460.9
Applied egg-rr60.9%
*-commutativeN/A
sqrt-prodN/A
pow1/2N/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6472.1
Applied egg-rr72.1%
Final simplification63.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 -2.7e-106)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l -2e-311)
(* (sqrt (/ h (* l (* l l)))) (* 0.125 (* D_m (* D_m (/ (* M_m M_m) d)))))
(if (<= l 2.02e+37)
(*
(/ d (sqrt (* l h)))
(- 1.0 (* (/ (* M_m (* h M_m)) (* d (* l d))) (* 0.125 (* D_m D_m)))))
(/ 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.7e-106) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else if (l <= 2.02e+37) {
tmp = (d / sqrt((l * h))) * (1.0 - (((M_m * (h * M_m)) / (d * (l * d))) * (0.125 * (D_m * D_m))));
} 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 <= (-2.7d-106)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else if (l <= (-2d-311)) then
tmp = sqrt((h / (l * (l * l)))) * (0.125d0 * (d_m * (d_m * ((m_m * m_m) / d))))
else if (l <= 2.02d+37) then
tmp = (d / sqrt((l * h))) * (1.0d0 - (((m_m * (h * m_m)) / (d * (l * d))) * (0.125d0 * (d_m * d_m))))
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.7e-106) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = Math.sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else if (l <= 2.02e+37) {
tmp = (d / Math.sqrt((l * h))) * (1.0 - (((M_m * (h * M_m)) / (d * (l * d))) * (0.125 * (D_m * D_m))));
} 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.7e-106: tmp = -d * math.sqrt((1.0 / (l * h))) elif l <= -2e-311: tmp = math.sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d)))) elif l <= 2.02e+37: tmp = (d / math.sqrt((l * h))) * (1.0 - (((M_m * (h * M_m)) / (d * (l * d))) * (0.125 * (D_m * D_m)))) 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.7e-106) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= -2e-311) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(0.125 * Float64(D_m * Float64(D_m * Float64(Float64(M_m * M_m) / d))))); elseif (l <= 2.02e+37) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(M_m * Float64(h * M_m)) / Float64(d * Float64(l * d))) * Float64(0.125 * Float64(D_m * D_m))))); 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.7e-106)
tmp = -d * sqrt((1.0 / (l * h)));
elseif (l <= -2e-311)
tmp = sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
elseif (l <= 2.02e+37)
tmp = (d / sqrt((l * h))) * (1.0 - (((M_m * (h * M_m)) / (d * (l * d))) * (0.125 * (D_m * D_m))));
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.7e-106], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-311], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(D$95$m * N[(D$95$m * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.02e+37], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(M$95$m * N[(h * M$95$m), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $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.7 \cdot 10^{-106}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(0.125 \cdot \left(D\_m \cdot \left(D\_m \cdot \frac{M\_m \cdot M\_m}{d}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.02 \cdot 10^{+37}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{M\_m \cdot \left(h \cdot M\_m\right)}{d \cdot \left(\ell \cdot d\right)} \cdot \left(0.125 \cdot \left(D\_m \cdot D\_m\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -2.70000000000000022e-106Initial program 68.9%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6445.6
Simplified45.6%
Taylor expanded in l around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-neg.f6452.3
Simplified52.3%
if -2.70000000000000022e-106 < l < -1.9999999999999e-311Initial program 81.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6462.6
Simplified62.6%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
Simplified56.9%
if -1.9999999999999e-311 < l < 2.0199999999999999e37Initial program 72.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr79.7%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6479.7
Applied egg-rr79.7%
Applied egg-rr77.9%
Taylor expanded in M around 0
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6466.0
Simplified66.0%
if 2.0199999999999999e37 < l Initial program 58.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6441.8
Simplified41.8%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6452.8
Simplified52.8%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
un-div-invN/A
lower-/.f6452.9
Applied egg-rr52.9%
*-commutativeN/A
sqrt-prodN/A
pow1/2N/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6460.0
Applied egg-rr60.0%
Final simplification58.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 -2e-311)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (/ (* D_m (* D_m (* 0.125 (* h (* M_m M_m))))) (* d (* l d)))))
(if (<= l 1.65e+156)
(*
(/ d (sqrt (* l h)))
(-
1.0
(* h (* D_m (* M_m (/ (* (* M_m D_m) 0.5) (* l (* d (* d 4.0)))))))))
(/ 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 <= -2e-311) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
} else if (l <= 1.65e+156) {
tmp = (d / sqrt((l * h))) * (1.0 - (h * (D_m * (M_m * (((M_m * D_m) * 0.5) / (l * (d * (d * 4.0))))))));
} 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 <= (-2d-311)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + ((d_m * (d_m * (0.125d0 * (h * (m_m * m_m))))) / (d * (l * d))))
else if (l <= 1.65d+156) then
tmp = (d / sqrt((l * h))) * (1.0d0 - (h * (d_m * (m_m * (((m_m * d_m) * 0.5d0) / (l * (d * (d * 4.0d0))))))))
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 <= -2e-311) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
} else if (l <= 1.65e+156) {
tmp = (d / Math.sqrt((l * h))) * (1.0 - (h * (D_m * (M_m * (((M_m * D_m) * 0.5) / (l * (d * (d * 4.0))))))));
} 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 <= -2e-311: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d)))) elif l <= 1.65e+156: tmp = (d / math.sqrt((l * h))) * (1.0 - (h * (D_m * (M_m * (((M_m * D_m) * 0.5) / (l * (d * (d * 4.0)))))))) 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 <= -2e-311) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(Float64(D_m * Float64(D_m * Float64(0.125 * Float64(h * Float64(M_m * M_m))))) / Float64(d * Float64(l * d))))); elseif (l <= 1.65e+156) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 - Float64(h * Float64(D_m * Float64(M_m * Float64(Float64(Float64(M_m * D_m) * 0.5) / Float64(l * Float64(d * Float64(d * 4.0))))))))); 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 <= -2e-311)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
elseif (l <= 1.65e+156)
tmp = (d / sqrt((l * h))) * (1.0 - (h * (D_m * (M_m * (((M_m * D_m) * 0.5) / (l * (d * (d * 4.0))))))));
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, -2e-311], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D$95$m * N[(D$95$m * N[(0.125 * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.65e+156], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(D$95$m * N[(M$95$m * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * 0.5), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 \cdot 10^{-311}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + \frac{D\_m \cdot \left(D\_m \cdot \left(0.125 \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)\right)}{d \cdot \left(\ell \cdot d\right)}\right)\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{+156}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - h \cdot \left(D\_m \cdot \left(M\_m \cdot \frac{\left(M\_m \cdot D\_m\right) \cdot 0.5}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.9999999999999e-311Initial program 72.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6450.5
Simplified50.5%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied egg-rr0.0%
Taylor expanded in l around -inf
*-commutativeN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f6460.6
Simplified60.6%
if -1.9999999999999e-311 < l < 1.6499999999999999e156Initial program 70.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr76.5%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6476.5
Applied egg-rr76.5%
Applied egg-rr73.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6476.1
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied egg-rr74.1%
if 1.6499999999999999e156 < l Initial program 52.8%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6441.4
Simplified41.4%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6460.8
Simplified60.8%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
un-div-invN/A
lower-/.f6460.9
Applied egg-rr60.9%
*-commutativeN/A
sqrt-prodN/A
pow1/2N/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6472.1
Applied egg-rr72.1%
Final simplification67.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
(if (<= h -5e-310)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ -1.0 (/ (* D_m (* D_m (* 0.125 (* h (* M_m M_m))))) (* d (* l d)))))
(*
(/ d (sqrt (* l h)))
(-
1.0
(* h (/ (* (* M_m D_m) (* (/ (* M_m D_m) d) 0.25)) (* d (* l 2.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 tmp;
if (h <= -5e-310) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
} else {
tmp = (d / sqrt((l * h))) * (1.0 - (h * (((M_m * D_m) * (((M_m * D_m) / d) * 0.25)) / (d * (l * 2.0)))));
}
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 (h <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * ((-1.0d0) + ((d_m * (d_m * (0.125d0 * (h * (m_m * m_m))))) / (d * (l * d))))
else
tmp = (d / sqrt((l * h))) * (1.0d0 - (h * (((m_m * d_m) * (((m_m * d_m) / d) * 0.25d0)) / (d * (l * 2.0d0)))))
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 (h <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
} else {
tmp = (d / Math.sqrt((l * h))) * (1.0 - (h * (((M_m * D_m) * (((M_m * D_m) / d) * 0.25)) / (d * (l * 2.0)))));
}
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 h <= -5e-310: tmp = (d * math.sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d)))) else: tmp = (d / math.sqrt((l * h))) * (1.0 - (h * (((M_m * D_m) * (((M_m * D_m) / d) * 0.25)) / (d * (l * 2.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) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-1.0 + Float64(Float64(D_m * Float64(D_m * Float64(0.125 * Float64(h * Float64(M_m * M_m))))) / Float64(d * Float64(l * d))))); else tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 - Float64(h * Float64(Float64(Float64(M_m * D_m) * Float64(Float64(Float64(M_m * D_m) / d) * 0.25)) / Float64(d * Float64(l * 2.0)))))); 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 (h <= -5e-310)
tmp = (d * sqrt((1.0 / (l * h)))) * (-1.0 + ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * d))));
else
tmp = (d / sqrt((l * h))) * (1.0 - (h * (((M_m * D_m) * (((M_m * D_m) / d) * 0.25)) / (d * (l * 2.0)))));
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[h, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(N[(D$95$m * N[(D$95$m * N[(0.125 * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-1 + \frac{D\_m \cdot \left(D\_m \cdot \left(0.125 \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)\right)}{d \cdot \left(\ell \cdot d\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - h \cdot \frac{\left(M\_m \cdot D\_m\right) \cdot \left(\frac{M\_m \cdot D\_m}{d} \cdot 0.25\right)}{d \cdot \left(\ell \cdot 2\right)}\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 72.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6450.5
Simplified50.5%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied egg-rr0.0%
Taylor expanded in l around -inf
*-commutativeN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f6460.6
Simplified60.6%
if -4.999999999999985e-310 < h Initial program 67.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr71.2%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6471.2
Applied egg-rr71.2%
Applied egg-rr69.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied egg-rr80.9%
Final simplification70.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 -2.9e-105)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l -2e-311)
(* (sqrt (/ h (* l (* l l)))) (* 0.125 (* D_m (* D_m (/ (* M_m M_m) d)))))
(if (<= l 1.3e+125)
(*
(/ d (sqrt (* l h)))
(fma (* h (* (* M_m M_m) -0.125)) (* D_m (/ D_m (* d (* l d)))) 1.0))
(/ 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.9e-105) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else if (l <= 1.3e+125) {
tmp = (d / sqrt((l * h))) * fma((h * ((M_m * M_m) * -0.125)), (D_m * (D_m / (d * (l * d)))), 1.0);
} 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.9e-105) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= -2e-311) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(0.125 * Float64(D_m * Float64(D_m * Float64(Float64(M_m * M_m) / d))))); elseif (l <= 1.3e+125) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(Float64(h * Float64(Float64(M_m * M_m) * -0.125)), Float64(D_m * Float64(D_m / Float64(d * Float64(l * d)))), 1.0)); 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.9e-105], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-311], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(D$95$m * N[(D$95$m * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.3e+125], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * N[(D$95$m / N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $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.9 \cdot 10^{-105}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(0.125 \cdot \left(D\_m \cdot \left(D\_m \cdot \frac{M\_m \cdot M\_m}{d}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{+125}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(h \cdot \left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right), D\_m \cdot \frac{D\_m}{d \cdot \left(\ell \cdot d\right)}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -2.90000000000000003e-105Initial program 68.9%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6445.6
Simplified45.6%
Taylor expanded in l around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-neg.f6452.3
Simplified52.3%
if -2.90000000000000003e-105 < l < -1.9999999999999e-311Initial program 81.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6462.6
Simplified62.6%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
Simplified56.9%
if -1.9999999999999e-311 < l < 1.30000000000000002e125Initial program 72.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
div-invN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
times-fracN/A
Applied egg-rr77.6%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6477.6
Applied egg-rr77.6%
Applied egg-rr73.9%
Taylor expanded in M around 0
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-*r*N/A
associate-/l*N/A
lower-fma.f64N/A
Simplified60.6%
if 1.30000000000000002e125 < l Initial program 52.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6443.8
Simplified43.8%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6458.6
Simplified58.6%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
un-div-invN/A
lower-/.f6458.7
Applied egg-rr58.7%
*-commutativeN/A
sqrt-prodN/A
pow1/2N/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6469.9
Applied egg-rr69.9%
Final simplification58.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
(if (<= l -1.7e-105)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l -2e-311)
(* (sqrt (/ h (* l (* l l)))) (* 0.125 (* D_m (* D_m (/ (* M_m M_m) d)))))
(*
(/ d (sqrt (* l h)))
(fma
(- D_m)
(/ (* (* h 0.125) (* D_m (* M_m M_m))) (* d (* l 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 tmp;
if (l <= -1.7e-105) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else {
tmp = (d / sqrt((l * h))) * fma(-D_m, (((h * 0.125) * (D_m * (M_m * M_m))) / (d * (l * 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) tmp = 0.0 if (l <= -1.7e-105) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= -2e-311) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(0.125 * Float64(D_m * Float64(D_m * Float64(Float64(M_m * M_m) / d))))); else tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(Float64(-D_m), Float64(Float64(Float64(h * 0.125) * Float64(D_m * Float64(M_m * M_m))) / Float64(d * Float64(l * 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_] := If[LessEqual[l, -1.7e-105], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-311], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(D$95$m * N[(D$95$m * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[((-D$95$m) * N[(N[(N[(h * 0.125), $MachinePrecision] * N[(D$95$m * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * d), $MachinePrecision]), $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}
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{-105}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(0.125 \cdot \left(D\_m \cdot \left(D\_m \cdot \frac{M\_m \cdot M\_m}{d}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(-D\_m, \frac{\left(h \cdot 0.125\right) \cdot \left(D\_m \cdot \left(M\_m \cdot M\_m\right)\right)}{d \cdot \left(\ell \cdot d\right)}, 1\right)\\
\end{array}
\end{array}
if l < -1.69999999999999996e-105Initial program 68.9%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6445.6
Simplified45.6%
Taylor expanded in l around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-neg.f6452.3
Simplified52.3%
if -1.69999999999999996e-105 < l < -1.9999999999999e-311Initial program 81.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6462.6
Simplified62.6%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
Simplified56.9%
if -1.9999999999999e-311 < l Initial program 67.0%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6451.4
Simplified51.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6458.5
Applied egg-rr58.5%
Applied egg-rr64.4%
Final simplification59.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 -6.4e-107)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l -2e-311)
(* (sqrt (/ h (* l (* l l)))) (* 0.125 (* D_m (* D_m (/ (* M_m M_m) d)))))
(*
(/ d (sqrt (* l h)))
(- 1.0 (/ (* D_m (* D_m (* 0.125 (* h (* M_m M_m))))) (* d (* 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) {
double tmp;
if (l <= -6.4e-107) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else {
tmp = (d / sqrt((l * h))) * (1.0 - ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * 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) :: tmp
if (l <= (-6.4d-107)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else if (l <= (-2d-311)) then
tmp = sqrt((h / (l * (l * l)))) * (0.125d0 * (d_m * (d_m * ((m_m * m_m) / d))))
else
tmp = (d / sqrt((l * h))) * (1.0d0 - ((d_m * (d_m * (0.125d0 * (h * (m_m * m_m))))) / (d * (l * 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 tmp;
if (l <= -6.4e-107) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = Math.sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else {
tmp = (d / Math.sqrt((l * h))) * (1.0 - ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * 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): tmp = 0 if l <= -6.4e-107: tmp = -d * math.sqrt((1.0 / (l * h))) elif l <= -2e-311: tmp = math.sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d)))) else: tmp = (d / math.sqrt((l * h))) * (1.0 - ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * 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) tmp = 0.0 if (l <= -6.4e-107) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= -2e-311) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(0.125 * Float64(D_m * Float64(D_m * Float64(Float64(M_m * M_m) / d))))); else tmp = Float64(Float64(d / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(D_m * Float64(D_m * Float64(0.125 * Float64(h * Float64(M_m * M_m))))) / Float64(d * Float64(l * 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)
tmp = 0.0;
if (l <= -6.4e-107)
tmp = -d * sqrt((1.0 / (l * h)));
elseif (l <= -2e-311)
tmp = sqrt((h / (l * (l * l)))) * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
else
tmp = (d / sqrt((l * h))) * (1.0 - ((D_m * (D_m * (0.125 * (h * (M_m * M_m))))) / (d * (l * 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_] := If[LessEqual[l, -6.4e-107], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-311], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(D$95$m * N[(D$95$m * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(D$95$m * N[(D$95$m * N[(0.125 * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * d), $MachinePrecision]), $MachinePrecision]), $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 -6.4 \cdot 10^{-107}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(0.125 \cdot \left(D\_m \cdot \left(D\_m \cdot \frac{M\_m \cdot M\_m}{d}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{D\_m \cdot \left(D\_m \cdot \left(0.125 \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)\right)}{d \cdot \left(\ell \cdot d\right)}\right)\\
\end{array}
\end{array}
if l < -6.40000000000000025e-107Initial program 68.9%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6445.6
Simplified45.6%
Taylor expanded in l around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-neg.f6452.3
Simplified52.3%
if -6.40000000000000025e-107 < l < -1.9999999999999e-311Initial program 81.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6462.6
Simplified62.6%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
Simplified56.9%
if -1.9999999999999e-311 < l Initial program 67.0%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6451.4
Simplified51.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6458.5
Applied egg-rr58.5%
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
frac-timesN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lift-*.f64N/A
lift-sqrt.f64N/A
lower-/.f6460.9
Applied egg-rr60.9%
Final simplification57.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 (/ h (* l (* l l))))))
(if (<= l -5e-108)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l -2e-311)
(* t_0 (* 0.125 (* D_m (* D_m (/ (* M_m M_m) d)))))
(if (<= l 5e+37)
(/ (* -0.125 (* t_0 (* D_m (* D_m (* M_m M_m))))) 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((h / (l * (l * l))));
double tmp;
if (l <= -5e-108) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = t_0 * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else if (l <= 5e+37) {
tmp = (-0.125 * (t_0 * (D_m * (D_m * (M_m * M_m))))) / 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) :: t_0
real(8) :: tmp
t_0 = sqrt((h / (l * (l * l))))
if (l <= (-5d-108)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else if (l <= (-2d-311)) then
tmp = t_0 * (0.125d0 * (d_m * (d_m * ((m_m * m_m) / d))))
else if (l <= 5d+37) then
tmp = ((-0.125d0) * (t_0 * (d_m * (d_m * (m_m * m_m))))) / 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((h / (l * (l * l))));
double tmp;
if (l <= -5e-108) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = t_0 * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else if (l <= 5e+37) {
tmp = (-0.125 * (t_0 * (D_m * (D_m * (M_m * M_m))))) / 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((h / (l * (l * l)))) tmp = 0 if l <= -5e-108: tmp = -d * math.sqrt((1.0 / (l * h))) elif l <= -2e-311: tmp = t_0 * (0.125 * (D_m * (D_m * ((M_m * M_m) / d)))) elif l <= 5e+37: tmp = (-0.125 * (t_0 * (D_m * (D_m * (M_m * M_m))))) / 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(h / Float64(l * Float64(l * l)))) tmp = 0.0 if (l <= -5e-108) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= -2e-311) tmp = Float64(t_0 * Float64(0.125 * Float64(D_m * Float64(D_m * Float64(Float64(M_m * M_m) / d))))); elseif (l <= 5e+37) tmp = Float64(Float64(-0.125 * Float64(t_0 * Float64(D_m * Float64(D_m * Float64(M_m * M_m))))) / 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((h / (l * (l * l))));
tmp = 0.0;
if (l <= -5e-108)
tmp = -d * sqrt((1.0 / (l * h)));
elseif (l <= -2e-311)
tmp = t_0 * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
elseif (l <= 5e+37)
tmp = (-0.125 * (t_0 * (D_m * (D_m * (M_m * M_m))))) / 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[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5e-108], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-311], N[(t$95$0 * N[(0.125 * N[(D$95$m * N[(D$95$m * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+37], N[(N[(-0.125 * N[(t$95$0 * N[(D$95$m * N[(D$95$m * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $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}
t_0 := \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-108}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;t\_0 \cdot \left(0.125 \cdot \left(D\_m \cdot \left(D\_m \cdot \frac{M\_m \cdot M\_m}{d}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+37}:\\
\;\;\;\;\frac{-0.125 \cdot \left(t\_0 \cdot \left(D\_m \cdot \left(D\_m \cdot \left(M\_m \cdot M\_m\right)\right)\right)\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -5e-108Initial program 68.9%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6445.6
Simplified45.6%
Taylor expanded in l around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-neg.f6452.3
Simplified52.3%
if -5e-108 < l < -1.9999999999999e-311Initial program 81.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6462.6
Simplified62.6%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
Simplified56.9%
if -1.9999999999999e-311 < l < 4.99999999999999989e37Initial program 72.0%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6456.5
Simplified56.5%
Taylor expanded in d around 0
associate-*l/N/A
associate-*r/N/A
lower-/.f64N/A
Simplified49.0%
if 4.99999999999999989e37 < l Initial program 59.1%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6443.4
Simplified43.4%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6454.9
Simplified54.9%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
un-div-invN/A
lower-/.f6454.9
Applied egg-rr54.9%
*-commutativeN/A
sqrt-prodN/A
pow1/2N/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6462.3
Applied egg-rr62.3%
Final simplification53.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 (sqrt (/ h (* l (* l l))))))
(if (<= l -1.42e-105)
(* (- d) (sqrt (/ 1.0 (* l h))))
(if (<= l -2e-311)
(* t_0 (* 0.125 (* D_m (* D_m (/ (* M_m M_m) d)))))
(if (<= l 8.5e+29)
(* (* D_m D_m) (* t_0 (/ (* (* M_m M_m) -0.125) 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((h / (l * (l * l))));
double tmp;
if (l <= -1.42e-105) {
tmp = -d * sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = t_0 * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else if (l <= 8.5e+29) {
tmp = (D_m * D_m) * (t_0 * (((M_m * M_m) * -0.125) / 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) :: t_0
real(8) :: tmp
t_0 = sqrt((h / (l * (l * l))))
if (l <= (-1.42d-105)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else if (l <= (-2d-311)) then
tmp = t_0 * (0.125d0 * (d_m * (d_m * ((m_m * m_m) / d))))
else if (l <= 8.5d+29) then
tmp = (d_m * d_m) * (t_0 * (((m_m * m_m) * (-0.125d0)) / 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((h / (l * (l * l))));
double tmp;
if (l <= -1.42e-105) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else if (l <= -2e-311) {
tmp = t_0 * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
} else if (l <= 8.5e+29) {
tmp = (D_m * D_m) * (t_0 * (((M_m * M_m) * -0.125) / 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((h / (l * (l * l)))) tmp = 0 if l <= -1.42e-105: tmp = -d * math.sqrt((1.0 / (l * h))) elif l <= -2e-311: tmp = t_0 * (0.125 * (D_m * (D_m * ((M_m * M_m) / d)))) elif l <= 8.5e+29: tmp = (D_m * D_m) * (t_0 * (((M_m * M_m) * -0.125) / 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(h / Float64(l * Float64(l * l)))) tmp = 0.0 if (l <= -1.42e-105) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); elseif (l <= -2e-311) tmp = Float64(t_0 * Float64(0.125 * Float64(D_m * Float64(D_m * Float64(Float64(M_m * M_m) / d))))); elseif (l <= 8.5e+29) tmp = Float64(Float64(D_m * D_m) * Float64(t_0 * Float64(Float64(Float64(M_m * M_m) * -0.125) / 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((h / (l * (l * l))));
tmp = 0.0;
if (l <= -1.42e-105)
tmp = -d * sqrt((1.0 / (l * h)));
elseif (l <= -2e-311)
tmp = t_0 * (0.125 * (D_m * (D_m * ((M_m * M_m) / d))));
elseif (l <= 8.5e+29)
tmp = (D_m * D_m) * (t_0 * (((M_m * M_m) * -0.125) / 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[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.42e-105], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-311], N[(t$95$0 * N[(0.125 * N[(D$95$m * N[(D$95$m * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e+29], N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(t$95$0 * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision] / d), $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 := \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}}\\
\mathbf{if}\;\ell \leq -1.42 \cdot 10^{-105}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-311}:\\
\;\;\;\;t\_0 \cdot \left(0.125 \cdot \left(D\_m \cdot \left(D\_m \cdot \frac{M\_m \cdot M\_m}{d}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+29}:\\
\;\;\;\;\left(D\_m \cdot D\_m\right) \cdot \left(t\_0 \cdot \frac{\left(M\_m \cdot M\_m\right) \cdot -0.125}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.4199999999999999e-105Initial program 68.9%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6445.6
Simplified45.6%
Taylor expanded in l around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-neg.f6452.3
Simplified52.3%
if -1.4199999999999999e-105 < l < -1.9999999999999e-311Initial program 81.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6462.6
Simplified62.6%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
Simplified56.9%
if -1.9999999999999e-311 < l < 8.5000000000000006e29Initial program 72.6%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6458.0
Simplified58.0%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6462.7
Applied egg-rr62.7%
Taylor expanded in d around 0
*-commutativeN/A
associate-/l*N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
Simplified49.3%
if 8.5000000000000006e29 < l Initial program 58.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6441.8
Simplified41.8%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6452.8
Simplified52.8%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
un-div-invN/A
lower-/.f6452.9
Applied egg-rr52.9%
*-commutativeN/A
sqrt-prodN/A
pow1/2N/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6460.0
Applied egg-rr60.0%
Final simplification53.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 1.65e-276) (* (- d) (sqrt (/ 1.0 (* 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 <= 1.65e-276) {
tmp = -d * sqrt((1.0 / (l * 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.65d-276) then
tmp = -d * sqrt((1.0d0 / (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 <= 1.65e-276) {
tmp = -d * Math.sqrt((1.0 / (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 <= 1.65e-276: tmp = -d * math.sqrt((1.0 / (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 <= 1.65e-276) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(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 <= 1.65e-276)
tmp = -d * sqrt((1.0 / (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, 1.65e-276], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $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 1.65 \cdot 10^{-276}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 1.64999999999999996e-276Initial program 72.4%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6451.7
Simplified51.7%
Taylor expanded in l around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-neg.f6443.7
Simplified43.7%
if 1.64999999999999996e-276 < l Initial program 66.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6450.2
Simplified50.2%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6440.3
Simplified40.3%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
un-div-invN/A
lower-/.f6441.0
Applied egg-rr41.0%
*-commutativeN/A
sqrt-prodN/A
pow1/2N/A
lower-*.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6445.7
Applied egg-rr45.7%
Final simplification44.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 (<= d -4.8e-241) (* (- d) (sqrt (/ 1.0 (* l h)))) (/ 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) {
double tmp;
if (d <= -4.8e-241) {
tmp = -d * sqrt((1.0 / (l * h)));
} else {
tmp = d / sqrt((l * 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 (d <= (-4.8d-241)) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else
tmp = d / sqrt((l * 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 (d <= -4.8e-241) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d / Math.sqrt((l * 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 d <= -4.8e-241: tmp = -d * math.sqrt((1.0 / (l * h))) else: tmp = d / math.sqrt((l * 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 (d <= -4.8e-241) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d / sqrt(Float64(l * 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 (d <= -4.8e-241)
tmp = -d * sqrt((1.0 / (l * h)));
else
tmp = d / sqrt((l * 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[d, -4.8e-241], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4.8 \cdot 10^{-241}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -4.8e-241Initial program 72.4%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6450.2
Simplified50.2%
Taylor expanded in l around -inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-neg.f6447.5
Simplified47.5%
if -4.8e-241 < d Initial program 67.6%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6451.6
Simplified51.6%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6438.5
Simplified38.5%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
un-div-invN/A
lower-/.f6439.1
Applied egg-rr39.1%
Final simplification42.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 (/ 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 = 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((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 69.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6451.0
Simplified51.0%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6425.1
Simplified25.1%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
un-div-invN/A
lower-/.f6425.5
Applied egg-rr25.5%
Final simplification25.5%
herbie shell --seed 2024207
(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)))))