コード例 #1
0
        private static MultiPrecision <N> BesselYNearZero(MultiPrecision <N> nu, MultiPrecision <N> z)
        {
            int n = (int)Round(nu);

            if (nu != n)
            {
                MultiPrecision <N> dnu = nu - n;

                if (dnu.Exponent >= -32)
                {
                    return(MultiPrecision <Plus2 <N> > .BesselYNonIntegerNu(nu.Convert <Plus2 <N> >(), z.Convert <Plus2 <N> >()).Convert <N>());
                }
                if (dnu.Exponent >= -128)
                {
                    return(MultiPrecision <Plus4 <N> > .BesselYNonIntegerNu(nu.Convert <Plus4 <N> >(), z.Convert <Plus4 <N> >()).Convert <N>());
                }
                if (dnu.Exponent >= -272)
                {
                    return(MultiPrecision <Plus8 <N> > .BesselYNonIntegerNu(nu.Convert <Plus8 <N> >(), z.Convert <Plus8 <N> >()).Convert <N>());
                }

                throw new ArgumentException(
                          "The calculation of the BesselY function value is invalid because it loses digits" +
                          " when nu is extremely close to an integer. (|nu - round(nu)| < 1.32 x 10^-82 and nu != round(nu))",
                          nameof(nu));
            }

            return(MultiPrecision <Plus2 <N> > .BesselYIntegerNuNearZero(n, z.Convert <Plus2 <N> >()).Convert <N>());
        }