예제 #1
0
        public static SuperDouble ReadSD(StringBuilder line, ref int pos)
        {
            int cp;

            for (cp = pos; cp < line.Length; cp++)
            {
                if (!char.IsDigit(line[cp]))
                {
                    break;
                }
            }
            if (cp != line.Length)
            {
                if (line[cp] == 'E' | line[cp] == 'e')
                {
                    cp++;
                }
                for (; cp < line.Length; cp++)
                {
                    if (!char.IsDigit(line[cp]))
                    {
                        break;
                    }
                }
            }
            string      sl = line.ToString(pos, cp - pos);
            SuperDouble sd = SuperDouble.Parse(sl);

            pos = cp;
            return(sd);
        }
예제 #2
0
        static bool TryReadNumber(StringBuilder line, ref int pos, out SuperDouble val)
        {
            if (pos >= line.Length)
            {
                val = default(SuperDouble); return(false);
            }
            if (!char.IsDigit(line[pos]))
            {
                val = default(SuperDouble); return(false);
            }
            SuperDouble sd = ReadSD(line, ref pos);

            val = sd;
            return(true);
        }