summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-numeric-ext
AgeCommit message (Collapse)Author
2021-08-21Organize the include of header filesdearblue
- `#include <math.h>` is done in `mruby.h`. Eliminate the need to worry about the `MRB_NO_FLOAT` macro. - Include mruby header files before standard header files. If the standard header file is already placed before `mruby.h`, the standard header file added in the future tends to be placed before `mruby.h`. This change should some reduce the chances of macros that must be defined becoming undefined in C++ or including problematic header files in a particular mruby build configuration.
2021-08-06numeric_ext.c: fix a bug regarding `MRB_INT_MIN`.Yukihiro "Matz" Matsumoto
2021-08-03numeric_ext.c: `modulo` and `remainder` should handle infinite argument.Yukihiro "Matz" Matsumoto
2021-08-03numeric_ext.c: add `Float#modulo` and `#remainder` methods.Yukihiro "Matz" Matsumoto
2021-08-03numeric_ext.c: update `Integer#remainder` method.Yukihiro "Matz" Matsumoto
- need to detect zero division error - support floating point number argument (as `%`)
2021-08-03numeric_ext.c: use `mrb_integer` instead of `mrb_as_int`.Yukihiro "Matz" Matsumoto
`mrb_as_int` implicitly converts the value into the integer, but those methods are defined for Integer class so that the value should always be integers.
2021-08-03numeric_ext.c: define `modulo` and `remainder` methods for `Integer`.Yukihiro "Matz" Matsumoto
2021-08-03numeric_ext.c: remove unnecessary prefix `mrb_` from static functions.Yukihiro "Matz" Matsumoto
2021-07-25Remove redundant include headers.Yukihiro "Matz" Matsumoto
- stdlib.h - stddef.h - stdint.h - stdarg.h - limits.h - float.h
2021-05-17Global renaming regarding `integer` and `float`.Yukihiro "Matz" Matsumoto
Consistent number conversion function names: * `mrb_value` to immediate (C) value * `mrb_int()` -> `mrb_as_int()` * `mrb_to_flo()` -> `mrb_as_float()` * `mrb_value` to `mrb_value` (converted) * `mrb_to_int()' * `mrb_Integer()` - removed * `mrb_Float()` -> `mrb_to_float` Consistent function name (avoid `_flo` suffix): * `mrb_div_flo()` -> `mrb_div_float`
2021-01-26Revert "Minimize the changes in #5277"Yukihiro "Matz" Matsumoto
This reverts commit dc51d89ac22acc60b9bfeed87115863565b74085.
2021-01-22Minimize the changes in #5277Yukihiro "Matz" Matsumoto
Instead of including `mruby/presym.h` everywhere, we provided the fallback `mruby/presym.inc` under `include/mruby` directory, and specify `-I<build-dir>/include` before `-I<top-dir>/include` in `presym.rake`. So even when someone drops `-I<build-dir>/include` in compiler options, it just compiles without failure.
2021-01-11Avoid including `presym.inc` in existing header filesKOBAYASHI Shuji
Addressed an issue where existing programs linking `libmruby.a` could only be built by adding `<build-dir>/include` to compiler's include path.
2020-10-12Reorganize `Integer` system.Yukihiro "Matz" Matsumoto
- Integrate `Fixnum` and `Integer` - Remove `Integral` - `int / int -> int` - Replace `mrb_fixnum()` to `mrb_int()` - Replace `mrb_fixnum_value()` to `mrb_int_value()`. - Use `mrb_integer_p()` instead of `mrb_fixnum_p()`
2020-10-12Rename float configuration option names.Yukihiro "Matz" Matsumoto
- `MRB_WITHOUT_FLOAT` => `MRB_NO_FLOAT` - `MRB_USE_FLOAT` => `MRB_USE_FLOAT32` The former is to use `USE_XXX` naming convention. The latter is to make sure `float` is 32bit float and not floating point number in general.
2020-10-12Use functions that take symbols to reduce string litrals in C.Yukihiro "Matz" Matsumoto
2019-08-05Merge pull request #4614 from ↵Yukihiro "Matz" Matsumoto
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-04Use `mrb_int()` instead of `to_int()` in `mruby-numeric-ext`KOBAYASHI Shuji
2019-08-04Add constants for floating point numberdearblue
2019-07-21Integrate `Integral#chr` (`Fixnum#chr`) to `mruby-string-ext`KOBAYASHI Shuji
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-05-17Move `Integral#(zero|nonzero|positive|negative)?` to `Numeric`KOBAYASHI Shuji
Because these methods work if object is `Comparable`, and `Numeric` is `Comparable`.
2019-05-17Move `Numeric#div` to the core.Yukihiro "Matz" Matsumoto
2019-01-03Remove `Kernel#class_defined?` which is not available in CRuby; #3829Yukihiro "Matz" Matsumoto
2018-11-19Remove implicit conversion using `to_int` method.Yukihiro "Matz" Matsumoto
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).
2017-12-26Add `Integer#{allbits?,anybits?,nobits?}. [Ruby2.5]Yukihiro "Matz" Matsumoto
In mruby, those methods are defined in `Integral` module.
2017-12-26Move `Intefer#chr` to `Integral#chr`.Yukihiro "Matz" Matsumoto
Since mruby mixes `Integer` and `Float`, integer operations have been moved to `Integral` module.
2017-11-04Merge branch 'master' of github.com:mruby/mrubyYAMAMOTO Masaya
2017-10-18Add `Numeric#{positive?,negative?}`; CRuby2.3Yukihiro "Matz" Matsumoto
2017-10-16Support MRB_WIHTOUT_FLOAT to mruby-numeric-ext (test only)YAMAMOTO Masaya
2015-11-27include changed from by quotes ("") to by brackets (<>); close #3032Yukihiro "Matz" Matsumoto
2015-11-20support Numeric#zero? and Numeric#nonzero?takahashim
2015-06-28Rename extended xxxx class or module to xxxx class or module extensionJun Hiroe
2015-06-28Fix typo; Replace extensional with extendedJun Hiroe
2014-07-12Run mrbgem and core tests on minimum dependencies.take_cheeze
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-03-17move summary of mrbgems in default gembox to its spectake_cheeze
2014-03-04add Integer#div and Float#div.Tomoyuki Sahara
2014-02-27Test for UTF-8 as mattn suggests.chasonr
The string is "Hello world" in Japanese. (hat tip: Google Translate.)
2014-02-26Update the Fixnum#chr test for UTF-8.chasonr
2014-01-07remove superfluous includescremno
- 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)
2013-08-04Improve test of mruby-numeric-ext GEMDaniel Bovensiepen
2013-07-23"spec.author" is better for single-author gems.Tomoyuki Sahara
"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-04-25rename every ARGS_XXX to MRB_ARGS_XXX; ref #1206Yukihiro "Matz" Matsumoto
2013-04-01Fix to fit new raisef format.Masaki Muranaka
2013-03-29Remove limits.h from numeric.h. Add limits.h to some C files.Masaki Muranaka
2013-03-08define and use print format macros for mrb_intCremno
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-08fix commentKouki Ooyatsu
2013-03-08add Integer#chr test case: multibyte (raise RangeError)Kouki Ooyatsu
2013-03-08add mrbgems/ext/mruby-numeric, and method: Integer#chrKouki Ooyatsu