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

507 Коммитов

Автор SHA1 Сообщение Дата
nobu a8f4398602 numeric.c: adjust types
* numeric.c (coerce_rescue, coerce_rescue_quiet): rescue functions
  should have errinfo too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-17 02:54:50 +00:00
nobu e18654fff2 numeric.c: adjust types
* numeric.c (coerce_body, coerce_rescue, coerce_rescue_quiet):
  adjust parameter types for rb_rescue.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-17 02:38:09 +00:00
nobu 527fa61087 numeric.c: fix segfault
* numeric.c (compare_with_zero): fix variable name, rb_cmperr
  requires VALUEs but not an ID.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-16 09:25:08 +00:00
hsbt 52cd994814 * enum.c: fix a typo in documentation.
[ci skip][fix GH-1140] Patch by @jutaz
* io.c: ditto.
* iseq.c: ditto.
* numeric.c: ditto.
* process.c: ditto.
* string.c: ditto.
* vm_trace.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-14 02:52:14 +00:00
kosaki 3a48e12607 * numeric.c: Good-by Borland-C.
* include/ruby/backward/rubyio.h: ditto.
* include/ruby/backward/st.h: ditto.
* include/ruby/backward/util.h: ditto.
* include/ruby/backward/rubysig.h: ditto.
* include/ruby/backward/classext.h: ditto.
* dln.c: ditto.
* gc.c: ditto.
* win32/resource.rb: ditto.
* win32/dir.h: ditto.
* ext/tk/tcltklib.c: ditto.
* NEWS: announce that Borland-C is no longer supported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-18 02:10:34 +00:00
nobu e0c038cdfb numeric.c: use predefined IDs
* numeric.c: use predefined IDs and prepared IDs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-12 00:08:58 +00:00
nobu 5f0d9e8644 numeric.c: common expressions
* numeric.c (flo_pow): extract common expressions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-12 00:08:44 +00:00
ko1 0a40bcb20b * vm_eval.c, internal.h (rb_yield_1): added for performance which
doesn't check Qundef.
* numeric.c (int_dotimes): use rb_yield_1.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-10 21:22:54 +00:00
svn 57149f76eb * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-05 06:42:18 +00:00
zzak 2c5a139a84 * numeric.c: [DOC] Overview for Numeric class by Joe Corcoran
This patch was created at ROSSConf Berlin 2015 [Bug #11555]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-05 06:42:14 +00:00
nobu 4191a6b90d preserve encodings in error messages
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-28 02:40:46 +00:00
akr 11dde7770d * numeric.c (Init_Numeric): Fix document for Float::MIN and
Float::EPSILON.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-11 14:01:22 +00:00
nobu 545086d2c7 fix doc for Numeric#coerce [ci skip]
* numeric.c (num_coerce): [DOC] fix doc for Numeric#coerce,
  missing '+'.  [Fix GH-974]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-22 00:45:33 +00:00
eregon 2e1835b69d * numeric.c (Numeric#negative?): [DOC] Fix call-seq.
Patch by @yui-knk. [Fixes GH-908]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-24 15:33:08 +00:00
nobu 59b089bd09 numeric.c: return true
* numeric.c (num_positive_p): return true instead of Fixnum 0.
  [ruby-core:69173] [Feature #11151]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-19 04:13:22 +00:00
nobu b4e5bff89d numeric.c: Bignum 0 is not positive
* numeric.c (num_positive_p): should false on Bignum 0.
  http://twitter.com/rafaelfranca/status/600509783427391488
  [ruby-core:69173] [Feature #11151]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-19 04:10:12 +00:00
nobu 932e916b9e numeric.c: Numeric#positive? and Numeric#negative?
* numeric.c (num_positive_p, num_negative_p): add methods
  Numeric#positive? and Numeric#negative?.
  [ruby-core:69173] [Feature #11151]
* numeric.c (flo_positive_p, flo_negative_p): specialiazed
  functions for Float.
* complex.c (Init_Complex): Complex do not have positive? and
  negative? methods

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-17 06:01:47 +00:00
nobu 8953b97d72 numeric.c: compare_with_zero
* numeric.c (compare_with_zero): raise TypeError when not
  comparable with 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-17 05:59:36 +00:00
nobu 3bcf9fb53e hash.c: same hash values with Float#hash
* hash.c (rb_any_hash): use same hash values with Float#hash so
  that -0.0 and +0.0 will be identical.
  [ruby-core:68541] [Bug #10979]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-18 03:01:58 +00:00
nobu ed00379c79 numeric.c: calculate complex numbers
* numeric.c (fix_plus, fix_mul): calculate complex numbers for
  commutative operations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-24 13:59:06 +00:00
nobu 16294913f7 use rb_funcallv
* use rb_funcallv() for no arguments call instead of variadic
  rb_funcall().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-16 04:08:52 +00:00
nobu 6a852f7ab8 numeric.c: fix message
* numeric.c (coerce_failed): fix the error message on non-flonum
  platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-13 12:07:14 +00:00
normal 34289fff0f numeric.c: correct error message when coerce fails
* numeric.c (bit_coerce): use original value for error message
  [ruby-core:67405] [Bug #10711]
* test/ruby/test_numeric.rb (test_coerce): check error message

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-12 09:56:14 +00:00
akr 2b9191e557 * internal.h: Gather declarations in non-header files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18 15:13:05 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
ko1 68f55c4b35 * dir.c (glob_helper): use #ifdef instead of #if.
gcc's -Wundef option shows warning for undefined macro.
* numeric.c (flo_is_finite_p): ditto.
* vm_dump.c (rb_vmdebug_thread_dump_state): ditto.
* vm_core.h: define VM_DEBUG_VERIFY_METHOD_CACHE to 0.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-04 08:50:31 +00:00
nobu 52b59fc9d9 numeric.c: 0 % Float::NAN returns Float::NAN
* numeric.c (flodivmod): all results are NaN if divisor is NaN.
  [fix GH-692]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-01 07:35:48 +00:00
nagachika 71336a03fa * numeric.c (num_step_scan_args): table argument of rb_get_kwargs() is
array of IDs, not Symbols. [ruby-dev:48353] [Bug #9811]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-01 14:36:03 +00:00
eregon a21ac07f69 * numeric.c (do_coerce): Add a warning when an exception is raised
or an invalid value is returned in #coerce called by
  numeric comparison operators and the exception
  thrown by the caller has no information on the failure.
  In the next release such exception should not be rescued or
  should be the cause of the caller exception. nil is accepted
  as the "no possible coercion" return value. See #7688.
* test/ruby/test_numeric.rb: Add corresponding test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-07 13:16:01 +00:00
eregon ea7ce3096e * numeric.c (bit_coerce): remove constant parameter `err'
(always TRUE) of bit_coerce().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-07 09:16:21 +00:00
nobu f2980e3e20 encoding.h: constify rb_encoding
* include/ruby/encoding.h: constify `rb_encoding` itself, not only
  arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02 20:23:47 +00:00
nobu 046831094b constify rb_encoding and OnigEncoding
* include/ruby/encoding.h: constify `rb_encoding` arguments.
* include/ruby/oniguruma.h: constify `OnigEncoding` arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-01 22:06:11 +00:00
nobu c0dba956d1 id.def: predefine to_i
* defs/id.def: predefine `to_i` as well as `to_int`.

* numeric.c (id_to_i): use predefined `idTo_i`.

* object.c (conv_method_names): add `to_i` ID.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-20 08:28:33 +00:00
akr 63fee73500 * configure.in: Check nextafter() availability.
* include/ruby/missing.h (nextafter): New optional declaration.

* missing/nextafter.c: New file.

* numeric.c: Float#next_float and Float#prev_float implemented.

   [ruby-core:62562] [Feature #9834]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-18 00:37:10 +00:00
nobu a352b0a207 numeric.c: check keyword arguments
* numeric.c (num_step_scan_args): check keyword arguments and fail
  if they conflict with positional arguments.
  [ruby-dev:48177] [Bug #9811]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07 08:24:09 +00:00
nobu f8661f7ffb numeric.c: merge miss
* numeric.c (num_step_scan_args): fix merge miss.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07 08:10:00 +00:00
nobu ba90ac2529 numeric.c: num_step_scan_args
* numeric.c (num_step_scan_args): turn a macro into a function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07 08:05:00 +00:00
nobu 5c5180256a numeric.c: indent
* numeric.c (ruby_num_interval_step_size): adjust indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-07 07:34:33 +00:00
akr a6024cdc1b * numeric.c (rb_num2long): Returns a long.
(rb_num2ulong): Returns a unsigned long.

* bignum.c (rb_big2long): Returns a long.
  (rb_big2ulong): Returns a unsigned long.

* include/ruby/intern.h: Follow above changes.

* include/ruby/ruby.h: Follow above changes.
  (rb_num2long_inline): No need to cast.
  (rb_num2ulong_inline): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-18 15:46:32 +00:00
ko1 57e557908a * enumerator.c (enumerator_block_call): use PARRAY_CONST_PTR()
instead of RARRAY_PTR().
* io.c (rb_io_s_popen): ditto.
* numeric.c (num_step_size): ditto.
* vm_eval.c (rb_apply): ditto.
* vm_eval.c (rb_eval_cmd): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-17 04:20:16 +00:00
nobu fc23374f06 [DOC] add links to `Object#hash`
add links to `Object#hash` to each #`hash` methods rdocs.
[Fixes GH-567]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-14 01:27:43 +00:00
marcandre 9047641ce3 * numeric.c: Mention that Float::DIG is the minimum number
of siginificant digits. See #9191

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-02 01:55:02 +00:00
nobu e8b9611b32 numeric.c: predefined constants
* numeric.c (id_eq, id_cmp): use predefined constants in id.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-28 15:47:52 +00:00
nobu 99431e7355 numeric.c: float overflow
* numeric.c (ruby_num_interval_step_size): get rid of float
  conversion overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-28 05:11:44 +00:00
nobu a4a551f856 numeric.c: integer overflow
* numeric.c (ruby_num_interval_step_size): get rid of integer
  overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-28 04:59:49 +00:00
marcandre d596ba8dc0 * numeric.c: Fix rdoc for step
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-28 02:19:21 +00:00
marcandre 1636c60fe1 * numeric.c: Fix Numeric#step with 0 unit [#9575]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-28 02:04:59 +00:00
marcandre 11a57c63f3 * numeric.c: Simplify by getting rid of macro
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-28 02:04:43 +00:00
marcandre 814fb8e6c7 * numeric.c: Create var for rb_intern("<=>")
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-28 02:04:28 +00:00
marcandre e184e31c09 * numeric.c: Simplify [ruby-core:61106] [Bug #9570]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-28 02:03:30 +00:00