[AccessD] Rounding with CCur conversion

Asger Blond ab-mi at post3.tele.dk
Sun Jun 1 17:18:06 CDT 2008


Hi Bobby,

I'm aware that currency rounds to 4 decimal. My question last month was:
what kind of rounding?

Try this:
?Round(1.11125,4) --> 1.1112 (Banker's rounding)
?CCur(1.11125) --> 1.1113 (Arithmetic rounding)
?CCur(111.11115) --> 111.1111 (for sure neither Banker's nor Arithmetic, so
what beast is this, if not a bug?)

Also, I'm astonished to note the lack of standards for financial roundings
between programming languages. I would expect T-SQL (MS SQL Server) to use
Banker's rounding for the money data type. But in fact it uses Arithmetic
rounding: SELECT CAST('1.11125' AS money) --> 1.1113

Doesn't this long aged capitalistic world have some kind of standard
(ANSI/ISO) for financial rounding of the 4th decimal? If not, I finally got
an explanation why my bank account is so unpredictable...

Asger




-----Oprindelig meddelelse-----
Fra: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] På vegne af Bobby Heid
Sendt: 1. juni 2008 01:22
Til: 'Access Developers discussion and problem solving'
Emne: Re: [AccessD] Rounding with CCur conversion

Asger,

The currency type rounds to 4 decimal places.

Bobby

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Asger Blond
Sent: Thursday, May 01, 2008 7:55 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Rounding with CCur conversion

Hi group,

 

I just noticed that the algorithm in VB for rounding seems to be different
for the Round-function and the CCur-function.

The Round-function use "Banker's rounding", also known as "Dutch rounding".
The CCur-function behaves differently:

Round(1.11115,4) --> 1.1112

Round(11.11115,4) --> 11.1112

Round(111.11115,4) --> 111.1112

CCur(1.11115) --> 1.1112

CCur(11.11115) --> 11.1112

CCur(111.11115) --> 111.1111  ?!!

 

What's going on in the last conversion? Is this a bug or does the
CCur-function have a special algorithm?

 

TIA

Asger


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com













































































































































































More information about the AccessD mailing list