BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-20-2010, 09:07 AM   #1 (permalink)
New Member
 
Join Date: Jul 2010
Model: 9550
PIN: N/A
Carrier: airtel
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default convert exponent value to double

Please Login to Remove!

hey,

i want to convert a exponent value like 1.0E-4 value to double.can anyone help me with this
__________________
Nivy
Offline  
Old 07-20-2010, 09:25 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Did you already try

double d = Double.parseDouble("1.0E-4");

According to the javadocs, this works.
Offline  
Old 07-20-2010, 09:50 AM   #3 (permalink)
New Member
 
Join Date: Jul 2010
Model: 9550
PIN: N/A
Carrier: airtel
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

nope no luck
its displaying the same value
__________________
Nivy
Offline  
Old 07-20-2010, 11:02 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Code:
        double d = Double.parseDouble("1.0E-4");
        System.out.println(d);
Output: 1.0E-4

So yes, it does work. If you want it to display in some other format (like 0.0001) you will have to get into output formating.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 07-22-2010, 11:36 AM   #5 (permalink)
New Member
 
Join Date: Jul 2010
Model: 9550
PIN: N/A
Carrier: airtel
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default convert exponential value to double

__________________
Nivy
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.