Yup, you're probably right. Thanks.

2014-12-04 13:00 GMT-03:00 Bryce Kerley <bkerley / brycekerley.net>:

> On Dec 4, 2014, at 10:37, Juanjo Conti <jjconti / gmail.com> wrote:
>
>
> So, fix should return Fixnum or Bignum, not Decimal. I'm tempted to report
> it as a bug. Don't you agree?
>
>
> I don°«t agree. BigDecimal#fix returns a BigDecimal because it°«s
> convenient; the documentation doesn°«t make any guarantees about type, and
> the code doesn°«t do any particular conversions:
>
>
> https://github.com/ruby/ruby/blob/bc0f131277af6b6cd65a5e75c3b8a2d9d8b073ad/ext/bigdecimal/bigdecimal.c#L1643
>
> https://github.com/jruby/jruby/blob/e86c673ba2c3c1e776382b0588fd08cea4109fae/core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java#L1515-L1532
>
> In most cases, I don°«t find myself caring about the class of the result,
> just that the result responds as expected to further usage. BigDecimal(7)
> works enough like Integer(7) that I don°«t need to get picky aboutthe type.
>
> If you°«re having issues with how the number is displayed to the user, look
> into using the `sprintf` method on Kernel, which gives you much more
> control.
>



-- 
Juanjo Conti
Mi primer novela ya se puede conseguir en:
http://www.juanjoconti.com.ar/xolopes