Feature #10782 ยป ruby-changes.patch
ext/bigdecimal/bigdecimal.c (working copy) | ||
---|---|---|
* 1.0.0: Ruby 1.8.0
|
||
* 1.0.1: Ruby 1.8.1
|
||
* 1.1.0: Ruby 1.9.3
|
||
* 1.2.0: Ruby 2.3.0
|
||
*/
|
||
return rb_str_new2("1.1.0");
|
||
return rb_str_new2("1.2.0");
|
||
}
|
||
/*
|
||
... | ... | |
arg = rb_str_new2("NaN");
|
||
/* 'Not a Number' value. */
|
||
rb_define_const(rb_cBigDecimal, "NAN", BigDecimal_global_new(1, &arg, rb_cBigDecimal));
|
||
arg = rb_str_new2("0");
|
||
/* Singleton instance of BigDecimal.new('0'). */
|
||
rb_define_const(rb_cBigDecimal, "ZERO", BigDecimal_global_new(1, &arg, rb_cBigDecimal));
|
||
arg = rb_str_new2("1");
|
||
/* Singleton instance of BigDecimal.new('1'). */
|
||
rb_define_const(rb_cBigDecimal, "ONE", BigDecimal_global_new(1, &arg, rb_cBigDecimal));
|
||
arg = rb_str_new2("10");
|
||
/* Singleton instance of BigDecimal.new('10'). */
|
||
rb_define_const(rb_cBigDecimal, "TEN", BigDecimal_global_new(1, &arg, rb_cBigDecimal));
|
||
/* instance methods */
|
ext/bigdecimal/bigdecimal.h (working copy) | ||
---|---|---|
#define SZ_PINF "+Infinity"
|
||
#define SZ_NINF "-Infinity"
|
||
/*
|
||
* #define VP_EXPORT other than static to let VP_ routines
|
||
* be called from outside of this module.
|
test/bigdecimal/test_bigdecimal.rb (working copy) | ||
---|---|---|
Thread.current.keys.to_s
|
||
EOS
|
||
end
|
||
def test_zero_const
|
||
assert_equal(BigDecimal::ZERO, BigDecimal.new('0'))
|
||
assert_equal(BigDecimal::ZERO.object_id, BigDecimal::ZERO.object_id)
|
||
assert_equal((-BigDecimal::ZERO), BigDecimal.new('-0'))
|
||
assert_equal((-BigDecimal::ZERO).object_id, (-BigDecimal::ZERO).object_id)
|
||
end
|
||
def test_one_const
|
||
assert_equal(BigDecimal::ONE, BigDecimal.new('1'))
|
||
assert_equal(BigDecimal::ONE.object_id, BigDecimal::ONE.object_id)
|
||
assert_equal((-BigDecimal::ONE), BigDecimal.new('-1'))
|
||
assert_equal((-BigDecimal::ONE).object_id, (-BigDecimal::ONE).object_id)
|
||
end
|
||
def test_ten_const
|
||
assert_equal(BigDecimal::TEN, BigDecimal.new('10'))
|
||
assert_equal(BigDecimal::TEN.object_id, BigDecimal::TEN.object_id)
|
||
assert_equal((-BigDecimal::TEN), BigDecimal.new('-10'))
|
||
assert_equal((-BigDecimal::TEN).object_id, (-BigDecimal::TEN).object_id)
|
||
end
|
||
end
|