File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes getDouble() not returning correct data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getDouble() not returning correct data" Watch "getDouble() not returning correct data" New topic

getDouble() not returning correct data

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hi. I have a column in a table that has data that is defined as Numeric(6,4).
In my java app, all I am trying to do is print this data to std out. When I get the information from the db, I do a getDouble() to retrieve it, and I am getting a result of 1.0E-4 ?? The actual value in the db is .0001. Why isn't this returning .0001?
If I run the SQL statement and don't go through the app, it returns .0001.
What am I doing wrong?
Thanks for any help.
Matthew Vincent

Joined: May 01, 2003
Posts: 8
Just use the following code snippet to help you. Assuming that your variable is called myVal...

Joel McNary

Joined: Aug 20, 2001
Posts: 1824

Just for the record, 1.0E-4 is .0001, in case anyone missed that.

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
subject: getDouble() not returning correct data
It's not a secret anymore!