summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-rational
AgeCommit message (Collapse)Author
2021-02-08`i_gcd()` does not work for `MRB_INT_MIN`.Yukihiro "Matz" Matsumoto
2021-01-28Remove unnecessary bit shift in `rational_new_f`.Yukihiro "Matz" Matsumoto
2021-01-26Revert "Minimize the changes in #5277"Yukihiro "Matz" Matsumoto
This reverts commit dc51d89ac22acc60b9bfeed87115863565b74085.
2021-01-25Silence 'loss of data' warnings.Yukihiro "Matz" Matsumoto
2021-01-25Fix a bug for the case `frexp()` return `Infinity`.Yukihiro "Matz" Matsumoto
2021-01-25Should use a limit for 32 bit platform; ref 05a8cc44Yukihiro "Matz" Matsumoto
2021-01-24Define `RAT_INT_LIMIT` for 32 bit platforms.Yukihiro "Matz" Matsumoto
2021-01-24Detect integer overflow in `rational_new_f()`.Yukihiro "Matz" Matsumoto
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-21Merge branch 'avoid-including-presym.inc-in-existing-header-files' of ↵Yukihiro "Matz" Matsumoto
https://github.com/shuujii/mruby into shuujii-avoid-including-presym.inc-in-existing-header-files
2021-01-17Define `Rational#quo`; fix #5268Yukihiro "Matz" Matsumoto
2021-01-13Rational denominator should not be zero.Yukihiro "Matz" Matsumoto
2021-01-12Silence Windows warnings (cast and `setmode`).Yukihiro "Matz" Matsumoto
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.
2021-01-10Fix CI failure on Windows environment.Yukihiro "Matz" Matsumoto
`1L` on Windows means `32 bit int`.
2021-01-09Fix wrong float to rational conversion in 32 bit mode.Yukihiro "Matz" Matsumoto
2021-01-09Convert float number to rational by decoding mantissa.Yukihiro "Matz" Matsumoto
2021-01-02Avoid `int64_t` on 32 bit platforms.Yukihiro "Matz" Matsumoto
2021-01-02Check `NaN` and `Infinity` before converting `Float` to `Rational`.Yukihiro "Matz" Matsumoto
2020-12-24Avoid division by zero in `rational_to_f()`.Yukihiro "Matz" Matsumoto
2020-12-15refactor: remove trailing whitespace from C, Header, Ruby and YAML filesJohn Bampton
Lint
2020-11-26Avoid integer overflow in `rational_new`.Yukihiro "Matz" Matsumoto
2020-11-17Check division overflow (`MRB_INT_MIN` and `-1`).Yukihiro "Matz" Matsumoto
2020-11-04Add cast to silence int conversion warnings.Yukihiro "Matz" Matsumoto
2020-10-12Fix warning from VC regarding implicit int conversion.Yukihiro "Matz" Matsumoto
2020-10-12Made `Rational` overhaul.Yukihiro "Matz" Matsumoto
- Implement `Rational()` in `C`. - Use `float` to `rational` conversion function taken from: https://rosettacode.org/wiki/Convert_decimal_number_to_rational#C
2020-10-12Handle integer overflow in `rational_s_new`.Yukihiro "Matz" Matsumoto
2020-10-12Use `mrb_int_value()` instead of `mrb_fixnum_value()`.Yukihiro "Matz" Matsumoto
Where fixnum overflow can happen.
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-12Integrate `Fixnum` class into `Integer` classdearblue
* The `Fixnum` constant is now an alias for the `Integer` class. * Remove `struct mrb_state::fixnum_class` member. If necessary, use `struct mrb_state::integer_class` instead.
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-12Add explicit cast to `DROP_PRECISION` macro in `rational.c`.Yukihiro "Matz" Matsumoto
2020-10-12Use `mrb->eStandardError` instead of `mrb_exc_get()`.Yukihiro "Matz" Matsumoto
2020-06-20Symbolify saved alias name to improve performance.Yukihiro "Matz" Matsumoto
2020-06-04Add explicit cast to `DROP_PRECISION` macro in `rtional.c`.Yukihiro "Matz" Matsumoto
2020-06-04Add explicit cast to silence warnings on AppVeyor.Yukihiro "Matz" Matsumoto
2019-07-30Refine message to `skip` in nested `assert`KOBAYASHI Shuji
- I think "Info" is used only to `skip`, so change to "Skip". - Changed the default value of `assert` and specify the argument explicitly at the caller of `assert` because it is unnatural "Assertion failed" is output even though the assertion doesn't fail. == Example: def assert_foo(exp, act) assert do assert_equal exp[0], act[0] assert_equal exp[1], act[1] end end def assert_bar(exp, act) assert do skip end end def assert_baz(exp, act) assert do assert_equal exp, act assert_bar exp, act end end assert 'test#skip_in_nested_assert' do assert_baz 1, 1 end === Before this patch: ?.. Info: test#skip_in_nested_assert (core) - Assertion[1] Info: Assertion failed (core) - Assertion[1-2] Skip: Assertion failed (core) Total: 3 OK: 2 KO: 0 Crash: 0 Warning: 0 Skip: 1 === After this patch: ??? Skip: test#skip_in_nested_assert (core) - Assertion[1] Skip: assert (core) - Assertion[1-2] Skip: assert (core) Total: 3 OK: 0 KO: 0 Crash: 0 Warning: 0 Skip: 3
2019-07-24Call `MRB_SET_INSTANCE_TT` for `Complex` and `Rational`.Yukihiro "Matz" Matsumoto
2019-07-18Avoid making top-level `env` in initialization code; ref #4581Yukihiro "Matz" Matsumoto
2019-06-29Use nested `assert`dearblue
2019-06-05Drop precisions for rational when big numbersdearblue
2019-06-05Fix build error if `struct mrb_rational` is bigger than `RIStruct`dearblue
In that case, to be switched implementation with `RData`. It is based to "complex".
2019-05-29Slightly simplify `Rational#==`; ref #4475Yukihiro "Matz" Matsumoto
2019-05-27Fix `Rational#==(Complex)`KOBAYASHI Shuji
Consider a Numreic class like `Complex` that does not have `<=>` but `==` works (`0i == 0r` is `true`).
2019-05-23Freeze `Rational` and `Complex` objectsKOBAYASHI Shuji
2019-05-22`Kernel#Rational` requires numeratorKOBAYASHI Shuji
2019-05-21Implements part of `Complex` class in C.Yukihiro "Matz" Matsumoto
2019-05-21Should not refer `Float` class in case of `MRB_WITHOUT_FLOAT`.Yukihiro "Matz" Matsumoto
This commit removes `Float` from `rational.c`.
2019-05-21Move `**`,`/`,`quo`,`div` and comparison methods to Integral from NumericKOBAYASHI Shuji
Having these methods in Numeric can get in the way of creating subclasses of Numeric because they only support Fixnum and Float.
2019-05-21Revert part of #4457KOBAYASHI Shuji