Project

General

Profile

Bug #12780 ยป bigdecimal_round.diff

Gat (Dawid Janczak), 09/21/2016 10:47 AM

View differences:

ext/bigdecimal/bigdecimal.c
GUARD_OBJ(c, VpCreateRbObject(mx, "0"));
VpSetPrecLimit(pl);
VpActiveRound(c, a, sw, iLoc);
if (argc == 0) {
return BigDecimal_to_i(ToValue(c));
}
return ToValue(c);
}
test/bigdecimal/test_bigdecimal.rb
assert_equal(3.142, BigDecimal.new("3.14159").round(3))
assert_equal(13300.0, BigDecimal.new("13345.234").round(-2))
assert_equal(BigDecimal, BigDecimal.new("3.28").round.class)
x = BigDecimal.new("111.111")
assert_equal(111 , x.round)
assert_equal(111.1 , x.round(1))
    (1-1/1)