Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

Obtaining the complement of a Currency value

Thread view: 
matthewjbarr@gmail.com - 13 Oct 2005 16:09 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?

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.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.