Beispiel #1
0
 public static BigDecimal /*!*/ CreateBigDecimal(RubyContext /*!*/ context, RubyClass /*!*/ self, [DefaultProtocol] MutableString /*!*/ value, [Optional] int n)
 {
     return(BigDecimal.Create(GetConfig(context), value.ConvertToString(), n));
 }
Beispiel #2
0
 public static RubyArray /*!*/ Coerce(RubyContext /*!*/ context, BigDecimal /*!*/ self, BigInteger /*!*/ other)
 {
     return(RubyOps.MakeArray2(BigDecimal.Create(GetConfig(context), other.ToString(CultureInfo.InvariantCulture)), self));
 }
Beispiel #3
0
 public static BigDecimal /*!*/ Add(RubyContext /*!*/ context, BigDecimal /*!*/ self, int other, int n)
 {
     BigDecimal.Config config = GetConfig(context);
     return(BigDecimal.Add(config, self, BigDecimal.Create(config, other), n));
 }
Beispiel #4
0
 public static RubyArray /*!*/ DivMod(RubyContext /*!*/ context, BigDecimal /*!*/ self, [NotNull] BigInteger /*!*/ other)
 {
     return(DivMod(context, self, BigDecimal.Create(GetConfig(context), other)));
 }
Beispiel #5
0
 public BigDecimal ToBigDecimal()
 {
     return(_bipart == null?BigDecimal.Create(_lpart) : BigDecimal.Create(_bipart));
 }
Beispiel #6
0
 public static BigDecimal /*!*/ Multiply(RubyContext /*!*/ context, BigDecimal /*!*/ self, [NotNull] BigInteger /*!*/ other)
 {
     BigDecimal.Config config = GetConfig(context);
     return(BigDecimal.Multiply(config, self, BigDecimal.Create(config, other)));
 }
Beispiel #7
0
 public static BigDecimal /*!*/ Modulo(RubyContext /*!*/ context, BigDecimal /*!*/ self, int other)
 {
     return(Modulo(context, self, BigDecimal.Create(GetConfig(context), other)));
 }
Beispiel #8
0
 public void CanConvertBetweenProto()
 {
     ConvertThroughProto(new Numeric(BigDecimal.Create("123456.789")));
     ConvertThroughProto(new Numeric(BigDecimal.Create(LargeInt)));
     ConvertThroughProto(new Numeric(BigDecimal.Create(LargeDecimal)));
 }
Beispiel #9
0
 public static Numeric FromProto(string number) => new Numeric(BigDecimal.Create(number));
Beispiel #10
0
 public static BigDecimal InducedFrom(RubyContext /*!*/ context, RubyClass /*!*/ self, int value)
 {
     return(BigDecimal.Create(GetConfig(context), value.ToString()));
 }
Beispiel #11
0
 public static RubyArray /*!*/ Coerce(RubyContext /*!*/ context, BigDecimal /*!*/ self, int other)
 {
     return(RubyOps.MakeArray2(BigDecimal.Create(GetConfig(context), other.ToString()), self));
 }
Beispiel #12
0
 public static object CreateBigDecimal(RubyContext /*!*/ context, object /*!*/ self, [DefaultProtocol] MutableString value, [Optional] int n)
 {
     return(BigDecimal.Create(BigDecimalOps.GetConfig(context), value.ConvertToString(), n));
 }
Beispiel #13
0
 public static object LessThan(RubyContext /*!*/ context, BigDecimal /*!*/ self, [NotNull] BigInteger /*!*/ other)
 {
     return(LessThenResult(self.CompareBigDecimal(BigDecimal.Create(GetConfig(context), other))));
 }
Beispiel #14
0
 public static object GreaterThan(RubyContext /*!*/ context, BigDecimal /*!*/ self, double other)
 {
     return(GreaterThenResult(self.CompareBigDecimal(BigDecimal.Create(GetConfig(context), other))));
 }
Beispiel #15
0
 public static BigDecimal /*!*/ Subtract(RubyContext /*!*/ context, BigDecimal /*!*/ self, int other)
 {
     BigDecimal.Config config = GetConfig(context);
     return(BigDecimal.Subtract(config, self, BigDecimal.Create(config, other)));
 }
Beispiel #16
0
 public static object LessThanOrEqual(RubyContext /*!*/ context, BigDecimal /*!*/ self, double other)
 {
     return(LessThanOrEqualResult(self.CompareBigDecimal(BigDecimal.Create(GetConfig(context), other))));
 }
Beispiel #17
0
 public static BigDecimal /*!*/ Subtract(RubyContext /*!*/ context, BigDecimal /*!*/ self, [NotNull] BigInteger /*!*/ other, int n)
 {
     BigDecimal.Config config = GetConfig(context);
     return(BigDecimal.Subtract(config, self, BigDecimal.Create(config, other), n));
 }
Beispiel #18
0
 public static bool Equal(RubyContext /*!*/ context, BigDecimal /*!*/ self, [NotNull] BigInteger /*!*/ other)
 {
     return(self.Equals(BigDecimal.Create(GetConfig(context), other)));
 }
Beispiel #19
0
 public static BigDecimal /*!*/ Multiply(RubyContext /*!*/ context, BigDecimal /*!*/ self, double other, int n)
 {
     BigDecimal.Config config = GetConfig(context);
     return(BigDecimal.Multiply(config, self, BigDecimal.Create(config, other), n));
 }
Beispiel #20
0
 public static bool Equal(RubyContext /*!*/ context, BigDecimal /*!*/ self, double other)
 {
     return(self.Equals(BigDecimal.Create(GetConfig(context), other)));
 }
Beispiel #21
0
 public static BigDecimal /*!*/ Modulo(RubyContext /*!*/ context, BigDecimal /*!*/ self, [NotNull] BigInteger /*!*/ other)
 {
     return(Modulo(context, self, BigDecimal.Create(GetConfig(context), other)));
 }
Beispiel #22
0
 public static BigDecimal InducedFrom(RubyContext /*!*/ context, RubyClass /*!*/ self, [NotNull] BigInteger /*!*/ value)
 {
     return(BigDecimal.Create(GetConfig(context), value.ToString(CultureInfo.InvariantCulture)));
 }
Beispiel #23
0
 public static object Compare(RubyContext /*!*/ context, BigDecimal /*!*/ self, int other)
 {
     return(self.CompareBigDecimal(BigDecimal.Create(GetConfig(context), other)));
 }
Beispiel #24
0
 public Number(object initialValue)
 {
     value = BigDecimal.Create(new BigDecimal.Config(), initialValue.ToString());
 }