I am having a column in table named amountClaimed[Number(20,2)].
I have a value in that column 8787854545.89 and I want to print it on the screen exactly in the same way.
But what I am getting is 8.78785454589E9.
I am using rs.getDouble method and trying it to display it through variable in double.
the code is like:
That's the way how large double values look like when they converted to String. If you really need to print on System.out, you may use something like:
System.out.printf("%.2f",temp); Which prints the double value with only two digits in the decimal place. If you need to get a String value out of it, try using String.format(-) method.
Devaka Cooray wrote:Compare? If you need to check if the double values d1 and d2 are equivalent, that's what == operator is for.
There are a couple of things to note however:
1. We generally don't simply compare floating point types for equality using simply d1 == d2. Because of the errors inherent in floating point calculations, we need to compare whether d1 and d2 differ by less than some epsilon.
2. The OP mentioned Double with a capital D. I don't know if that was a typo or deliberate. If we're dealing with Double objects (as opposed to double primitives), we definitely don't want to use == .
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Conversion of Number datatype in Oracle to Double format or a String.