BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 07-20-2010, 08: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, 08: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, 08: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, 10: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, 10: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  




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