summaryrefslogtreecommitdiff
path: root/test/ruby/test_float.rb
AgeCommit message (Collapse)Author
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-17numeric.c: Numeric#positive? and Numeric#negative?nobu
* 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-03-18* remove trailing spaces.svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-18hash.c: same hash values with Float#hashnobu
* 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
2014-11-13* test/lib/envutil.rb: Moved from test/ruby/.akr
* test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-01numeric.c: 0 % Float::NAN returns Float::NANnobu
* 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-01add assertions for division NaNnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-18* configure.in: Check nextafter() availability.akr
* 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-03-04* test/ruby: get rid of warnings.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13test/ruby: better assertionsnobu
* test/ruby: use better assertions instead of mere assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22util.c: ignore too long fraction partnobu
* util.c (ruby_strtod): ignore too long fraction part, which does not affect the result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-07numeric.c: no extra checksnobu
* numeric.c (NUM_STEP_SCAN_ARGS): remove extra class checks, which cause the incompatibilities. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-02Retain behavior of Numeric#step when nil is given as second argument.knu
* numeric.c (NUM_STEP_SCAN_ARGS): On sencond thought, keep Numeral#step backward compatible in that it raises TypeError when nil is given as second argument. * test/ruby/test_float.rb (TestFloat#test_num2dbl): Revert. * test/ruby/test_numeric.rb (TestNumeric#test_step): Fix test cases for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-02Fix and add tests for Numeric#step.knu
* test/ruby/test_float.rb (TestFloat#test_num2dbl): Allow nil as step, as with the keyword argument. * test/ruby/test_numeric.rb (TestNumeric#test_step): Add tests for nil as step or limit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-07Suppress warning: Bignum out of Float rangenaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-07* numeric.c (ruby_float_step): fix r37514: it yielded with NaNnaruse
if the unit is infinity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23* test/ruby/test_fixnum.rb (TestFixnum#test_singleton_method): new test.usa
* test/ruby/test_bignum.rb (TestBignum#test_singleton_method): ditto. * test/ruby/test_float.rb (TestFloat#test_singleton_method): ditto. * test/ruby/test_symbol.rb (TestSymbol#test_singleton_method): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-16* bignum.c (rb_big_float_cmp): compare an integer and float precisely.akr
[ruby-core:31376] [Bug #3589] reported by Tomasz Wegrzanowski. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14* numeric.c: fix flodivmod for cornercases [Bug #6044]marcandre
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
2011-11-22Fix for r33811.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-22* numeric.c (ruby_float_step): improve floating point calculations.naruse
[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-10-05Revert r33407; half-baked patch.naruse
"* 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* numeric.c (ruby_float_step): improve floating point calculations.naruse
[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-09-05* test/ruby/test_float.rb (TestFloat#test_round): show the number in question.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-01* numeric.c (flo_round): substitute machine dependent magic number.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-29* numeric.c (flo_round): fix for negative value.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-22* numeric.c (flo_round): fix inaccurate results.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24* error.c (rb_invalid_str): prevent intermediate variable from GC.nobu
[ruby-core:34820] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-30* util.c (ruby_strtod): get rid of overflow/underflow as possible.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-20* util.c (ruby_strtod): reject 0x1.p+0. [ruby-dev:42432] #3966naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-13* util.c (ruby_strtod): reject Float('0x0.').naruse
[ruby-dev:42239] Bug #3820 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-06* util.c (ruby_strtod): check there is at least 1 digit afternaruse
"0x" before ".". [ruby-dev:42183] #3790 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-06* util.c (ruby_strtod): check integr overflow.naruse
[ruby-dev:42180] #3789 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-23* util.c (ruby_strtod): make sure to have digit-sequence after 'p'naruse
for hexadecimal-floating-constant. [ruby-dev:42105] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-24* numeric.c (flo_cmp): honor the result of infinite? method of thenobu
other. [ruby-core:31470] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-24* test/ruby/envutil.rb (EnvUtil#.suppress_warning): added.nobu
* test/ruby/test_float.rb (TestFloat#test_Float): suppress warnings under --verbose. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-12* numeric.c (flo_to_s): make minimum string representation.nobu
[ruby-core:30145] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-29* lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):nobu
use more descriptive assertions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-29* test/ruby: fixed nonsense assertions.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01* object.c (rb_cstr_to_dbl): return 0.0 if hexadecimal andnaruse
baccheck is FALSE: Float("0x1p+0") works, but "0x1p+0".to_f doesn't. [ruby-dev:40650] * util.c (ruby_strtod): allow hexdecimal integers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-29Add Float::INFINITY and Float::NAN.naruse
* numeric.c (Init_Numeric): Add Float::INFINITY and Float::NAN. [ruby-dev:1657] [ruby-dev:4760] [ruby-list:7023] [ruby-list:46690] [ruby-core:26632] [ruby-talk:41352] [ruby-talk:203333] * include/ruby/defines.h (INFINITY): defined. * include/ruby/defines.h (NAN): defined. * include/ruby/util.h (ruby_div0): removed. * numeric.c (fix_pow): use INFINITY and NAN instead of ruby_div0(1.0). * marshal.c (r_object0): ditto. * bignum.c (big_fdiv): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-17* numeric.c (flo_cmp): Infinity is greater than any bignummatz
number. [ruby-dev:38672] * bignum.c (rb_big_cmp): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-09* test/ruby/test_float.rb (TestFloat#test_sleep_with_Float): add akazu
test. see [ruby-core:23282] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14* test/ruby/test_float.rb (TestFloat#test_to_s): precision wasnobu
increased. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-27* numeric.c (flodivmod): floating point division should raisematz
ZeroDivisionError as integer division. [incompatible] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-19* prec.c: removed. Precision will be redesigned and be back again.yugui
c.f. [ruby-dev:36352]. * common.mk (COMMON_OBJS): removed prec.o. * inits.c (rb_call_inits): removed Init_Precision. * numeric.c (Init_Numeric): removed inclusion of Precision. removed #induced_from from each class. * rational.c: ditto. * ext/bigdecimal/bigdecimal.c: ditto. * lib/rdoc/knwon_classes.rb: removed the entry for Precision. * test/ruby/test_prec.rb: removed. * test/ruby/test_integer.rb: removed tests for Precision. * test/ruby/test_fixnum.rb: ditto. * test/ruby/test_float.rb: ditto. * test/ruby/test_rational.rb: ditto. * test/ruby/test_complex.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10* test/ruby/test_float.rb: add tests. [ruby-dev:35009]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-16* math.c (to_flo): rb_Float() accepts even strings for input.matz
* complex.c (nucomp_to_f): fix wrong message. * complex.c (nucomp_to_r): ditto. * object.c (rb_Float): do not check NaN for error. NaN is a part of valid float values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-14* test/ruby/test_object.rb: new tests to achieve over 90% testmame
coverage of object.c, eval.c and eval_method.c. * test/ruby/test_module.rb: ditto. * test/ruby/test_trace.rb: ditto. * test/ruby/test_integer.rb: ditto. * test/ruby/test_float.rb: ditto. * test/ruby/test_method.rb: ditto. * test/ruby/test_variable.rb: ditto. * test/ruby/test_eval.rb: ditto. * test/ruby/test_exception.rb: ditto. * test/ruby/test_class.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-28more tests.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e