Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Slightly OT: Rounding Negative Numbers

RE: Slightly OT: Rounding Negative Numbers

From: kkennedy <kkennedy_at_firstpoint.com>
Date: Thu, 29 Aug 2002 08:48:41 -0800
Message-ID: <F001.004C2A87.20020829084841@fatcity.com>


I have to jump in at this point since the arguments for rounding -0.875 to -0.87 just don't seem quite right (I guess I might be Gaussian about this thing). Let me use a different approach to this argument:

Value Rounded
-0.870 -0.87
-0.871 -0.87
-0.872 -0.87
-0.873 -0.87
-0.874 -0.87
-0.875 ?
-0.876 -0.88
-0.877 -0.88
-0.878 -0.88
-0.879 -0.88

Let's look at the distribution. If -0.875 rounds to -0.87 then 60% of the values round to -0.87 and 40% round to -0.88. But, if -0.875 rounds to -0.88 then 50% of the values round each way. A 50/50 split is much more pleasing to my mind than a 60/40 split.

In my opinion, the Java example gave the wrong answer. I have to wonder if the expression (a*100) got cast into an integer before being handed to the round class. The alternative of questioning the validity of the class is less appealing.

Kevin Kennedy
First Point Energy Corporation

If you take RAC out of Oracle you get OLE! What can this mean?

-----Original Message-----

Sent: Thursday, August 29, 2002 7:18 AM
To: Multiple recipients of list ORACLE-L

After an intense "ask-your-local-mathematician"-session, here you go:

It depends ;) (That's typical math-guys, isn't it ?). If you define "round" according to the Gauss function, then it should calculate it using absolute values, that would be -0.88. On the other hand, "round" is usually defined to go for the higher value from 5 on, so, since -0.87 is "higher" than
-0.875, -0.87 would be correct.

You actually don't know wether the function is implemented one or the other way. You can just try. And if you are not content with the results, you have to cook your own.

Regards,

Stefan Jahnke
Consultant
BOV Aktiengesellschaft
Voice: +49 201 - 4513-298
Fax: +49 201 - 4513-149
mailto:stefan.jahnke_at_bov.de

visit our website: http://www.bov.de
subscribe to our newsletter: http://www.bov.de/presse/newsletter.asp

Behalten Sie den Ueberblick - mit dem neuen BasicOverView, unserer Seminaruebersicht fuer das 2. Halbjahr 2002. Sie haben noch kein Exemplar? Schreiben Sie eine E-Mail an mailto:qualification_at_bov.de oder rufen Sie uns an unter 0 18 03 / 73 64 62 73!

Wie Sie wissen, koennen ueber das Internet versandte E-Mails leicht unter fremden Namen erstellt oder manipuliert werden. Aus diesem Grunde bitten wir um Verstaendnis dafuer, dass wir zu Ihrem und unserem Schutz die rechtliche Verbindlichkeit der vorstehenden Erklaerungen und Aeusserungen ausschliessen.

As you are probably aware, e-mails sent via the Internet can easily be copied or manipulated by third parties. For this reason we would ask 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:wbuchan_at_uk.intasys.com] 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" mean the highest value (-0.87) or the highest absolute magnitude (-0.88)? :)

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://www.orafaq.com
--

Author: Bill Buchan
  INET: wbuchan_at_uk.intasys.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists

--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).  

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Stefan Jahnke
  INET: Stefan.Jahnke_at_bov.de

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists

--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: kkennedy
  INET: kkennedy_at_firstpoint.com
Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists

--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Aug 29 2002 - 11:48:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US