Beispiel #1
0
 public byte[] ToByteArray()
 {
     return(numberState == 0 ? bigDecimal.MovePointRight(bigDecimal.Scale).ToBigInteger().ToByteArray() : new byte[0]);
 }
Beispiel #2
0
 public byte[] ToByteArray()
 {
     return(State == NumericState.None
                         ? innerValue.MovePointRight(innerValue.Scale).ToBigInteger().ToByteArray()
                         : new byte[0]);
 }
Beispiel #3
0
 public void MovePointRightI()
 {
     BigDecimal movePtRight = BigDecimal.Parse("-1.58796521458");
     BigDecimal alreadyMoved = movePtRight.MovePointRight(8);
     Assert.IsTrue(alreadyMoved.Scale == 3 && alreadyMoved.ToString().Equals("-158796521.458"),
                   "move point right 8 failed");
     movePtRight = new BigDecimal(value, 2);
     alreadyMoved = movePtRight.MovePointRight(4);
     Assert.IsTrue(alreadyMoved.Scale == 0 && alreadyMoved.ToString().Equals("1234590800"), "move point right 4 failed");
     movePtRight = new BigDecimal(134E12);
     alreadyMoved = movePtRight.MovePointRight(2);
     Assert.IsTrue(alreadyMoved.Scale == 0 && alreadyMoved.ToString().Equals("13400000000000000"),
                   "move point right 2 failed");
     movePtRight = new BigDecimal(-3.4E-10);
     alreadyMoved = movePtRight.MovePointRight(5);
     Assert.IsTrue(alreadyMoved.Scale == movePtRight.Scale - 5 && alreadyMoved.ToDouble() == -0.000034,
                   "move point right 5 failed");
     alreadyMoved = alreadyMoved.MovePointRight(-5);
     Assert.IsTrue(alreadyMoved.Equals(movePtRight), "move point right -5 failed");
 }