32 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 96ce4563bd Merge pull request #4614 from shuujii/use-mrb_int-instead-of-to_int-in-mruby-numeric-ext
Use `mrb_int()` instead of `to_int()` in `mruby-numeric-ext`
2019-08-05 12:33:59 +09:00
KOBAYASHI Shuji d599e35aa4 Use mrb_int() instead of to_int() in mruby-numeric-ext 2019-08-04 22:02:39 +09:00
dearblue eb86340139 Add constants for floating point number 2019-08-04 18:34:46 +09:00
KOBAYASHI Shuji c980fe2792 Integrate Integral#chr (Fixnum#chr) to mruby-string-ext
Because they're defined in both `mruby-string-ext` and `mruby-numeric-ext`
(they seem more natural to define in N, but `mruby-string-ext` depends on
`Integral#chr`).
2019-07-21 22:59:41 +09:00
KOBAYASHI Shuji c5c39f585b Move Integral#(zero|nonzero|positive|negative)? to Numeric
Because these methods work if object is `Comparable`, and `Numeric` is
`Comparable`.
2019-05-17 21:13:31 +09:00
Yukihiro "Matz" Matsumoto 223defd62a Move Numeric#div to the core. 2019-05-17 11:26:16 +09:00
Yukihiro "Matz" Matsumoto cca19532c5 Remove Kernel#class_defined? which is not available in CRuby; #3829 2019-01-03 11:34:35 +09:00
Yukihiro "Matz" Matsumoto afca99a40b Remove implicit conversion using to_int method.
The ISO standard does not include implicit type conversion using
`to_int`. This implicit conversion often causes vulnerability.
There will be no more attacks like #4120.

In addition, we have added internal convenience method `__to_int` which
does type check and conversion (from floats).
2018-11-19 11:28:51 +09:00
Yukihiro "Matz" Matsumoto 6b09692684 Add `Integer#{allbits?,anybits?,nobits?}. [Ruby2.5]
In mruby, those methods are defined in `Integral` module.
2017-12-26 09:44:39 +09:00
Yukihiro "Matz" Matsumoto 3d7141b7fe Move Intefer#chr to Integral#chr.
Since mruby mixes `Integer` and `Float`, integer operations have
been moved to `Integral` module.
2017-12-26 09:42:34 +09:00
YAMAMOTO Masaya 625f9f6fa3 Merge branch 'master' of github.com:mruby/mruby 2017-11-04 01:23:12 +09:00
Yukihiro "Matz" Matsumoto b5dfbce767 Add Numeric#{positive?,negative?}; CRuby2.3 2017-10-18 10:10:37 +09:00
YAMAMOTO Masaya b0cdb93a3a Support MRB_WIHTOUT_FLOAT to mruby-numeric-ext (test only) 2017-10-16 18:14:34 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
takahashim 40a9700ef8 support Numeric#zero? and Numeric#nonzero? 2015-11-20 23:39:45 +09:00
Jun Hiroe 4e4929bc72 Rename extended xxxx class or module to xxxx class or module extension 2015-06-28 11:18:52 +09:00
Jun Hiroe c69d1201e1 Fix typo; Replace extensional with extended 2015-06-28 00:05:58 +09:00
take_cheeze 4a6c651f82 Run mrbgem and core tests on minimum dependencies.
Solves #2355.

In test drivers:
* Uses `mrb_t_pass_result` to check and pass test result to main `mrb_state`.
* Adds `mrb_init_test_driver` to init test `mrb_state`.
2014-07-12 20:36:45 +09:00
take_cheeze c73f8d4def move summary of mrbgems in default gembox to its spec 2014-03-17 00:34:24 +09:00
Tomoyuki Sahara 4ad0896bda add Integer#div and Float#div. 2014-03-04 12:45:11 +09:00
chasonr d60944ef3a Test for UTF-8 as mattn suggests.
The string is "Hello world" in Japanese.  (hat tip:  Google Translate.)
2014-02-27 23:42:07 -05:00
chasonr b752b01a56 Update the Fixnum#chr test for UTF-8. 2014-02-26 20:53:23 -05:00
cremno aa655b9ee1 remove superfluous includes
- reduce compile time by a little bit (full-core: ~0.7s for me)
- thanks to 'include-what-you-use' for some help
- include Standard C header files before any other (coding style)
2014-01-07 17:56:30 +01:00
Daniel Bovensiepen 9a7efd69ee Improve test of mruby-numeric-ext GEM 2013-08-04 22:41:26 +08:00
Tomoyuki Sahara 116f75a8ce "spec.author" is better for single-author gems.
"spec.author=" expects a String represents a single author.
"spec.authors=" expects an Array which is a list of multiple authors.

http://guides.rubygems.org/specification-reference/
2013-07-23 10:09:24 +09:00
Yukihiro "Matz" Matsumoto 30d580ecbc rename every ARGS_XXX to MRB_ARGS_XXX; ref #1206 2013-04-25 09:47:36 +09:00
Masaki Muranaka 2ae9b08b37 Fix to fit new raisef format. 2013-04-01 09:03:20 +09:00
Masaki Muranaka a01e968cdb Remove limits.h from numeric.h. Add limits.h to some C files. 2013-03-29 10:06:40 +09:00
Cremno f719b0e7ff define and use print format macros for mrb_int
For portability: %ld can't be used to print a 64-bit mrb_int on
WIN(32|64) because long is 32-bit wide.
2013-03-08 18:20:54 +01:00
Kouki Ooyatsu d3ff90f5fc fix comment 2013-03-08 10:42:28 +09:00
Kouki Ooyatsu 6dfc276230 add Integer#chr test case: multibyte (raise RangeError) 2013-03-08 10:42:18 +09:00
Kouki Ooyatsu 6c066302e2 add mrbgems/ext/mruby-numeric, and method: Integer#chr 2013-03-08 10:05:41 +09:00