Opened 6 years ago

Last modified 6 years ago

#12211 new Bugs

boost::multiprecision cpp_int renders string inconsistently w.r.t. locale

Reported by: Tassilo Glander <tassilo.glander@…> Owned by: John Maddock
Milestone: To Be Determined Component: multiprecision
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description

When a global locale is set that differs from the classic one, the string output is inconsistent for small numbers, i.e. that fit into one limb, vs bigger numbers. If the locale defines a thousands separator, it is rendered for the small number but not for the bigger number. Example: str() will render 9.999 but also 9999999999999999

The reason is the different internal handling of these cases: a small number is rendered using boost lexical_cast, which evaluates the global locale, while the bigger number is constructed by hand.

Required behavior is that the output is consistent regardless of the size of the number. In addition, it would be nice if str() would use the global locale, while the stream output respects the locale imbued into the given stream.

Attachments (1)

bug_multiprecision_locale_str.cpp (659 bytes ) - added by Tassilo Glander <tassilo.glander@…> 6 years ago.

Download all attachments as: .zip

Change History (2)

by Tassilo Glander <tassilo.glander@…>, 6 years ago

comment:1 by John Maddock, 6 years ago

Confirmed. I do know that a lot more work needs to be done in this area.

Note: See TracTickets for help on using tickets.