Issue #10569 has been updated by Juanjo Conti.


Seems that Python works the same way. Probably is not a bug:

>>> decimal.Decimal(7).imag
Decimal('0')
>>> decimal.Decimal(7).real
Decimal('7')

----------------------------------------
Bug #10569: BigDecimal#fix returns a BigDecimal object instead of a Integer
https://bugs.ruby-lang.org/issues/10569#change-50293

* Author: Juanjo Conti
* Status: Open
* Priority: Normal
* Assignee: Kenta Murata
* Category: ext
* Target version: 
* ruby -v: ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin13.0]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
According docs (http://www.ruby-doc.org/stdlib-2.1.5/libdoc/bigdecimal/rdoc/BigDecimal.html#method-i-fix):  fix method return the integer part of the number. But it's returning a BugDecimal:

a = BigDecimal(7)
=> #<BigDecimal:7fb18015e698,'0.7E1',9(27)>
a.fix
=> #<BigDecimal:7fb180185d38,'0.7E1',9(18)>
a.fix.to_i
=> 7

Similar problem happens with frac method.



-- 
https://bugs.ruby-lang.org/