File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -8293,6 +8293,9 @@ Assignment Operators
82938293&&= ||=
82948294` ` `
82958295
8296+ Note: in V, ` assert -10 % 7 == -3` passes. In programming, the sign of the remainder
8297+ depends upon the signs of divisor and dividend.
8298+
82968299# # Other online resources
82978300
82988301# ## [V contributing guide](https://github.com/vlang/v/blob/master/CONTRIBUTING.md)
Original file line number Diff line number Diff line change @@ -470,6 +470,8 @@ pub fn (dividend Integer) / (divisor Integer) Integer {
470470//
471471// WARNING: this method will panic if `divisor == 0`. For a modular division method that
472472// returns a Result refer to `mod_checked`.
473+ // Note: in V, `assert big.integer_from_i64(-10) % big.integer_from_i64(7) == big.integer_from_i64(-3)` passes.
474+ // In other words, the result is negative 3, and is NOT positive 4.
473475@[inline]
474476pub fn (dividend Integer) % (divisor Integer) Integer {
475477 if dividend.signum == - 1 {
You can’t perform that action at this time.
0 commit comments