There are two rounding functions available, bankers (BRND) and (ROUND) which is always up
"William Cook" <[EMAIL PROTECTED]> wrote: >I notice that no one has mentioned "Banker's Rounding." They consider >it a bad thing to always round x.xx5 up. Their rule says when using a >5 for rounding, round the previous digit up if it is odd and leave it >alone if it is even. > >If you always round up you introduce a bias. > >It was my belief that the latest version of R:Base uses Banker's >Rounding. > >Bill Cook >Kent WA USA > >----- Original Message ----- >From: "David M. Blocker" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Thursday, June 06, 2002 10:27 AM >Subject: Re: values rounding incorrectly - Razzak's Reply > > >> I confirm this same erroneous result on beta test copy of build >1.854, >> running on a Windows XP machine. >> >> David Blocker >> >> ----- Original Message ----- >> From: "Eric M. Bienstock, Ph.D." <[EMAIL PROTECTED]> >> To: <[EMAIL PROTECTED]> >> Sent: Thursday, June 06, 2002 9:20 AM >> Subject: Re: values rounding incorrectly - Razzak's Reply >> >> >> > Richard, >> > >> > I believe you may have discovered a bug (in RBwin), and should >report it >> to >> > RDCC. >> > I entered the following command in the latest versions of RBDOS >and RBWIN >> > and got different answers: >> > � � SET VAR vAmt DOUBLE = (ROUND(1.2345,3)) >> > The correct answer, 1.235, was given by RBDOS. >> > The incorrect answer, 1.234, was given by RBWIN. >> > Even more strange, �some values work correctly and some do not, >which you >> > can see after trying a few tests using numbers such as 2.2345, >3.2345, >> etc. >> > The example given by Razzak works correctly. �These >inconsistencies appear >> > to occur in RBWIN only. >> > >> >> -------------------------------------------------------------------- >------ >> - >> > Eric M. Bienstock, Ph.D. >> > � �Database Development, etc. >> > � � � Authorized R:BASE Developer >> > � � � � �Eric M. Bienstock & Associates, Inc. >> > � � � � � � day: 212-978-7948 � �eve: �973-763-8650(8) >> > � � � � � � � �FAX: �775-254-2109 � �[EMAIL PROTECTED] >> > � � � � � � � � � �http://mywebpages.comcast.net/ericmb/ >> >> -------------------------------------------------------------------- >------ >> - >> > >> > ----- Original Message ----- >> > From: "Richard Kahl" <[EMAIL PROTECTED]> >> > To: <[EMAIL PROTECTED]> >> > Sent: Thursday, June 06, 2002 8:17 AM >> > Subject: Re: values rounding incorrectly - Razzak's Reply >> > >> > >> > | Thanks but I wish it was that simple. The problem is occuring in >a >> > computed >> > | column. >> > | column 1 quantity real >> > | column 2 price currency >> > | column 3 subtotal currency = (quantity * price) >> > | when quantity = 12.5 ,price = 36.55,subtotal shows as 456.87 >should >> round >> > to >> > | 456.88 >> > | In another example >> > | set var v1 double = 456.875 >> > | set var v2 double = (12.5 * 36.55) >> > | set var v1a double = (round(.v1,2)) >> > | set var 2a double = (round(.v2,2)) >> > | in this case >> > | v1a = 456.88 >> > | v2a = 456.87 >> > | >> > | Am I doing something wrong? >> > | >> > | Thanks >> > | Richard Kahl >> > | >> > | ----- Original Message ----- >> > | From: "A. Razzak Memon" <[EMAIL PROTECTED]> >> > | To: <[EMAIL PROTECTED]> >> > | Sent: Wednesday, June 05, 2002 10:46 PM >> > | Subject: Re: values rounding incorrectly - Razzak's Reply >> > | >> > | >> > | > >> > | > At 10:22 PM 6/5/02 -0400, Richard Kahl wrote: >> > | > >> > | > >When performing calculations with currency or using the >> > | > >round function the values are not rounding correctly. ex >> > | > >set var vamt = (round(125.875,2)) is yielding �125.87 set >> > | > >var vamt = (12.5 * 36.55) is yielding �456.87 using 6.5++ >> > | > >build 1.851 Does anyone know of what could cause this? >> > | > >> > | > Richard, >> > | > >> > | > You MUST define the data type first. >> > | > >> > | > Syntax for ROUND: >> > | > >> > | > Syntax: �(ROUND(arg1, arg2)) >> > | > Where : arg1 is the value to be rounded >> > | > � � � � arg2 is the position to be rounded after the >> > | > � � � � decimal point. >> > | > >> > | > Example 01: >> > | > >> > | > SET VAR vAmt CURRENCY >> > | > SET VAR vAmt = (ROUND(125.875,2)) >> > | > >> > | > Example 02: >> > | > >> > | > SET VAR vAmt CURRENCY = (ROUND(125.875,2)) >> > | > >> > | > Example 03: >> > | > >> > | > SET VAR vAmt DOUBLE >> > | > SET VAR vAmt = (ROUND(125.875,2)) >> > | > >> > | > Example 04: >> > | > >> > | > SET VAR vAmt DOUBLE = (ROUND(125.875,2)) >> > | > >> > | > Enjoy and make sure to have fun! >> > | > >> > | > Very Best Regards, >> > | > >> > | > Razzak. >> > | > >> > | > >> > | > >> > | > >> > | > ================================================ >> > | > TO SEE MESSAGE POSTING GUIDELINES: >> > | > Send a plain text email to [EMAIL PROTECTED] >> > | > In the message body, put just two words: INTRO rbase-l >> > | > ================================================ >> > | > TO UNSUBSCRIBE: send a plain text email to >[EMAIL PROTECTED] >> > | > In the message body, put just two words: UNSUBSCRIBE rbase-l >> > | > ================================================ >> > | > TO SEARCH ARCHIVES: >> > | > http://www.mail-archive.com/rbase-l%40sonetmail.com/ >> > | >> > | >> > | ================================================ >> > | TO SEE MESSAGE POSTING GUIDELINES: >> > | Send a plain text email to [EMAIL PROTECTED] >> > | In the message body, put just two words: INTRO rbase-l >> > | ================================================ >> > | TO UNSUBSCRIBE: send a plain text email to >[EMAIL PROTECTED] >> > | In the message body, put just two words: UNSUBSCRIBE rbase-l >> > | ================================================ >> > | TO SEARCH ARCHIVES: >> > | http://www.mail-archive.com/rbase-l%40sonetmail.com/ >> > >> > ================================================ >> > TO SEE MESSAGE POSTING GUIDELINES: >> > Send a plain text email to [EMAIL PROTECTED] >> > In the message body, put just two words: INTRO rbase-l >> > ================================================ >> > TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] >> > In the message body, put just two words: UNSUBSCRIBE rbase-l >> > ================================================ >> > TO SEARCH ARCHIVES: >> > http://www.mail-archive.com/rbase-l%40sonetmail.com/ >> > >> >> >> ================================================ >> TO SEE MESSAGE POSTING GUIDELINES: >> Send a plain text email to [EMAIL PROTECTED] >> In the message body, put just two words: INTRO rbase-l >> ================================================ >> TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] >> In the message body, put just two words: UNSUBSCRIBE rbase-l >> ================================================ >> TO SEARCH ARCHIVES: >> http://www.mail-archive.com/rbase-l%40sonetmail.com/ > >================================================ >TO SEE MESSAGE POSTING GUIDELINES: >Send a plain text email to [EMAIL PROTECTED] >In the message body, put just two words: INTRO rbase-l >================================================ >TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] >In the message body, put just two words: UNSUBSCRIBE rbase-l >================================================ >TO SEARCH ARCHIVES: >http://www.mail-archive.com/rbase-l%40sonetmail.com/ > __________________________________________________________________ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/
