コード例 #1
0
        public void ToInt64()
        {
            BigDecimal long1 = new BigDecimal(value2.Negate(), 0);

            Assert.IsTrue(long1.ToInt64() == -12334560000L, "the long value of 12334560000 is not 12334560000");
            long1 = new BigDecimal(-1345.348E-123D);
            Assert.IsTrue(long1.ToInt64() == 0, "the long value of -1345.348E-123D is not zero");
            long1 = BigDecimal.Parse("31323423423419083091823091283933");
            // ran JDK and found representation for the above was
            // -5251313250005125155
            Assert.IsTrue(long1.ToInt64() == -5251313250005125155L, "the long value of 31323423423419083091823091283933 is wrong");
        }