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 / April 2006

Tip: Looking for answers? Try searching our database.

problem with the format of BigDecimal

Thread view: 
blackswift - 15 Apr 2006 06:21 GMT
hello all,
I don't want to BigDecimal to do any smart thing.

0.4321^20
I want to get
.00000005148554641076956121994511276767154838481760200726351203835429763013462401
but not
5.148554641076956121994511276767154838481760200726351203835429763013462401E-8

how to do with the format?

thanks in advance.

best regards
blackswift
Luc The Perverse - 15 Apr 2006 07:15 GMT
> hello all,
> I don't want to BigDecimal to do any smart thing.
[quoted text clipped - 11 lines]
> best regards
> blackswift

Um.    For the example you provided either way is feasible - but what if the
answer is -1.64E-180?

Do you understand E notation?   It is really cool.

--
LTP

:)
blackswift - 15 Apr 2006 07:29 GMT
I know E is OK.
But in this situation only I need is a simple form
Mark Thomas - 15 Apr 2006 11:46 GMT
> I know E is OK.
> But in this situation only I need is a simple form

There's a bit on that in this Tech Tip:
http://java.sun.com/developer/TechTips/1999/tt0826.html

Mark
Mark Thomas - 15 Apr 2006 11:53 GMT
>> I know E is OK.
>> But in this situation only I need is a simple form
[quoted text clipped - 3 lines]
>
> Mark
Whoops - I now see that at Java 5.0 DecimalFormat can format and parse
BigDecimal.  You just need to enable it using the setParseBigDecimal method.

Mark


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.