Commit graph

73 commits

Author SHA1 Message Date
knu
4928543d61 Merge r35953 from ruby_1_8_7.
* ext/bigdecimal/bigdecimal.c (VpMemAlloc): Fixes a bug reported by Drew Yao <ayao at apple.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@37219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-16 08:55:03 +00:00
nobu
8acdd955f9 * ext/bigdecimal/bigdecimal.c (PUSH): to prevent VALUE from GC,
must not cast it to unsigned long, which may be shorter than
	  VALUE, and the result can be mere garbage.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@35619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-11 05:09:58 +00:00
nobu
cccc8cbd45 * ext/bigdecimal/bigdecimal.c (VpAlloc): ensure buf does not get
collected.  based on a patch masaya tarui at [ruby-dev:41213].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@27665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08 02:07:43 +00:00
marcandre
941025c31b * lib/bigdecimal.rb: fix comparison operators [ruby-core:26646]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-06 22:05:52 +00:00
marcandre
aaee331c7f * ext/bigdecimal/bigdecimal.c (BigDecimal_IsInfinite): rdoc fix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-09 06:50:55 +00:00
marcandre
28d641911b * numeric.c: Fix doc for #remainder [ruby-core:18796]
* ext/bigdecimal/bigdecimal.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 17:46:59 +00:00
nobu
bbfe73888a * ext/bigdecimal/bigdecimal.c (gfCheckVal): never used.
* ext/bigdecimal/bigdecimal.c (VpInit): fixed format modifiers.

* ext/bigdecimal/bigdecimal.c (VPrint): constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-11 08:49:37 +00:00
matz
1e7898d76a * ext/bigdecimal/bigdecimal.c (VpCtoV): big number should result
to infinite.  backported from 1.9.

* ext/bigdecimal/bigdecimal.c (VpIsRoundMode): rounding mode
  condition check updated.  backported from 1.9.

* ext/bigdecimal/bigdecimal.c (VpPower): should handle NaN and
  Inf.  backported from 1.9.

* ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): divmod should
  raise ZeroDivisionError.  backported from 1.9.

* ext/bigdecimal/bigdecimal.c (BigDecimal_mode): should check
  exception for VP_EXCEPTION_UNDERFLOW and VP_EXCEPTION_ZERODIVIDE.
  backported from 1.9.

* ext/bigdecimal/bigdecimal.c (VpException): ditto.

* ext/bigdecimal/bigdecimal.h (VP_EXCEPTION_ZERODIVIDE): new error
  code.  backported from 1.9.

* ext/bigdecimal/bigdecimal.c (BigDecimal_div2, BigDecimal_round,
  BigDecimal_truncate, BigDecimal_floor, BigDecimal_ceil): eagerly convert
  bigdecimal to integer.  backported from 1.9.

* ext/bigdecimal/bigdecimal.c (VpMult): free internal Real.
  backported from 1.9.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-11 06:06:01 +00:00
matz
5e183bb4b2 * ext/bigdecimal/bigdecimal.c (VpToString): fixed a bug introduced
in r23613.  [ruby-talk:338957]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-11 04:34:41 +00:00
matz
3a1b61f059 * ext/bigdecimal/bigdecimal.c (VpAlloc): avoid ALLOCA_N() to avoid
segmentation fault caused by (insanely) long decimal values.
  backported from 1.9.
* ext/bigdecimal/bigdecimal.c (BigDecimal_dump, BigDecimal_to_i,
  BigDecimal_to_f, BigDecimal_to_s, BigDecimal_split,
  BigDecimal_inspect): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-01 00:14:25 +00:00
matz
5d612b96ad * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): returns Inf if
exp is bigger than DBL_MANT_DIG.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-31 22:54:40 +00:00
nobu
643bfbb49c * ext/bigdecimal/bigdecimal.c (gfDebug): uncommented out.
[ruby-core:22600]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-01 08:27:17 +00:00
matz
471742d6af * ext/bigdecimal/bigdecimal.c (VpMidRound): Round method bug
pointed by Ryan Platte fixed(Patch to the patch from "NATORI
  Shin").  [ruby-talk:273360]
  back ported from 1.9. fix [ruby-core:19791]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@20228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-12 04:39:11 +00:00
nobu
d0b0af847e * ext/bigdecimal/bigdecimal.{c,h} (VpIsNegDoubleZero, VpItoV): unused.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@18187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-23 09:06:02 +00:00
nobu
9fcfb0b4ff * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): use strtod() for more
precision.  [ruby-talk:290296]

* ext/bigdecimal/bigdecimal.c (BASE_FIG): made constant.

