usa
f984d0782b
merge revision(s) 39594,39596: [Backport #8010 ]
...
* enumerator.c (enumerator_with_index_i): allow Bignum as offset, to
get rid of conversion exception and integer overflow.
[ruby-dev:47131] [Bug #8010 ]
* enumerator.c (enumerator_with_index): Restore handling of a nil memo
from r39594.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@44744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-29 05:24:28 +00:00
usa
58fef6226e
merge revision(s) 35015:
...
* numeric.c (flodivmod): must through the same pass if HAVE_FMOD or not.
this is a bugfix of r35013.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-12 04:38:43 +00:00
naruse
9c0d94449b
merge revision(s) 35013:
...
* numeric.c: fix flodivmod for cornercases [Bug #6044 ]
add ruby_float_mod
* insns.def (opt_mod): use ruby_float_mod
* internal.h: declare ruby_float_mod
* test/ruby/test_float.rb: tests for above
* test/ruby/envutil.rb: create helper assert_is_minus_zero
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-30 05:13:10 +00:00
naruse
e0f8351d55
merge revision(s) 34236: [Backport #5890 ]
...
* numeric.c (rb_enc_uint_char): raise RangeError when added codepoint
is invalid. [Feature #5855 ] [Bug #5863 ] [Bug #5864 ]
* string.c (rb_str_concat): ditto.
* string.c (rb_str_concat): set encoding as ASCII-8BIT when the string
is US-ASCII and the argument is an integer greater than 127.
* regenc.c (onigenc_mb2_code_to_mbclen): rearrange error code.
* enc/euc_jp.c (code_to_mbclen): ditto.
* enc/shift_jis.c (code_to_mbclen): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-08 22:34:12 +00:00
naruse
72fba5701c
merge revision(s) 33198,33199:
...
* numeric.c (flo_round): Fix criteria for 32 bits platform
part 2 of [bug #5276 ]
* numeric.c (dbl2ival): Fix Float#divmod and #round for 32 bit
platform. part 1 of [bug #5276 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-29 18:04:00 +00:00
naruse
68336beb50
merge revision(s) 33158,33185,33186:
...
* numeric.c (flo_round): substitute machine dependent magic number.
* numeric.c (flo_round): Make Float#round round big values [bug
#5272 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-29 17:39:36 +00:00
naruse
ee490943c1
merge revision(s) 33183,33185:
...
* numeric.c (int_round): Integer#round always returns an Integer [Bug
#5271 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-29 17:29:41 +00:00
marcandre
cc6407f8fe
* backport r33140 from trunk
...
* numeric.c (flo_round): Avoid overflow by optimizing for trivial cases
[Bug #5227 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-31 04:20:53 +00:00
marcandre
7a3f54edb1
* backport r33060, 33061 from trunk
...
* numeric.c (int_round): Fix Integer#round [ruby-core:39096]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-24 23:04:50 +00:00
ngoto
2bd1e021ce
* numeric.c (rb_infinity, rb_nan): use WORDS_BIGENDIAN to get endian.
...
fix [Bug #5160 ] [ruby-dev:44356]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-05 13:28:50 +00:00
usa
d7080856a4
* numeric.c (rb_num2ull): use FIX2LONG instead of FIX2ULONG. see
...
rb_num2ulong(). fixed the problem of ObjectSpace._id2ref of IL32LLP64
platforms, introduced at r32433.
backported r32512 from trunk.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-11 06:19:39 +00:00
nobu
03c618daf0
* numeric.c (ULLONG_MAX): fallback definition.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-09 07:54:38 +00:00
naruse
136c117fc1
* numeric.c (rb_num2ull): use own switch sentense.
...
Current implementation can't convert 18446744073709551615.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-07 06:23:40 +00:00
akr
e7996eb3cc
* internal.h: declare internal functions here.
...
* node.h: declare NODE dependent internal functions here.
* iseq.h: declare rb_iseq_t dependent internal functions here.
* vm_core.h: declare rb_thread_t dependent internal functions here.
* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
thread.c, time.c, transcode.c, variable.c, vm.c,
tool/compile_prelude.rb: don't declare internal functions declared
in above headers. include above headers if required.
Note that rb_thread_mark() was declared as
void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
void rb_thread_mark(void *ptr) in vm.c. Now it is declared as
the later in internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
nobu
6f58118e4c
* numeric.c (rb_enc_uint_chr): fix message format. Bug#4869
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-11 07:52:34 +00:00
usa
799fafc03b
* include/ruby/missing.h, numeric.c (round): moved prototype of round()
...
from numeric.c to missing.h. (note: round() is C99 feature, so ruby
provides it if not exists in C runtime.)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-03 11:58:11 +00:00
naruse
1d5431374d
* insns.def (opt_mult): as r31805, volatile it.
...
Without this, clang -O fails calculation.
* numeric.c (fix_mul): ditto.
* rational.c (f_imul): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-30 06:53:21 +00:00
naruse
4e4649e13c
* numeric.c (int_pow): make sure to assign the result of x * z.
...
If xz is optimized out, the value won't overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-30 01:28:37 +00:00
nobu
3b58e17d7b
revert r31783.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-29 22:06:54 +00:00
nobu
7c99a7df85
* numeric.c (flo_round): use absolute value as divisor.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-29 14:22:49 +00:00
nagachika
4173fb0cb5
* numeric.c: add #include "interna.h" for rb_big_uminus() prototype.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-29 08:55:54 +00:00
nobu
a3ffe9698b
* numeric.c (flo_round): fix for negative value.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-29 06:09:08 +00:00
nobu
3a47cf3395
* remove trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 11:55:52 +00:00
nagachika
a55d803ed3
* numeric.c (flo_coerce): fix a typo in documentation.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-13 12:38:49 +00:00
shyouhei
eb5de217f1
Add #flo_coerce documentation.
...
Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-13 10:27:10 +00:00
naruse
074818f3b0
* numeric.c (int_ord): remove K&R style.
...
patched by Daehyub Kim. https://github.com/ruby/ruby/pull/17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-09 02:53:55 +00:00
usa
9d5f651a98
* numeric.c (ruby_float_step): wrong loop condition.
...
fixes [ruby-core:35753], reported by Joey Zhou.
* test/ruby/test_range.rb (TestRange#test_step_ruby_core_35753):
test above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-14 14:50:46 +00:00
nobu
9b66922d7f
* numeric.c (flo_round): fix inaccurate results.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-22 23:07:36 +00:00
naruse
2c1936cf87
* numeric.c (flo_round): use pow instead of while-loop. fixes #4510
...
patched by Alex Young [ruby-core:35526]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-22 01:08:49 +00:00
usa
91d2ee737d
* numeric.c (Init_Numeric): fixed a potential bug when using bccwin32
...
ruby with Microsoft's dll, though we already gave up of supporting
bccwin32. [ruby-core:33503]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-01 13:05:17 +00:00
naruse
ded94d1c8c
* numeric.c (ruby_float_step): fix Numeric#step with infinity unit
...
doesn't works well. [ruby-core:32779]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 19:17:49 +00:00
nobu
9d0c732f0d
* numeric.c (check_uint): get rid of overflow on LLP64 platforms.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 13:53:22 +00:00
naruse
74dcda0d41
* numeric.c (int_chr): raise error when the value is negative.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 12:13:53 +00:00
naruse
e79fbf3dfe
* numeric.c (rb_num_to_uint): fix 32bit logic.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 05:58:35 +00:00
naruse
a01e628318
* numeric.c (rb_num_to_uint): added to check the range of arguments.
...
Mainly for negative value with NUM2UINT on 32bit environment.
* string.c (rb_str_concat): use rb_num_to_uint.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-13 03:56:31 +00:00
nobu
2f0b8e2793
* numeric.c (rb_num2fix): result of rb_num2long is SIGNED_VALUE.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 14:54:06 +00:00
naruse
2d8612e966
* numeric (check_uint): the mask must refer to VALUE.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 08:56:00 +00:00
naruse
232257238a
* numeric (check_uint): set MSB for negative value.
...
* numeric (rb_num2uint): return value's type of rb_num2ulong
is VALUE.
* numeric (int_chr): variable i can't be negative.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 08:50:30 +00:00
naruse
e960fffda1
* numeric.c (rb_enc_uint_chr): split from int_chr.
...
* numeric.c (int_chr): use rb_enc_uint_chr.
* include/ruby/encoding.h (rb_enc_uint_chr): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 06:18:08 +00:00
naruse
6913b2734a
* numeric.c (int_chr): a codepoint of Ruby M17N must be 32bit
...
unsigned int; GB18030 uses MSB. Also note that OnigCodePoint
is defined as uisigned int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 05:14:23 +00:00
naruse
000f1c5b75
Add links about floating point. [ruby-core:31849]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-29 00:42:05 +00:00
usa
592d885caa
* numeric.c (flo_cmp): typo.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-27 07:27:48 +00:00
nobu
7bfa1146e2
* numeric.c (flo_cmp): honor the result of infinite? method of the
...
other. [ruby-core:31470]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-24 20:37:31 +00:00
mame
b79e96ae62
* numeric.c (fix_divide): must not use rb_rational_new1 for coercion
...
because it returns an argument itself when canonical mode is set.
[ruby-core:31279]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-15 12:55:23 +00:00
shyouhei
ce9c952937
Merge branch 'mybranch' of git://github.com/orangea/ruby into trunk
...
Conflicts:
ChangeLog
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-07 10:59:44 +00:00
akr
26202fba93
* numeric.c (rb_num2long): accept LONG_MAX < x < LONG_MAX+1 and
...
LONG_MIN-1 < x < LONG_MIN as well because they are converted
into the valid range of long by truncation.
(rb_num2ulong): accept ULONG_MAX < x < ULONG_MAX+1 and
LONG_MIN-1 < x < LONG_MIN as well.
(rb_num2ll): accept LLONG_MAX < x < LLONG_MAX+1 and
LLONG_MIN-1 < x < LLONG_MIN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-01 20:39:32 +00:00
akr
8bab1aff2c
* numeric.c (rb_num2ulong): fix the lower limit for float.
...
[ruby-dev:41361]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-01 13:34:13 +00:00
drbrain
79aac05474
Clarification of what '*' matches. Patch by John Wells <john.wells at greatworx.com>
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-04 21:22:47 +00:00
nobu
eb5f96d70c
* numeric.c (rb_num2ulong): explicit cast to suppress a warning.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-22 08:14:02 +00:00
nobu
e207a3912c
* marshal.c (w_float): use dtoa directly instead of stripping
...
needless trailing .0.
* numeric.c (flo_to_s): reverted. [ruby-dev:41341]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-21 03:26:00 +00:00