[omniORB] CORBA::Fixed::round() method
Renzo Tomaselli
renzo.tomaselli@tecnotp.it
Wed Mar 5 16:39:00 2003
Duncan,
> On Monday 3 March, "Renzo Tomaselli" wrote:
>
> > CORBA::Fixed CORBA::Fixed::round(CORBA::UShort scale) const {
> > if (scale >= pd_scale)
> > return *this;
> > ...
> >
> > which doesn't allow to create any fixed having a higher scale, so that
it
> > looks like a bug.
>
> round() is used to round an existing fixed number to have a smaller
> scale. Rounding it to have a larger scale doesn't change it. Why do
> you think it would?
my interpretation of specs is that the new fixed must have the requested
scale, not the smaller.
>From C++ mapping, (corba 2.3, pag. 20.40):
"the round and truncate functions convert a fixed value to a new value with
the specified scale".
There seem no exception about which scale is larger.
Btw, I was relying on this while right-aligning for the purpose of building
an index over fixed values, e.g. to always have a well defined number of
scale digits on the right side. The procedure is to fetch all kind of CORBA
numeric values from an Any, to build a Fixed, then to round to the target
(index) scale.
Finally I retrieve the right-aligned value through NP_asString() :-( !
Maybe it's just that my interpretation is too strict, thanks anyway
Renzo