I m trying to pass a 10.10 value to double and it takes 10.1 instead of this? Any solution.

Recommended Answers

All 4 Replies

Because mathematically, 10.1 is the same as 10.10 which is the same as 10.100 and so on. You might want to elaborate a bit on the context here to get useful answers.

If your goal is to represent a number with n significant decimals, you should use BigDecimal instead of Double.

If it's simply a formating issue, have a look at NumberFormat and its subclasses (DecimalFormat).

Thank you all, i found the solution myself.... :)

Double haven't any numbers, nor decimal (authors lots of Books about Networking, basic Java and Algebra), for real number is Double best way how to represent Number value with correct precisions

commented: I found the same +8
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.