[#78633] ruby/spec needs help from CRuby committers — Benoit Daloze <eregontp@...>

Currently, ruby/spec is maintained mostly by individuals and enjoys the

13 messages 2016/12/13

[ruby-core:78811] [Ruby trunk Feature#12161] Friendly BigDecimal#inspect

From: melentievm@...
Date: 2016-12-23 10:44:26 UTC
List: ruby-core #78811
Issue #12161 has been updated by Max Melentiev.


I see comment says

~~~
 *   BigDecimal.new("1234.5678").inspect
 *     #=> "0.12345678e4"
~~~

It's better than before. But still uses floating-point notation, while even Float itself is inspected as usual decimal number. Is there any intention to improve it in future?

----------------------------------------
Feature #12161: Friendly BigDecimal#inspect
https://bugs.ruby-lang.org/issues/12161#change-62217

* Author: Max Melentiev
* Status: Closed
* Priority: Normal
* Assignee: Kenta Murata
* Target version: 
----------------------------------------
Can BigDecimal's #inspect be more human-friendly? Even just `#<BigDecimal:b7ea1130,1234.5678,8(12)>` instead of `#<BigDecimal:b7ea1130,'0.12345678E4',8(12)>` will be much  easy to read. But I think the best option is `1234.5678(#<BigDecimal:b7ea1130,8(12)>)` or something alike, which focuses on its numeric nature.

I've never used bigdecimal's address and number of significant digits. Maybe if this is rarely used information it can be avoided in #inspect at all.

With such formatting It'll be easier to recognise values in repl, debugger, and especially in test's output/failures.



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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next