Well, probably because SQL and Java were specified by different people. There is no generally accepted procedure for rounding in mathematics...

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus

Don't know. I googled for rounding, and found a couple of discussions. Here, and here. There doesn't seem to be a consistent definition of rounding.

But at least round 2.5->3 and 3.5->4 is consistent. In which case, you round up on halves. So -1.5 rounds UP to -1. Yes, -1 is more than -1.5. Which is similar to what it says in the API specification for java.lang.Math.

In general, I would think that if you care about the exact results of functions, with exact parameters, then you should not be using floating-point (float, double).

Any floating-point number, represented in a computer, is potentially inexact. Some numbers can be represented exactly, but it depends upon the precise details of the floating-point representation used. You should try to avoid making your code depend on that.

If you care about exact numbers, use integer arithmetic (maybe with implicit scaling, for fixed decimal places) or maybe BigDecimal.

This is particularly crucial for financial calculations. With the possible exception of some complicated derivatives, on which I am unqualified to comment, financial calculations should never be done in floating point.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.

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