diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-05-03 17:14:26 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-05-07 08:38:46 +0900 |
| commit | e82b8b7bf89ae8c69098eaf8bdcae632e7b9c41a (patch) | |
| tree | 7cc6a4743dfc61cac1c2937147cbb799fc166285 | |
| parent | 91368c117c787ad9718b3bcbc5bc07d5a73c15dd (diff) | |
| download | mruby-e82b8b7bf89ae8c69098eaf8bdcae632e7b9c41a.tar.gz mruby-e82b8b7bf89ae8c69098eaf8bdcae632e7b9c41a.zip | |
Update `cmpnum` document.
`cmpnum` function may return `nil` on error.
| -rw-r--r-- | src/numeric.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/numeric.c b/src/numeric.c index 6cfd64280..d1fa47fd0 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -1474,13 +1474,14 @@ cmpnum(mrb_state *mrb, mrb_value v1, mrb_value v2) /* 15.2.9.3.6 */ /* * call-seq: - * self.f <=> other.f => -1, 0, +1 + * self.f <=> other.f => -1, 0, +1, or nil * < => -1 * = => 0 * > => +1 * Comparison---Returns -1, 0, or +1 depending on whether <i>fix</i> is * less than, equal to, or greater than <i>numeric</i>. This is the - * basis for the tests in <code>Comparable</code>. + * basis for the tests in <code>Comparable</code>. When the operands are + * not comparable, it returns nil instead of raising an exception. */ static mrb_value integral_cmp(mrb_state *mrb, mrb_value self) |
