Math round double number (convert from scientific to real number)

ZURINET
ZURINET used Ask the Experts™
on
Hi all

I have a mathematical method in java
that returns the following value = 1.1638387640158259E-107
How can I convert this number to double
eg..  0.000000000

Thanks in advance..

See code below for example method
varRaidus  = Function.calcRadioActiveRadius(t, startRadius, rateOfDecay);
gives 1.1638387640158259E-107
Which I cannot do any thing with.. 
expected 0.000000000

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
How about taking the absolute value of varRaidus and compare less than a threshold.
if( abs( varRaidus ) < threshold )
    varRaidus = 0.0;

Author

Commented:
I am not expecting the value 0.0...
I need to get some numbers..

eg.. 0.012333 or 0.0000000000000000000000000333

I need to get ride of the  "E-107"

The value I am curently getting is a sceintifc number..
which i dont need
Top Expert 2016
Commented:
If you want to display it, just format


String s = String.format("%.2f", varRadius);

Open in new window

Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

Top Expert 2016

Commented:
(I guess you must want to since deliberately reducing the precision rarely makes sense)

Author

Commented:
I am getting 0.00 which I dont need
Top Expert 2016

Commented:
What are you going to do with it?

Author

Commented:
Another question is

who can I prevent the method varRaidus  = Function.calcRadioActiveRadius(t, startRadius, rateOfDecay);
from outputing the sceintific format?

Given that the 3 variable are t = int  startRadius = double, rateOfDecay = double

Author

Commented:
This number is sceintifc 1.1638387640158259E-107
I am looking for a standard value or double behind it

Author

Commented:
Sorry I forgot my maths
You should use DecimalFormat to format a float to string.
  http://download.oracle.com/javase/6/docs/api/java/text/DecimalFormat.html
Mick BarryJava Developer
Top Expert 2010

Commented:
see the following for options to format a double
http://helpdesk.objects.com.au/java/how-to-format-a-double-as-a-string

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial