Hi,
I was wondering if there was a straightforward method of obtaining the
complement (i.e. the postive value) of a Currency object. Failing that,
is there a method of obtaining the same thing for a float?
Cheers,
Matt
Pete Barrett - 13 Oct 2005 19:07 GMT
>Hi,
>
>I was wondering if there was a straightforward method of obtaining the
>complement (i.e. the postive value) of a Currency object. Failing that,
>is there a method of obtaining the same thing for a float?
Does Currency have a value? As far as I can see, all it holds is the
symbol, the ISO 4217 currency code, and the number of digits after the
currency point.
For a float or double there's Math.abs(...). Or is that not what you
mean?
Pete Barrett
Roedy Green - 19 Oct 2005 11:28 GMT
On 13 Oct 2005 08:09:25 -0700, matthewjbarr@gmail.com wrote or quoted
>is there a method of obtaining the same thing for a float?
Math.abs
or if ( x < 0 ) x = -x;

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Roedy Green - 19 Oct 2005 11:31 GMT
On 13 Oct 2005 08:09:25 -0700, matthewjbarr@gmail.com wrote or quoted
>I was wondering if there was a straightforward method of obtaining the
>complement (i.e. the postive value) of a Currency object. Failing that,
>is there a method of obtaining the same thing for a float?
Currency objects just record details about a currency, i.e. how to
display it. They are not for storing currency values.
see http://mindprod.com/jgloss/currency.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.