Yukihiro "Matz" Matsumoto
514cafe6c3
do not use "to_f" to retrieve floats in mrb_get_args(); close #1965
2014-03-28 11:04:15 +09:00
ksss
8891cea41c
Float#round fix bug for infinity and nan cases
2014-03-21 22:24:33 +09:00
Masaki Muranaka
1df355e300
Reduce implicit type casts.
2014-03-18 17:36:47 +09:00
Yukihiro "Matz" Matsumoto
e4ae3bf661
Merge pull request #1871 from ksss/numeric-plus
...
fix bug when `0 + other object`
2014-03-17 00:14:42 +09:00
Yukihiro "Matz" Matsumoto
5140e27b5a
Merge pull request #1872 from ksss/numeric-mul
...
fix bug when `0 * other object`
2014-03-17 00:14:16 +09:00
ksss
0fab9d557e
float + nil should be raise TypeError
2014-03-16 23:39:58 +09:00
ksss
9dcce29749
fix bug when 0 * other object
2014-03-16 23:08:31 +09:00
ksss
e9f3dca0f4
fix bug when 0 + other object
2014-03-16 22:52:25 +09:00
cremno
1b6a4fb5a2
add MRB_INT_BIT
2014-03-11 20:14:18 +01:00
cremno
f57b9d1576
use NAN and INFINITY
...
The macro str_to_mrb_float (strto[df]) converts a string to a number,
but these two macros can be used to directly get the special value.
The NAN macro requires quiet NaN support, but so does str_to_mrb_float.
This change also circumvents missing C99 support in Microsoft's C library.
Its (or ISO C90's) strtod doesn't parse "nan" or "inf".
2014-03-08 17:25:07 +01:00
Yukihiro "Matz" Matsumoto
d747ea72c4
resolve conflict
2014-02-26 00:06:58 +09:00
Yukihiro "Matz" Matsumoto
c636386953
avoid accessing uninitialized string; ref ac936fc
2014-02-25 00:47:02 +09:00
Yukihiro "Matz" Matsumoto
46ee883574
move declaration to the top of the block; ref #1727
2014-02-23 20:41:15 +09:00
h2so5
b0e3b873f5
preserve significands in float-string conversion
2014-02-22 16:50:52 +09:00
Yukihiro "Matz" Matsumoto
ac936fc211
powered num may be infinite in float-string conversion
2014-02-22 11:06:38 +09:00
cremno
61577e8d6b
mrb_flo_to_str: internal linkage
2014-02-18 04:37:35 +01:00
cremno
1838099e00
more mrb_flo_to_str fixes
...
- remove float check (take mrb_float instead of mrb_value)
- support -0.0
- fix range error if log10 is called when n == 0.0
- MSVC older than 2013: add signbit macro (for double)
2014-02-17 12:37:39 +01:00
Yukihiro "Matz" Matsumoto
57b7f6b619
use double instead of mrb_float (that may be single precision float) to reduce errors
2014-02-17 10:20:58 +09:00
Yukihiro "Matz" Matsumoto
eacdcc13d8
remove trailing zeros from float string representation
2014-02-17 10:11:51 +09:00
Yukihiro "Matz" Matsumoto
a740b28b52
define FLO_EPSILON depends on float/double
2014-02-17 09:47:39 +09:00
Yukihiro "Matz" Matsumoto
4b981adc58
remove max_digit from mrb_flo_to_str()
2014-02-17 09:40:30 +09:00
Yukihiro "Matz" Matsumoto
ffe541b503
small refactoring; direct return
2014-02-17 09:35:20 +09:00
Yukihiro "Matz" Matsumoto
25ea4d751b
use powf() instead of pow() on MRB_USE_FLOAT
2014-02-17 09:34:56 +09:00
Yukihiro "Matz" Matsumoto
b4bc395680
fdigit may be negative due to error if mrb_float is 32bit (e.g. 10**36 on 32bit arch); ref #1713 #1714
2014-02-17 09:27:53 +09:00
h2so5
db80a9a2ce
fix mrb_flo_to_str() exponent problem
2014-02-17 07:53:02 +09:00
takkaw
0a48fb0407
modify mrb_to_str() in order to display big float number
2014-02-15 15:40:51 +09:00
Yukihiro "Matz" Matsumoto
19a08b8455
Merge pull request #1674 from cremno/mrb_bool-FALSE-TRUE
...
use mrb_bool, FALSE and TRUE more
2014-02-09 18:35:20 +09:00
Yukihiro "Matz" Matsumoto
c3f02afa21
Merge pull request #1688 from cubicdaiya/issues/unnecessary_semicolon
...
Remove unnecessary semicolon
2014-02-06 21:16:24 +09:00
cubicdaiya
360d92dc28
remove unnecessary semicolon
2014-02-06 19:05:45 +09:00
Yukihiro "Matz" Matsumoto
7ba4612956
use mrb_str_new_lit() more widely
2014-02-06 08:54:47 +09:00
Tomoyuki Sahara
7bf63c2876
add Float#nan?
2014-02-03 15:18:52 +09:00
cremno
4507985c3e
use mrb_bool, FALSE and TRUE more
...
It doesn't matter to me if one is using FALSE/TRUE instead of 1/0
but I prefer a type (alias) which emphasizes boolean vars to int.
I changed 1/0 to FALSE/TRUE anyway.
2014-01-31 18:00:36 +01:00
cremno
18433731ed
remove various preprocessor conditionals
...
- HAVE_IEEEFP_H is nowhere defined or needed at all
- FreeBSD < 4 is unsupported since years
- MSVC workaround (around what exactly?)
2014-01-02 07:33:33 +01:00
Nobuhiro Iwamatsu
01fb0f02d5
Fix typo from expornent to exponent
...
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org >
2013-12-19 09:37:20 +09:00
Carson McDonald
0d0f3545f8
Change supress to suppress
2013-11-09 07:40:51 -05:00
fleuria
e648abf1c1
fix #1542
2013-10-23 15:39:52 +08:00
Yukihiro "Matz" Matsumoto
2607970ed9
move some methods to make floats and integers compatible [mruby special]
2013-10-22 16:18:11 +09:00
Yukihiro "Matz" Matsumoto
620f8b2721
implement some Numeric methods in Ruby
2013-10-22 15:59:41 +09:00
Yukihiro "Matz" Matsumoto
3ae0616710
implement Integer#succ in Ruby
2013-10-21 07:42:50 +09:00
Yukihiro "Matz" Matsumoto
9cb58a2252
Fixnum#succ may overflow
2013-10-20 00:43:39 +09:00
Cremno
123c88759c
class.c and numeric.c: fixed MSVC warnings
2013-08-07 20:48:23 +02:00
fleuria
620e323d15
replace assert with mrb_assert
2013-07-25 03:00:03 +08:00
Yukihiro "Matz" Matsumoto
2daf39ddc8
change else formatting
2013-07-22 09:52:06 +09:00
Carson McDonald
9a5e78ae67
Change width to size_t to fix warning
2013-07-06 08:54:18 -04:00
Carson McDonald
5fbceaf4a1
new is removed from Integer so doesn't need to be removed again in Fixnum
2013-06-08 10:38:09 -04:00
kimu_shu
e720782f81
Add MRB_WORD_BOXING mode (represent mrb_value as a word)
2013-05-26 10:09:17 +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
580f1e922b
Integer.round have no arg.
2013-03-31 23:05:23 +09:00
Masaki Muranaka
1d82d07cac
Remove unused functions.
2013-03-31 23:05:03 +09:00
Masaki Muranaka
cbe7a87c68
Move Integer.{floor,ceil,round,truncate} to mrblib/. For maintainability.
2013-03-31 23:04:45 +09:00