Boost logo

Boost :

From: Paul A. Bristow (boost_at_[hidden])
Date: 2003-07-21 11:06:47


| -----Original Message-----
| From: boost-bounces_at_[hidden]
| [mailto:boost-bounces_at_[hidden]]On Behalf Of Bill Seymour
| Sent: Friday, July 18, 2003 6:43 PM
| To: boost_at_[hidden]
| Subject: [boost] Fixed-Point Decimal Formal Review
|
| Paul Bristow has convinced me that I need longer, clearer names
| for the I/O manipulators. First draft:
|
| pure_number 1.23
| national_currency $1.23
| international_currency USD 1.23

I like these much better. But I feel that using the word money to signal
currency is OK because is it used already, whereas currency isn't. So
national_money and international_money seem more consistent to me (though to be
consistent with some other manipulators they should have show... But then they
are getting a bit long.)

But pure_number doesn't seem to fit well - how about no_currency or no_money, or
nocurrency and nomoney?|

But I'm confused at precisely what these do - can you clarify please.

| number_stream_frac_digits
| number_decimal_frac_digits

| money_stream_frac_digits
| money_decimal_frac_digits
| money_locale_frac_digits

| > MSVC IDE is command-line hostile - could macros could provide
| > suitable examples of platform-specific locale arguments?

| but can't you just run the test program from a DOS prompt?
Yes but the IDE doesn't encourage you to - there is a nice builtin button to run
console apps within the IDE and users naturally, if lazily, would do this first.
(But if the output is shown as a comment at the end, the need to run it at all
is reduced)

(And anway your tests will presumably need to macroized to cope with different
locale representations so these tests will document and demonstrate things.)

| Daryle suggests operations that increment and decrement by 1 ULP;
| and I think that's a good idea. The names I like are next_value()
| and previous_value(); and I'll probably include versions with
| dummy int arguments to parallel the built-in postfix operators.

nextafter is already used in C99 (and thus C++ soon) for this purpose (though
ugly) but you might consider re-using it?

| Daryle also suggests opening up the internal representation with accessors.
How about:

This seems a good idea.

| int_type raw_value() const; // value in ULPs

I also like significand() (mantissa() seems to be so last year :-))

Does this mean 123 for for 2 fractional digits from 1.23?

| int_type unity_value() const; // representation of 1.0

Does this mean 100 for 2 fractional digits eg 1.00?

| int frac_digits() const; // formerly scale()

Does this mean 2 for fractional digits eg 1.00?

Paul

PS I suspect that since a majority will be done with 2 fractional digits, a
template scale/frac_digits is best, but I watch the expert discussion elsewhere.

Paul A Bristow, Prizet Farmhouse, Kendal, Cumbria, LA8 8AB UK
+44 1539 561830 Mobile +44 7714 33 02 04
Mobile mailto:pabristow_at_[hidden]
mailto:pbristow_at_[hidden]


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