Yukihiro "Matz" Matsumoto
877f9d02e6
Avoid infinite loop on negative exponent; fix #3677
2017-05-31 09:53:19 +09:00
Yukihiro "Matz" Matsumoto
8e390cccae
Fixed rounding functions (round,ceil,floor,truncate) in MRB_INT64.
...
They didn't work well with inexact numbers (inf,nan). Fix #3671
2017-05-27 23:51:22 +09:00
Yukihiro "Matz" Matsumoto
83fc915213
Add new range check macro FIXABLE_FLOAT(); ref #3652
...
When MRB_INT64, valid value range of mrb_int is bigger than double,
which only has 53 bits significant precision.
2017-05-26 09:54:10 +09:00
Yukihiro "Matz" Matsumoto
3c31278236
Fix indentation in mrb_init_numeric()
2017-05-26 09:31:45 +09:00
Yukihiro "Matz" Matsumoto
535f13f3d7
fixup! Let Fixnum#{ceil,floor,round,truncate} to return itself; #3652
2017-05-26 09:29:39 +09:00
Yukihiro "Matz" Matsumoto
c80696fcd3
Let Fixnum#{ceil,floor,round,truncate} to return itself; #3652
2017-05-26 09:25:16 +09:00
Yukihiro "Matz" Matsumoto
06c4933f90
Try our own ipow() if both base and exp are fixnums; fix #3652
2017-05-26 02:19:07 +09:00
Yukihiro "Matz" Matsumoto
262fbaf566
mrb_int may overflow in bit-shifting; fix #3620
2017-04-21 08:55:19 +09:00
Yukihiro "Matz" Matsumoto
3567b26222
Bit-shifting zero should be zero; ref #3620
2017-04-21 08:36:29 +09:00
Yukihiro "Matz" Matsumoto
77331d127b
Unify else clause style
2017-04-03 16:56:27 +09:00
ksss
db3573e0bf
Should raise FloatDomainError
2017-03-29 11:59:19 +09:00
Yukihiro "Matz" Matsumoto
339c6aed64
Add explicit cast from float to mrb_int.
2017-03-20 02:54:21 +09:00
Yukihiro "Matz" Matsumoto
8b77979667
Initialize potentially uninitialized variable z
2017-01-01 00:45:14 +09:00
Yasuhiro Matsumoto
eda6c1dc05
fix build on vs2013-vs2015
2016-12-08 15:38:19 +09:00
Yukihiro "Matz" Matsumoto
2bb47addad
Prohibit instantiation of immediate objects
2016-11-30 10:36:17 +09:00
Yukihiro "Matz" Matsumoto
efebbbbf26
Implement Float shift methods in C
2016-11-23 09:45:50 +09:00
Yukihiro "Matz" Matsumoto
8cba708854
int64_value(): use FIXABLE()
2016-11-22 19:11:54 +09:00
Yukihiro "Matz" Matsumoto
be73905c9c
accept floats as bit operator operands; fix #3260
2016-11-22 17:59:41 +09:00
Yukihiro "Matz" Matsumoto
8112295031
Removed fix_shift_get_width()
...
Fixnum is usually big enough for shift width.
2016-11-22 17:45:07 +09:00
Yukihiro "Matz" Matsumoto
740bf09740
add bit operators ~,&,|,^ to Float class (mruby special)
2016-11-22 17:36:26 +09:00
Nobuyoshi Nakada
6511bfd79a
Removed trailing spaces
2016-09-28 12:29:41 +09:00
cremno
7453a5dfea
use mrb_int_mul_overflow()
2016-05-10 19:12:02 +02:00
Yukihiro "Matz" Matsumoto
5c405dea3d
include changed from by quotes ("") to by brackets (<>); close #3032
2015-11-27 17:48:23 +09:00
Yukihiro "Matz" Matsumoto
996417cabf
integer range check was moved to mrb_flo_to_fixnum(); ref #3025
2015-11-19 22:49:50 +09:00
murase_syuka
ef95dcd390
Bugfix nagative-number lshift() bit overflow
2015-11-18 21:37:17 +09:00
murase_syuka
a4d5588101
Bugfix lshift() bit overflow; close #3023
2015-11-18 01:00:46 +09:00
murase_syuka
cd1a566002
fix comment
2015-11-16 22:27:42 +09:00
Seba Gamboa
e871b77f41
Increasing docs coverage
2015-10-20 12:16:46 -03:00
Yukihiro "Matz" Matsumoto
3a462fe468
Integer << and >> to use Float instead of raising RangeError
2015-09-02 23:41:51 +09:00
Yukihiro "Matz" Matsumoto
0c7d29dff6
FIXABLE() may work wrong on MRB_INT64; fix #2909
2015-08-07 15:30:52 +09:00
Simon Génier
d6865a9cc7
Avoid a narrowing cast in flo_round under MRB_INT64.
2015-06-29 20:19:19 -04:00
Franck Verrot
2588507285
Remove unnecessary backticks.
...
Dr Markus Kuhn published in 1999 an article [1] explaining in details
why we shouldn't use the ASCII grave accent (0x60) as a left quotation.
Backticks have been used most notably to produce nice-looking LaTeX
documents but it doesn't seem to be an issue on modern platforms and
for the oldest ones, there are workarounds as mentioned by Dr Kuhn.
[1]: https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
2015-06-24 13:07:07 +02:00
cremno
6f893b5183
re-implement mrb_float_to_str()
...
The new implementation is backwards incompatible, but I couldn't find
any usage outside mruby and I also couldn't think of a different and
good name.
All ISO C99 printf conversion specifiers for floating point numbers and
an optional precision are supported.
It is largely based on code from the MIT licensed musl libc
(http://www.musl-libc.org/ ) and its floating point printing is exact
(unlike the current code behind Float#to_s).
2015-02-13 09:33:03 +01:00
Yukihiro "Matz" Matsumoto
70c9866751
add Float::{INFINITY,NAN} if available
2014-11-12 15:46:31 +09:00
Hiroshi Mimaki
ed15477c74
Pacify MSVC warnings for numeric.c, proc.c, and symbol.c
2014-10-02 13:37:49 +09:00
Yukihiro "Matz" Matsumoto
296b0571be
remove unnecessary MRB_API from mrb_num_div(); close #2578
2014-08-30 16:15:31 +09:00
Yukihiro "Matz" Matsumoto
73a012c808
Merge pull request #2561 from cubicdaiya/issues/space_EOL
...
Remove spaces in end-of-line.
2014-08-26 02:25:05 +09:00
Tatsuhiko Kubo
0e9f98c430
Fix Numeric#pow behavior.
...
* Before
2 ** -1 #=> 0
* After
2 ** -1 #=> 0.5
2014-08-25 17:17:37 +09:00
Tatsuhiko Kubo
6961317fb3
Remove spaces in end-of-line.
2014-08-25 16:49:15 +09:00
Yukihiro "Matz" Matsumoto
6496195d21
Merge pull request #2533 from suzukaze/fix-indents
...
Fix indents in numeric.c
2014-08-15 22:59:18 +09:00
Jun Hiroe
2ba257ccb4
Fix indents in numeric.c
2014-08-15 20:51:43 +09:00
Jun Hiroe
9b176207a4
Refactor flo_mod func in numeric.c
2014-08-15 20:50:20 +09:00
chasonr
f7389bb1e6
Remove some roundoff from mrb_flo_to_str
2014-08-13 23:31:22 -04:00
Yukihiro "Matz" Matsumoto
170ba511f2
remove unnecessary mrb_float casting; ref #2531
2014-08-13 21:58:52 +09:00
kkkkkt
a9b37bff4b
refactor mrb_hash_shift, num_pow, flo_eq, flo_finite_p method
2014-08-13 18:26:58 +09:00
Yukihiro "Matz" Matsumoto
206f89e209
add MRB_API modifiers to mruby API functions
2014-08-04 00:47:08 +09:00
Yukihiro "Matz" Matsumoto
61ce5892cc
remove spaces after open parens
2014-07-12 20:36:45 +09:00
David Turnbull
249f05e7d7
Clean up value.h and mrb_value boxing
2014-07-09 06:32:11 +09:00
take_cheeze
a50464fe01
Fix type checking in mrb_flo_to_fixnum.
2014-07-04 16:16:06 +09:00
yui-knk
76593ee0e7
Add comment to Fixnum Class.
2014-05-17 13:51:16 +09:00