todo: check negative value with big.Int
(other IntValue)
| 280 | |
| 281 | // todo: check negative value with big.Int |
| 282 | func (self IntValue) Mod(other IntValue) (IntValue, error) { |
| 283 | if other.IsZero() { |
| 284 | return IntValue{}, errors.ERR_DIV_MOD_BY_ZERO |
| 285 | } |
| 286 | return self.intOp(other, func(a, b int64) (int64, bool) { |
| 287 | return a % b, true |
| 288 | }, func(a, b *big.Int) (IntValue, error) { |
| 289 | return IntValFromBigInt(new(big.Int).Rem(a, b)) |
| 290 | }) |
| 291 | } |
| 292 | |
| 293 | // todo: check negative value with big.Int |
| 294 | func (self IntValue) Div(other IntValue) (IntValue, error) { |