Yukihiro "Matz" Matsumoto
fa3ac351ff
complex.c: override float division to support Complex.
2021-03-24 11:04:58 +09:00
Yukihiro "Matz" Matsumoto
afb3c00e8c
Use div_flo (copy of mrb_num_div_flo) for float division.
2021-03-24 10:56:01 +09:00
Yukihiro "Matz" Matsumoto
ec456e5b18
Use mrb_num_div_flo for float division.
...
This function handles zero division properly. Also fixed bugs that multiply
numbers instead of division.
2021-03-24 10:54:24 +09:00
Yukihiro "Matz" Matsumoto
98799aa6b8
Fix infinite recursive call bugs in integer division.
2021-03-24 10:52:31 +09:00
Yukihiro "Matz" Matsumoto
3deb62d653
complex.c: implement Complex#/ and #quo in C.
2021-03-24 10:27:49 +09:00
Yukihiro "Matz" Matsumoto
5573707d7f
complex.c: implement Complex#* in C.
2021-03-24 09:53:39 +09:00
Yukihiro "Matz" Matsumoto
dc5d74dda8
rational.rb: avoid 'NaNi` representation.
...
Use `NaN*i` as CRuby does.
2021-03-24 09:52:15 +09:00
Yukihiro "Matz" Matsumoto
6e1a13360f
Add `timeout-minutes' to GitHub workflow. [ci skip]
2021-03-23 15:02:48 +09:00
Yukihiro "Matz" Matsumoto
30576bf3c6
Merge pull request #5387 from shuujii/use-global-defines-for-mruby-bin-debugger
...
Use global defines for `mruby-bin-debugger`
2021-03-22 12:43:58 +09:00
Yukihiro "Matz" Matsumoto
2e87d83d8d
Merge pull request #5388 from shuujii/reorganize-types-for-ObjectSpace.count_objects
...
Reorganize types for `ObjectSpace.count_objects`
2021-03-22 12:43:13 +09:00
Yukihiro "Matz" Matsumoto
7479ae307b
nintendo_switch.rb: remove trailing white spaces; #5386
2021-03-22 12:39:48 +09:00
KOBAYASHI Shuji
c0fb675526
Reorganize types for ObjectSpace.count_objects
...
#### Addition
- T_COMPLEX
- T_RATIONAL
#### Deletion
- T_FALSE
- T_FREE
- T_TRUE
- T_SYMBOL
- T_UNDEF
2021-03-22 12:24:42 +09:00
Yukihiro "Matz" Matsumoto
dc6e7d5414
Merge pull request #5386 from LanzaSchneider/master
...
Add example for cross-compiling to Nintendo Switch
2021-03-22 12:06:59 +09:00
Yukihiro "Matz" Matsumoto
cd047b2989
Merge pull request #5385 from shuujii/add-configuration-for-MinGW-cross-compilation
...
Add configuration for MinGW cross compilation [ci skip]
2021-03-22 12:05:03 +09:00
KOBAYASHI Shuji
00a13e22dd
Use global defines for mruby-bin-debugger
2021-03-22 12:02:26 +09:00
Yukihiro "Matz" Matsumoto
68cf8346cd
Use global defines for Rational and Complex.
2021-03-22 10:59:35 +09:00
Yukihiro "Matz" Matsumoto
384865997d
build: provide global defines by build.defines.
2021-03-22 10:58:47 +09:00
Yukihiro "Matz" Matsumoto
fbc629c56f
codegen.c: fix integer size warnings.
...
along with repeated calls of `strlen()`.
2021-03-22 10:57:36 +09:00
Lanza
ad09c39514
Add example for cross-compiling to Nintendo Switch
...
Cross Compiling configuration for the Nintendo Switch, it requires Nintendo SDK
2021-03-21 16:58:42 +08:00
KOBAYASHI Shuji
b2c3ab8f3f
Add configuration for MinGW cross compilation [ci skip]
...
With this cross compiler configuration, all tests for full-core gembox on
Windows on GitHub Actions were successful.
2021-03-21 16:43:04 +09:00
Yukihiro "Matz" Matsumoto
5764ff0740
command.rb: replace %w() to plain [].
2021-03-21 13:23:35 +09:00
Yukihiro "Matz" Matsumoto
73056aeb2b
complex.c: define Complex#== in C.
...
This change also fixes the error caused by `rational.c` that calls
`mrb_complex_eq()`, which had been undefined.
2021-03-21 08:30:52 +09:00
Yukihiro "Matz" Matsumoto
a6d4477a09
memsize.c: handle MRB_TT_RATIONAL and MRB_TT_COMPLEX.
2021-03-21 08:29:05 +09:00
Yukihiro "Matz" Matsumoto
e21f293de5
rational.c: fix MRB_TT_RATIONAL and MRB_TT_COMPLEX confusion.
2021-03-20 18:03:11 +09:00
Yukihiro "Matz" Matsumoto
98821d2725
random.c: fixed seed underflow bug.
...
`MRB_INT_MIN` does not have a corresponding positive value.
2021-03-20 14:40:54 +09:00
Yukihiro "Matz" Matsumoto
d3184e4a6d
complex.c: overhaul complex operators.
...
- define `MRB_TT_COMPLEX`
- change object structure (`struct RComplex`)
- add memory management for `MRB_TT_COMPLEX`
- avoid operator overloading as much as possible
- as a result, performance improved a log
- should work with and without `Rational` defined
2021-03-19 10:37:10 +09:00
Yukihiro "Matz" Matsumoto
08f9d5bab5
rational.c: overhaul rational operators.
...
- define `MRB_TT_RATIONAL`
- change object structure (`struct RRational`)
- add memory management for `MRB_TT_RATIONAL`
- avoid operator overloading as much as possible
- implement division overloading in C
- as a result, performance improved a lot
2021-03-19 10:37:10 +09:00
Yukihiro "Matz" Matsumoto
eb07030308
numeric.c: avoid integer overflow; close #5384
...
Since `mruby` does not have `Bignum`, `Float#divmod` could overflow, so
it will return `Float` values when the divided value does not fit in
`mrb_int`. This behavior will be changed when `Bignum` is introduced to
`mruby` in the future.
2021-03-19 07:15:05 +09:00
Yukihiro "Matz" Matsumoto
087e1719e4
Float#divmod with zero should cause ZeroDivisionError; #5384
2021-03-19 07:13:19 +09:00
Yukihiro "Matz" Matsumoto
0d96c1bb40
Merge branch 'dearblue-break-in-conf'
2021-03-18 22:48:11 +09:00
Yukihiro "Matz" Matsumoto
0e4f438eca
lib/mruby/build.rb: refactoring ensure clause; ref #5381
2021-03-18 22:47:00 +09:00
Yukihiro "Matz" Matsumoto
99f00de040
Merge branch 'break-in-conf' of https://github.com/dearblue/mruby into dearblue-break-in-conf
2021-03-18 22:34:31 +09:00
Yukihiro "Matz" Matsumoto
e5a3a37ae9
Merge pull request #5383 from shuujii/floatNAN-0-should-be-FloatNAN
...
`Float::NAN/0` should be `Float::NAN`; ref a0b3378b3
2021-03-18 20:54:56 +09:00
KOBAYASHI Shuji
6731f935cc
Float::NAN/0 should be Float::NAN; ref a0b3378b3
...
#### Before this patch:
```console
$ bin/mruby -e 'p(Float::NAN/0)'
Infinity
```
#### After this patch (same as Ruby):
```console
$ bin/mruby -e 'p(Float::NAN/0)'
NaN
```
2021-03-18 17:10:51 +09:00
Yukihiro "Matz" Matsumoto
a0b3378b36
numeric.c: float zero division should be infinity with sign kept; fix #5382
2021-03-18 15:24:31 +09:00
dearblue
199bbd73a3
Allow break in build_config.
...
If I break out of a block given to `MRuby::Build.new` with `break` or `throw`, I will get a seemingly inexplicable error because the `presym`-related initialization is not done.
```console
% cat build_config1.rb
MRuby::Build.new do
toolchain
break
end
% rake CONFIG=build_config1.rb
rake aborted!
external mrbc or mruby-bin-mrbc gem in current('host') or 'host' build is required
/var/tmp/mruby/lib/mruby/build.rb:332:in `mrbcfile'
/var/tmp/mruby/tasks/mrblib.rake:9:in `block in <top (required)>'
/var/tmp/mruby/lib/mruby/build.rb:18:in `instance_eval'
/var/tmp/mruby/lib/mruby/build.rb:18:in `block in each_target'
/var/tmp/mruby/lib/mruby/build.rb:17:in `each'
/var/tmp/mruby/lib/mruby/build.rb:17:in `each_target'
/var/tmp/mruby/tasks/mrblib.rake:1:in `<top (required)>'
/var/tmp/mruby/Rakefile:27:in `load'
/var/tmp/mruby/Rakefile:27:in `<top (required)>'
(See full trace by running task with --trace)
```
If a non-exceptional global jump occurs, it can be initialized by `ensure` to solve this problem.
2021-03-17 23:01:52 +09:00
Yukihiro "Matz" Matsumoto
c0d63ea09f
hash.c: Hash#shift to return nil when a hash is empty.
...
It used to be return the default value if available, but it should
ignore the default value for behavior consistency. CRuby will adopt
this behavior too in the future. [ruby-bugs:16908]
2021-03-17 15:14:23 +09:00
Yukihiro "Matz" Matsumoto
75ae3d3e23
range.c: fixed a begin-less ranges issue.
2021-03-17 09:48:27 +09:00
Yukihiro "Matz" Matsumoto
80f6b14ac1
AUTHORS: add the commit hash as of we counted.
2021-03-16 19:32:08 +09:00
Yukihiro "Matz" Matsumoto
f576482082
Merge pull request #5379 from shuujii/fix-typo-in-AUTHORS
...
Fix typo in `AUTHORS` [ci skip]
2021-03-15 12:41:33 +09:00
KOBAYASHI Shuji
def2ba56fd
Fix typo in AUTHORS [ci skip]
2021-03-15 12:29:30 +09:00
Yukihiro "Matz" Matsumoto
266eccdf91
AUTHOR: fixed typos.
2021-03-15 11:57:49 +09:00
Yukihiro "Matz" Matsumoto
d433a4e825
AUTHORS: add 2 new GitHub accounts.
2021-03-15 11:23:41 +09:00
Yukihiro "Matz" Matsumoto
a3e73de2ba
AUTHORS: re-renamed from AUTHOR.md.
2021-03-15 11:03:26 +09:00
Yukihiro "Matz" Matsumoto
5158b73ab4
AUTHORS.md: add GitHub accounts if available.
2021-03-15 10:32:55 +09:00
Yukihiro "Matz" Matsumoto
be2bdce17d
Remove mail addresses from AUTHORS.md.
2021-03-14 19:14:43 +09:00
Yukihiro "Matz" Matsumoto
bf524e7002
time.c: calendar clock should use CLOCK_REALTIME; 5e95f11
...
The issue was reported by @shuujii
2021-03-14 14:54:53 +09:00
Yukihiro "Matz" Matsumoto
f92a27f918
codegen.c: fix memory leak from new_litbn().
2021-03-13 09:33:16 +09:00
Yukihiro "Matz" Matsumoto
bf2110d206
codegen.c: need to preserve neg info.
2021-03-12 18:34:29 +09:00
Yukihiro "Matz" Matsumoto
01fdf03bce
codegen.c: fixed a typo.
2021-03-12 18:34:09 +09:00