* ext/bigdecimal/extconf.rb: ditto.  [ruby-dev:33658]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-09 08:51:26 +00:00
matz
1fbbef5d73 * ext/bigdecimal/bigdecimal.c: BigDecimal("-.31") is now
treated as ("-0.31") not as ("0.31").

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-14 05:35:31 +00:00
knu
5a9a84efe7 * regex.c (calculate_must_string, slow_search, re_search): Silence
warnings regarding char * vs. unsigned char * mismatch;
  submitted by Lyle Johnson <lyle.johnson@gmail.com>
  in [ruby-core:10416].

* ext/bigdecimal/bigdecimal.c (BigDecimal_load): Ditto.

* ext/digest/sha1/sha1ossl.c (SHA1_Finish): Ditto.

* ext/digest/rmd160/rmd160ossl.c (RMD160_Finish): Ditto.

* ext/digest/digest.c (rb_digest_base_finish,
  rb_digest_base_update): Ditto.

* ext/nkf/nkf.c (rb_str_resize, rb_nkf_kconv, rb_nkf_guess1,
  rb_nkf_guess2): Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-27 10:38:32 +00:00
matz
0343a11d1a revert error check-in in r11777
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-19 08:29:08 +00:00
matz
45d282aeb0 * ext/socket/socket.c (unix_peeraddr): wrong syscall name in error
message for #peeraddr. a patch from Sam Roberts
  <sroberts at uniserve.com>.  [ruby-core:10366]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-19 08:16:34 +00:00
