Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2001-09-21 15:14:37


On Friday, September 21, 2001, at 03:16 PM, Bill Seymour wrote:

> First, if I have a numpunct facet that specifies a grouping,
> is it correct to insert thousands separators to the right
> of the decimal point? The text about do_grouping() in
> [lib.facet.numpunct.virtuals] isn't clear about that.

There is considerable debate in the lwg whether or not thousands
separators should be applied to floating point types:

http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#282

If you follow the standard exactly, it appears to say that thousands
separators can appear to the left of the decimal point on floating point
parsing, but not at all in floating point formatting. This exact
reading strikes many as inconsistent enough to be a defect. There are
at least three different existing implementations:

1. Dinkumware: Does not allow thousands separators in parsing or
formatting of floating point values.

2. SGI: Allows thousands separators in parsing, but not formatting of
floating point values.

3. Metrowerks: Allows thousands separators in parsing, and formatting
of floating point values.

In no case does there seem to be support for thousands separators to the
right of the decimal point, only to the left (22.2.3.1/2):

> integer ::= [sign] units
> sign ::= plusminus [whitespace]
> plusminus ::= '+' | '-'
> units ::= digits [thousands-sep units]
> digits ::= digit [digits]
>
> and floating-point values have:
>
>
>
> floatval ::= [sign] units [decimal-point [digits]] [e [sign] digits] |
> [sign] decimal-point digits [e [sign] digits]
> e ::= 'e' | 'E'

> Second, [lib.facet.numpunct.members] says that thousands_sep()
> returns a char_type; but [lib.facet.numpunct.virtuals] says
> that do_thousands_sep() returns a string_type. Am I correct
> in thinking that that's a typo in [...virtuals] and that it's
> supposed to be a char_type?

You are correct, this is an official dr now:

http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#20

-Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk