This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
See Try this:
Posts: 1166
Java Linux Netbeans IDE
  • X Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The expression 3/2 is evaluated as integer 3 divided by integer 2 which results in integer 1. When assigned to a double this is promoted to 1.0 and NOT 1.5 as you seem to expect.

The problem you are having is nothing to do with rounding.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!