comments
given above.
-Ursprüngliche Nachricht-
Von: Bill Buchan [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 29. August 2002 12:43
An: Multiple recipients of list ORACLE-L
Betreff: Re: Slightly OT: Rounding Negative Numbers
I know the rule "round up", but does "up"
ternal/MEY/NL)
Sent by: Subject: RE: Slightly OT: Rounding
Negative Numbers
[EM
for
your understanding that, for your own protection and ours, we must decline
all legal responsibility for the validity of the statements and comments
given above.
-Ursprüngliche Nachricht-
Von: Bill Buchan [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 29. August 2002 12:43
An: Multip
that, for your own protection and ours, we must decline
all legal responsibility for the validity of the statements and comments
given above.
-Ursprüngliche Nachricht-
Von: Bill Buchan [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 29. August 2002 12:43
An: Multiple recipients of list ORACL
I know the rule "round up", but does "up" mean the highest value (-0.87) or
the highest absolute magnitude (-0.88)? :)
- Bill.
At 09:53 28/08/2002 -0800, you wrote:
>I would think -0.875 would round up therefore -0.87 is my guess.
>
>Rick
>
--
Please see the official ORACLE-L FAQ: http://ww
The way Java calculates round is (int)Math.floor(a + 0.5f)
So you could enforce your rounding algorithm this way:
import java.*;
public class Round {
public static void main(String[] args) {
double a = 0.875;
int i_rounded;
if (a >= 0)
My guess would be that neither is "wrong", but just using different rounding
methods. If you are concerned about both returning different results, you
could add (or subtract, based on sign) .0001 before doing the ROUND.
SELECT ROUND(mynum + SIGN(mynum)*0.0001) FROM DUAL;
Of course, this
Bill,
I haven't tried it with negative numbers but I found round to create
error where commission dollars are concerned. I use the trunc function
to give the results in two decimal places where the extra half cent
makes a difference over the period of time.
total = trunc(sum * %,2)
Select trunc(-
I would think -0.875 would round up therefore -0.87 is my guess.
Rick
Bill Buchan