Граф коммитов

408 Коммитов

Автор SHA1 Сообщение Дата
nobu 3f2ce6373f random.c: fix error message
* random.c (rb_random_ulong_limited): fix error message for negative
  value.  [ruby-dev:47061] [Bug #7903]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-22 03:46:47 +00:00
zzak 8d4a11c919 * numeric.c: Examples and formatting for Numeric and Float
Based on a patch by Zach Morek and Oren K of newhaven.rb
  [Github documenting-ruby/ruby#5]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-22 02:01:28 +00:00
marcandre d22ce4a522 * numeric.c (fix_pow): Handle special cases when base is 0, -1 or +1
[Bug #5713] [Bug #5715]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 05:39:49 +00:00
marcandre 075ae2955c * numeric.c: Fix rdoc for Fixnum#**
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 05:39:16 +00:00
zzak a954def1fb * numeric.c: Document Float constants [ruby-core:51484] [Bug #7709]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-03 00:59:51 +00:00
mrkn 350c448da8 * numeric.c (do_coerce): fix for the exceptions which the coerce
method raises.  The optimization done by r38756 is preserved.
  [Bug #7645] [ruby-core:51213]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-12 08:47:18 +00:00
eregon 8307cb90a0 * numeric.c (do_coerce): fix comment and adjust indent
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-10 08:12:58 +00:00
shugo 42eadff3a1 * numeric.c (do_coerce): remove an unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-10 06:57:17 +00:00
mrkn 9aa75d08ce * numeric.c (do_coerce): speed optimization by using rb_check_funcall
instead of rb_rescue + rb_funcall.
  This fix is based on the patch by Benoit Daloze.
  [Bug #7645] [ruby-core:51213]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-10 06:30:23 +00:00
nobu e878df745c use RB_TYPE_P
* enumerator.c (enumerator_initialize), eval.c (rb_using_refinement),
  (add_activated_refinement), numeric.c (num_interval_step_size),
  parse.y (arg, match_op_gen, cond0), range.c (range_bsearch),
  vm_insnhelper.c (vm_get_iclass): use RB_TYPE_P() to optimize.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 12:22:01 +00:00
mrkn a756488c6d * include/ruby/intern.h: add the prototype declaration of
rb_num_coerce_bit.

* numeric.c (rb_num_coerce_bit): the new coerce function for bitwise
  binary operation.

* bignum.c (rb_big_and): use coerce to convert the argument, which isn't
  a Fixnum nor a Bignum, to the corresponding Integer object so that
  bitwise operations can support Integer-mimic objects.
  [Bug #1792] [ruby-core:39491]

* bignum.c (rb_big_or): ditto.

* bignum.c (rb_big_xor): ditto.

* numeric.c (bit_coerce): ditto.

* numeric.c (fix_and): ditto.

* numeric.c (fix_or): ditto.

* numeric.c (fix_xor): ditto.

* test/ruby/test_integer.rb: add tests for the above changes.

* test/ruby/test_bignum.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22 15:06:22 +00:00
ko1 f6f388a5bd * array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,
range.c: use prepared IDs.
  A patch from charliesome (Charlie Somerville).
  [Bug #7495]
* common.mk: add dependency to id.h.
* common.mk: replace ID_H_INCLUDES with id.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-02 09:57:47 +00:00
nobu 66fd9d44d8 adjust style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 15:25:28 +00:00
mrkn 6ea34efab0 * numeric.c: Add description of that the results of the comparing
operations of two NaNs are undefined.
  [#1720] [ruby-dev:38725] [ruby-core:36966]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-08 00:34:55 +00:00
naruse 172d8f9b6e * numeric.c (ruby_float_step): fix r37514: it yielded with NaN
if the unit is infinity.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-07 07:03:50 +00:00
nobu 7f00f853d4 adjust style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 22:50:30 +00:00
marcandre 3a4eb4dd39 * numeric.c (int_dotimes): Support for Integer#times.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:15:30 +00:00
marcandre c2dc0dc1ce * numeric.c (int_upto, int_downto): Support for Integer#{down|up}to.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:15:15 +00:00
marcandre 34be3a5d90 * numeric.c (num_step): Support for Numeric#step.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:14:31 +00:00
marcandre f02c29ee4f * numeric.c: Extract ruby_float_step_size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:14:16 +00:00
ko1 180c744b3b * numeric.c (rb_float_new_in_heap), include/ruby/ruby.h:
make all Float objects frozen.
  [ruby-dev:46081] [ruby-trunk - Feature #6936]
  Most part of patch by NARUSE, Yui  <naruse@ruby-lang.org>.
* class.c (singleton_class_of): raise TypeError when
  trying to define a singleton method on Float objects.
* vm.c (vm_define_method): ditto.
* test/ruby/marshaltestlib.rb: catch up above changes.
* test/ruby/test_class.rb: ditto.
* test/test_pp.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-27 02:10:53 +00:00
nari c3a46d6aca * include/ruby/ruby.h: add C APIs.
VALUE rb_newobj_of(VALUE klass, VALUE flags)
  #define NEWOBJ_OF(obj,type,klass,flags)
  These allow to change a allocation strategy depending on klass
  or flags.

* gc.c: ditto

* array.c: use new C API.
* bignum.c: ditto
* class.c: ditto
* complex.c: ditto
* ext/socket/ancdata.c: ditto
* ext/socket/option.c: ditto
* hash.c: ditto
* io.c: ditto
* marshal.c: ditto
* numeric.c: ditto
* object.c: ditto
* random.c: ditto
* range.c: ditto
* rational.c: ditto
* re.c: ditto
* string.c: ditto
* struct.c: ditto
  [Feature #7177][Feature #7047]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 06:57:51 +00:00
ko1 b3b5e626ad * include/ruby/ruby.h: introduce flonum technique for
64bit CPU environment (sizeof(double) == sizeof(VALUE)).
  flonum technique enables to avoid double object creation
  if the double value d is in range about between
  1.72723e-77 < |d| <= 1.15792e+77 or 0.0.
  flonum Float value is immediate and their lowest two bits
  are b10.
  If flonum is activated, then USE_FLONUM macro is 1.
  I'll write detailed in this technique on
  https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/Flonum_tech
* benchmark/bmx_temp.rb: add an benchmark for simple
  Float calculation.
* gc.c (id2ref, rb_obj_id): add flonum Float support.
* include/ruby/intern.h: move decl of rb_float_new(double)
  to include/ruby/ruby.h.
* insns.def, vm.c, vm_insnhelper.c: add flonum optimization
  and simplify source code.
* vm_insnhelper.h (FLONUM_2_P): added.
* marshal.c: support flonum output.
* numeric.c (rb_float_new_in_heap): added.
* parse.y: support flonum.
* random.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23 07:22:40 +00:00
eregon fd7dc23d28 Kernel#inspect: improve consistency and do not call #to_s.
* object.c (rb_obj_inspect): Kernel#inspect: do not call #to_s. A class
  can now benefit from the nice default #inspect even if it defines #to_s.
  Also, there is no more unexpected change in #inspect result.
* NEWS: Add note about the change.
* bignum.c, io.c, numeric.c, object.c, proc.c, vm.c (Init_*):
  Adapt internal structures (by aliasing #inspect to #to_s) so they
  don't rely on the removed behavior (#inspect calling overridden #to_s).
* test/ruby/test_object.rb (test_inspect): add tests for Kernel#inspect.
* lib/pp.rb (class PP): do not call #to_s anymore, as #inspect
  no more does (mame).
* test/test_pp.rb (class PPInspectTest): remove related assertion (mame).
  [ruby-core:43238][Feature #6130]
* test/drb/drbtest.rb (DRbCore#teardown, DRbAry#teardown):
  adapt DRb tests with the new change (shirosaki).
  [ruby-core:47182][Bug #6866]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-15 11:50:01 +00:00
naruse 780e7d0951 Revert r36699 and r36700. [Feature #6130]
Revert "Kernel#inspect: improve consistency and do not call #to_s."
Revert "update PP with recent Kernel#inspect change. Patch by Yusuke Endoh."

r36699 cause test-all failure on test/drb/test_drb.rb and
test/drb/test_drbssl.rb. Run test-all before commit.

Moreover its ChangeLog formst is wrong: see CommitterHowto
https://bugs.ruby-lang.org/projects/ruby/wiki/CommitterHowto#ChangeLog

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-15 01:09:10 +00:00
eregon 795c29dcda Kernel#inspect: improve consistency and do not call #to_s.
A class can now benefit from the nice default #inspect even if it
defines #to_s. Also, there is no more unexpected change in #inspect
result. Internal structures have been adapted so they don't rely
on the removed behavior (#inspect calling overridden #to_s).

* object.c (rb_obj_inspect): Kernel#inspect: do not call #to_s.
* test/ruby/test_object.rb (test_inspect): add tests for Kernel#inspect.
* bignum.c, io.c, numeric.c, object.c, proc.c, vm.c (Init_*):
  alias #inspect to #to_s where it was expected.
  [ruby-core:43238][Feature #6130]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-14 10:20:44 +00:00
akr 0e2aa330ec * numeric.c (flo_to_s): use the exponential form if the integer part
is longer than or equal DBL_DIG.
  [ruby-dev:45960] [ruby-trunk - Bug #6741]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-16 13:52:10 +00:00
akr 04f09ef8a1 * bignum.c (rb_integer_float_eq): new function.
(rb_big_eq): use rb_integer_float_eq.

* internal.h (rb_integer_float_eq): declared.

* numeric.c (flo_eq): use rb_integer_float_eq.
  (fix_equal): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-16 10:39:42 +00:00
akr cf469774d1 * bignum.c (rb_integer_float_cmp): renamed from rb_big_float_cmp.
* internal.h: follow the above change.

* numeric.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-16 09:41:25 +00:00
akr 984729ba30 * bignum.c (rb_big_float_cmp): support fixnum for argument x.
* numeric.c (fix_equal): use rb_big_float_cmp.
  (fix_cmp): ditto.
  (fix_gt): ditto.
  (fix_ge): ditto.
  (fix_lt): ditto.
  (fix_le): ditto.
  (flo_eq): ditto.
  (flo_cmp): use rb_big_float_cmp for fixnum argument.
  (flo_gt): ditto.
  (flo_ge): ditto.
  (flo_lt): ditto.
  (flo_le): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-16 08:44:32 +00:00
akr 6dd65bb377 * internal.h (rb_big_float_cmp): declared.
* bignum.c (rb_big_float_cmp): extracted from rb_big_cmp and big_op.
  (rb_big_cmp): use rb_big_float_cmp.
  (big_op): ditto.

* numeric.c (flo_cmp): use rb_big_float_cmp.
  (flo_gt): ditto.
  (flo_ge): ditto.
  (flo_lt): ditto.
  (flo_le): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-16 06:02:21 +00:00
nobu 50aab6d401 numeric.c: optimize
* numeric.c (positive_int_p, negative_int_p): optimize.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 06:31:35 +00:00
nobu f96afe182e * numeric.c (positive_int_p, negative_int_p): extracted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 06:31:32 +00:00
nobu 57fb219905 * reduce UNREACHABLE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-15 00:06:13 +00:00
drbrain e95f7ea80d * variable.c (trace_ev): Removed "not reached" comment as this line is
reached.
* variable.c (rb_obj_remove_instance_variable):  Replaced "not reached"
  comment with the UNREACHABLE macro.
* variable.c (rb_mod_const_missing):  ditto.
* variable.c (rb_mod_remove_cvar):  ditto.
* enum.c (first_i):  ditto.
* string.c (rb_str_aref):  ditto.
* string.c (str_byte_aref):  ditto.
* string.c (rb_to_id):  ditto.
* io.c (rb_io_fmode_modestr):  ditto.
* io.c (rb_io_oflags_modestr):  ditto.
* pack.c (num2i32):  ditto.
* vm_eval.c (rb_method_missing):  ditto.
* vm_eval.c (rb_f_throw):  ditto.
* dir.c (dir_read):  ditto.
* win32/win32.c (child_result):  ditto.
* struct.c (rb_struct_getmember):  ditto.
* struct.c (rb_struct_set):  ditto.
* struct.c (rb_struct_aref_id):  ditto.
* eval.c (rb_f_raise):  ditto.
* process.c (rb_f_exit_bang):  ditto.
* process.c (rb_f_exit):  ditto.
* process.c (rb_f_abort):  ditto.
* ext/-test-/iter/break.c (iter_break_value):  ditto.
* ext/pty/pty.c (pty_check):  ditto.
* ext/openssl/ossl_pkey.c (ossl_pkey_new):  ditto.
* ext/readline/readline.c (rb_remove_history):  ditto.
* ext/stringio/stringio.c (strio_unimpl):  ditto.
* numeric.c (num_sadded):  ditto.
* numeric.c (num_init_copy):  ditto.
* numeric.c (rb_num2ll):  ditto.
* numeric.c (rb_num2ull):  ditto.
* vm_insnhelper.c (call_cfunc):  ditto.
* ruby.c (opt_W_getter):  ditto.
* bignum.c (rb_big_coerce):  ditto.
* file.c (rb_f_test):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14 00:36:26 +00:00
nobu c037f1f616 * adjust style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-15 01:39:00 +00:00
marcandre 7316302483 * include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]
* array.c: Use rb_check_arity / rb_error_arity

* class.c: ditto

* enumerator.c: ditto

* eval.c: ditto

* file.c: ditto

* hash.c: ditto

* numeric.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* re.c: ditto

* signal.c: ditto

* string.c: ditto

* struct.c: ditto

* transcode.c: ditto

* vm_eval.c: ditto

* vm_insnhelper.c: ditto & implementation of rb_error_arity

* test/ruby/test_arity.rb: tests for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14 21:10:34 +00:00
usa cc3d03b196 * 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/trunk@35015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14 08:56:42 +00:00
marcandre 4c2e2d8bde * 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/trunk@35013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14 06:10:01 +00:00
naruse 800f04c6a5 * 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/trunk@34236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-08 20:42:45 +00:00
naruse cc56bdee40 Fix for r33811.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-22 04:54:42 +00:00
naruse 033244c1b2 * numeric.c (ruby_float_step): improve floating point calculations.
[ruby-core:35753] [Bug #4576]

* numeric.c (ruby_float_step): correct the error of floating point
  numbers on the excluding case.
  patched by Masahiro Tanaka [ruby-core:39608]

* numeric.c (ruby_float_step): use the end value when the current
  value is greater than or equal to the end value.
  patched by Akira Tanaka [ruby-core:39612]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-22 01:47:35 +00:00
kosaki 302220a8a5 * numeric.c (rb_fix2ushort): fix typo. use num rb_num2ushort()
instead of num2uint().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-14 05:53:59 +00:00
kosaki b2a2ba1191 * include/ruby/ruby.h: add NUM2SHORT(), NUM2USHORT() macros.
* numeric.c: ditto.

* test/-ext-/num2int/test_num2int.rb: add testcases for NUM2SHORT().
* ext/-test-/num2int/num2int.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-14 03:54:34 +00:00
kosaki 74a13c7634 * numeric.c (check_uint): fix off-by-one bug of NUM2UINT.
* bignum.c (rb_big2ulong): fix off-by-one bug of NUM2ULONG.

* test/-ext-/num2int/test_num2int.rb: add a testcase for NUM2INT()
  NUM2UINT(), NUM2LONG(), NUM2ULONG(), NUM2LL and NUM2ULL().
* ext/-test-/num2int/depend: ditto.
* ext/-test-/num2int/extconf.rb: ditto.
* ext/-test-/num2int/num2int.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-14 03:45:47 +00:00
nobu bb98e0ecec * numeric.c (rb_infinity, rb_nan): aggregated member initializers
need braces.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-23 09:03:33 +00:00
ngoto 971769cd76 * numeric.c (rb_infinity, rb_nan): use union to prevent bus error
caused by misalignment.  [Bug #5469] [ruby-dev:44657]
* include/ruby/missing.h (INFINITY, NAN): ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-21 17:34:58 +00:00
naruse 0a5ac6a448 Revert r33407; half-baked patch.
"* numeric.c (ruby_float_step): improve floating point calculations."

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-05 07:36:28 +00:00
naruse a635de7dcb * numeric.c (ruby_float_step): improve floating point calculations.
[ruby-core:35753] [Bug #4576]

* numeric.c (ruby_float_step): correct the error of floating point
  numbers on the excluding case.
  patched by Masahiro Tanaka [ruby-core:39608]

* numeric.c (ruby_float_step): use the end value when the current
  value is greater than or equal to the end value.
  patched by Akira Tanaka [ruby-core:39612]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-05 07:35:27 +00:00
nobu 8e6e8e6288 * use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +00:00