Project

General

Profile

Actions

Feature #17339

open

Semantic grouping with BigDecimal#to_s

Added by chumaltd (Takahiro Chuma) about 4 years ago. Updated over 1 year ago.

Status:
Assigned
Target version:
-
[ruby-core:100999]

Description

Abstract

Thousands, millions, ... should be expressible with BigDecimal#to_s.

Background

BigDecimal('1234567').to_s('3F') returns "123 456 7.0".

Proposal

  • Have an option with which BigDecimal('1234567').to_s('3F') returns "1 234 567.0".
  • With decimal, BigDecimal('1234567.8901234').to_s('3F') should return "1 234 567.890 123 4".
  • Default behavior should be the above in long term.
  • And/Or, it would be nice to have a pretty method name. I think #to_s('3F') has universal use cases like money calculation.

Discussion

Summary

We want to have a natural format.


Related issues 1 (1 open0 closed)

Related to Ruby master - Feature #18410: Proposal to make inspect include underscores on numericsOpenActions
Actions

Also available in: Atom PDF

Like1
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0