knu
179eb27889 * ext/bigdecimal: Synchronize with trunk. Better function
prototypes, removal of a useless method `!=', and document
  updates.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-09 06:48:51 +00:00
matz
46fa18da5b Revert r11453
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-03 03:14:57 +00:00
matz
4ee717dcae * io.c (ruby_dup): start GC on ENOMEM as well.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-03 02:51:44 +00:00
drbrain
a0c3379cb9 Merge 11443, 11444 and 11445 from trunk.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-31 21:38:52 +00:00
matz
f172c27683 * parse.y (parser_warning, parser_warn): some error message may
contain format specifiers.  a patch from Akinori MUSHA <knu at
  iDaemons.org>.  [ruby-dev:29657]

* ext/bigdecimal/bigdecimal.c (VpException): ditto.

* ext/dl/handle.c (rb_dlhandle_initialize): ditto.

* ext/gdbm/gdbm.c (rb_gdbm_fatal): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-14 14:34:07 +00:00
matz
355c6b616c * ext/bigdecimal/bigdecimal.c, ext/digest/rmd160/rmd160ossl.c,
ext/digest/sha1/sha1ossl.c, ext/readline/readline.c: move
  incluion of config.h to pacify AIX.  a patch from Yutaka
  Kanemoto <kinpoco at gmail.com>.  [ruby-dev:29197]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-07 09:01:27 +00:00
matz
b268c7309e * array.c (rb_ary_pop): may cause realloc oscillation. a patch
from MORITA Naoyuki <mlgetter at kidou.sakura.ne.jp>.
  [ruby-dev:29028]

* parse.y (then): we'd like to reserve colon here for the future.
  warning added.

* ruby.h: export rb_cMethod.  [ruby-talk:201259]

* ext/bigdecimal/bigdecimal.c: Allows '_' to appear within
  digits.  [ruby-dev:28872]

* ext/bigdecimal/lib/bigdecimal/util.rb: Bug in to_r reported by
  [ruby-list:42533] fixed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-13 15:43:02 +00:00
matz
c16d9cff8b * ext/bigdecimal/bigdecimal.c (BigDecimal_version): fix patch
failure.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-29 10:03:40 +00:00
matz
04b3280a41 * ext/bigdecimal/bigdecimal.c: add RDoc document. a patch from
mathew <meta at pobox.com>.   [ruby-core:07050]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-29 09:09:33 +00:00
matz
7e6bf2fb43 * ext/bigdecimal/bigdecimal.c: patch from "NATORI Shin"
(u-tokyo.ac.jp) applied to fix rounding bug.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-16 07:22:49 +00:00
matz
88d5dcc8de * exception error messages updated. [ruby-core:04497]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-02-28 02:45:23 +00:00
matz
860bdc3b61 * io.c (read_all): block string buffer modification during
rb_io_fread() by freezing it temporarily. [ruby-dev:24479]

* dir.c (rb_push_glob): block call at once the end of method.
  [ruby-dev:24487]

* ext/enumerator/enumerator.c (enum_each_slice): remove
  rb_gc_force_recycle() to prevent potential SEGV.
  [ruby-dev:24499]

* ext/zlib/zlib.c (zstream_expand_buffer): hide internal string
  buffer by clearing klass.  [ruby-dev:24510]

* ext/socket/socket.c (sock_s_getservbyaname): protocol string
  might be altered.  [ruby-dev:24503]

* string.c (rb_str_upto): check if return value from succ is a
  string.  [ruby-dev:24504]

* io.c (rb_io_popen): get mode string via rb_io_flags_mode() to
  avoid mode string modification.  [ruby-dev:24454]

* io.c (rb_io_getline_fast): should take delim as unsigned char to
  distinguish EOF and '\377'.  [ruby-dev:24460]

* io.c (rb_io_getline): add check for RS modification.
  [ruby-dev:24461]

* enum.c (enum_sort_by): use qsort() directly instead using
  rb_iterate().  [ruby-dev:24462]

* enum.c (enum_each_with_index): remove rb_gc_force_recycle() to
  prevent access to recycled object (via continuation for
  example).  [ruby-dev:24463]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-19 10:25:23 +00:00
shigek
833fd60878 Fix for 'incomplete bug fix' for 1.41.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-05-11 14:30:05 +00:00
(no author)
5923a2c0e7 This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-06 08:02:56 +00:00
(no author)
dba9fc9dc7 This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-25 08:48:14 +00:00
nobu
faab8f264d * configure.in (ieeefp.h), numeric.c: needed for finite() on
Solaris.  [ruby-core:01921]

* file.c (rb_stat_inspect): adjust format specifier.

* parse.c (arg_prepend): nodetype() is for debug use.

* ruby.h (ISASCII, etc): cast to int to get rid of warning.

* ruby.h (alloca.h): include even in GCC.  [ruby-core:01925]

* ext/bigdecimal/bigdecimal.c (GetVpValue): adjust format
  specifier.

* ext/bigdecimal/bigdecimal.c (BigDecimal_prec, BigDecimal_coerce,
  BigDecimal_divmod): use rb_assoc_new() to suppress memory usage.

* ext/bigdecimal/bigdecimal.c (BigDecimal_split): ditto.

* ext/dl/sym.c (rb_dlsym_guardcall): guard itself should be
  volatile.

* ext/iconv/iconv.c (iconv_convert): ensure actual parameter with
  format specifier.

* ext/pty/pty.c (MasterDevice, SlaveDevice, deviceNo): do not
  define unless used.

* ext/pty/pty.c (getDevice): get rid of warning.

* ext/socket/socket.c (port_str, sock_s_getaddrinfo,
  sock_s_getnameinfo): FIX2INT() now returns long.

* ext/socket/socket.c (init_inetsock_internal): uninitialized
  variable.

* ext/syck/rubyext.c (syck_parser_assign_io): add prototype.

* ext/syck/rubyext.c (rb_syck_mktime, yaml_org_handler): use
  ISDIGIT() instead of isdigit() to avoid warnings and for
  platforms which don't support non-ascii charater.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-11 02:39:59 +00:00
shigek
970ad34c95 Local version number(BigDecimal::ver) incremented.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-21 03:29:54 +00:00
shigek
98abf532a4 Bug fix: [ruby-dev:21314] [BigDecimal] [BUG] Segmentation fault
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-04 03:50:37 +00:00
shigek
da24c258c3 Bug in mult method fixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-03 10:47:44 +00:00
shigek
da84ad63ee The 2nd arg for add,sub,mult, and div is 0, then result will be same as +,-,*,/ respectively.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-29 13:37:44 +00:00
shigek
0ec8683145 Forgot to round '*'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-27 13:29:23 +00:00
shigek
4b159597af sqrt() error checking bug fixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-26 13:22:32 +00:00
shigek
e0a51801f8 sqrt() speed up.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-26 12:48:13 +00:00
shigek
39503e4d0f Int. overflow bug in multiplication fixed & VpNmlz() speed up.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-21 15:13:45 +00:00
shigek
62acad914e to_s("+") implemented.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-19 14:21:13 +00:00
shigek
6b0e6a7ce7 Bug fix: limit & div combination.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-15 14:09:51 +00:00
shigek
588c9c66bf Bug fix: div method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-14 15:11:44 +00:00
shigek
0b6cf4bea8 Ambiguity of BigDecimal::limit removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-13 14:33:31 +00:00
shigek
b2385db896 Bug fix: '-' should not be counted as a digit(to_s(n) format).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-10 14:28:08 +00:00
shigek
606c473683 F style output(like 1234.56789) implemented to to_s method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-08 15:31:27 +00:00
shigek
657a5c4b96 Just small change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-06 15:18:46 +00:00