Hi Bill,

Yes, 'precision' is what I meant.
I used the term' digits' because that's what is used for 'numeric_limits<>',
but I much prefer 'precision'.
There is one thing I noticed though that I'd like you to confirm:
Because of the implementation (a normalized rep with two separate int_type
members),
given 'M' as numeric_limits<int_type>::digits10, then the decimal
'precision' is M+1.
If you look at the 'max values with different scales' output of my first
post, you'll see that all values have 19 digits, while __int64 support 18
digits at most.

That is,

  numeric_limits<decimal>::digits
= numeric_limits<decimal>::digits10
= numeric_limits<int_type>::digits10+1

>
> I would say "digits to the right of the decimal point".  (Digits
> to the left of the point I would also call "decimal" because
> they're base-10.)
>
Agreed.

> >
> > It cannot be > '(digits-1'), ...
> >
>
> Yes, the scale can be equal to the precision (which I believe is
> what you're calling "digits"); but then, in general, there won't be
> any digits to the left of the point.
>
I tried to actually create a decimal with no whole digit to show the
equality you mentioned above but failed.
Could it be that because of the implementation there is always at least one
whole digit?
I think so, and in this case, the scale can be at most precision-1.


> >
> > If the concept of 'digits' is formalized, alon with its relation
> > to 'scale', then this statement could simply say that "The conversion
> > will be exact if the string contains no more than 'digits()' digits
> > (whole and/or decimal)"
> >
>
> I don't think that's right.  I can assign 123.45 to a decimal with
> a scale of 2 without rounding.
As long as 'precision' is >= 5.

> Do I misunderstand what you're saying?
>
No, the statement was not clear enough.
What I meant is this: if the string contains a total of more than
'precision' digits, the representation won't be exact. In fact, it will have
an implementation-defined value.
So, I would leave the original sentence, and add a next sentence stating the
above additional constrian.

Fernando Cacciola




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to