public static int Limit(RubyContext /*!*/ context, RubyClass /*!*/ self, int n) { BigDecimal.Config config = GetConfig(context); int limit = config.Limit; config.Limit = n; return(limit); }
public static int Limit(RubyContext /*!*/ context, RubyClass /*!*/ self, int n) { if (n < 0) { throw RubyExceptions.CreateArgumentError("argument must be positive"); } BigDecimal.Config config = GetConfig(context); int limit = config.Limit; config.Limit = n; return(limit); }
public static BigDecimal /*!*/ Div(RubyContext /*!*/ context, BigDecimal /*!*/ self, BigDecimal /*!*/ other) { if (BigDecimal.IsFinite(other)) { BigDecimal.Config config = GetConfig(context); BigDecimal remainder; BigDecimal result = BigDecimal.Divide(config, self, other, 0, out remainder); if (BigDecimal.IsFinite(result)) { return(BigDecimal.IntegerPart(config, result)); } } return(BigDecimal.NaN); }
public static int Mode(RubyContext /*!*/ context, RubyClass /*!*/ self, int mode, object value) { if (value == null) { return(Mode(context, self, mode)); } if (mode == ROUND_MODE) { if (value is int) { GetConfig(context).RoundingMode = (BigDecimal.RoundingModes)value; return((int)value); } else { throw RubyExceptions.CreateUnexpectedTypeError(context, value, "Fixnum"); } } else { if (value is bool) { BigDecimal.Config config = GetConfig(context); if (Enum.IsDefined(typeof(BigDecimal.OverflowExceptionModes), mode)) { BigDecimal.OverflowExceptionModes enumMode = (BigDecimal.OverflowExceptionModes)mode; if ((bool)value) { config.OverflowMode = config.OverflowMode | enumMode; } else { config.OverflowMode = config.OverflowMode & (BigDecimal.OverflowExceptionModes.All ^ enumMode); } } return((int)config.OverflowMode); } else { throw RubyExceptions.CreateTypeError("second argument must be true or false"); } } }
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)); }
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))); }
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)); }
public static BigDecimal /*!*/ Subtract(RubyContext /*!*/ context, BigDecimal /*!*/ self, int other) { BigDecimal.Config config = GetConfig(context); return(BigDecimal.Subtract(config, self, BigDecimal.Create(config, other))); }
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)); }