On Mon, 3 Sep 2007 18:29:55 +0100, you wrote:

>This made me to remember there was a bug some time ago about the
>rounding algorithm (but can't remember at what version it was fixed),
>so I just tested it.
>
>"official" amalgamated sqlite 3.4.0 downloaded from the site some time ago:
>
>SQLite version 3.4.0
>Enter ".help" for instructions
>sqlite> select round(98926650.5, 1) ;
>98926650.5
>sqlite> select round(85227887.01, 1) ;
>85227887.0
>sqlite> select round(85227887.01, 2) ;
>85227887.01
>sqlite> select round(98926650.50001, 1) ;
>98926650.5
>
>Linux [K]Ubuntu 7.04 (feisty) sqlite3 package 3.3.13-0ubuntu1:
>
>SQLite version 3.3.13
>Enter ".help" for instructions
>sqlite> select round(98926650.5, 1);
>98926650.5
>sqlite> select round(85227887.01, 1);
>85227887.0
>sqlite> select round(85227887.01, 2);
>85227887.01
>sqlite> select round(98926650.50001, 1) ;
>98926650.5
>
>$ uname -a
>Linux ubuno 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686 GNU/Linux
>
>
>So it seems SQLite is already doing the right job.
>Maybe some OS specific error? Wasn't there some discussion earlier
>about the Microsoft compiler not using the full double precision by
>default?
>
>
>Regards,
>~Nuno Lucas


I found something in a post by Joe Wilson.

Message-ID:
<[EMAIL PROTECTED]>
Date: Sun, 10 Jun 2007 15:55:32 -0700 (PDT)
From: Joe Wilson <[EMAIL PROTECTED]>

He found: 

http://support.microsoft.com/kb/102555

 Microsoft Visual C++ runtime library provides default
floating-point exception handling and includes functions such as
_controlfp for determining and adjusting the floating-point
hardware's rounding, precision control, and exception handling
behavior.

More info on fp:precise and _controlfp:

 http://msdn2.microsoft.com/en-us/library/aa289157(vs.71).aspx

I'm not sure this is related.

Out of curiousness I tried it myself on Microsoft Windows
[Version 6.0.6000, aka vista]

SQLite version 3.4.2

sqlite> select round(98926650.50001, 1);
98926650.5000001
sqlite> select round(98926650.50001 -0.00001, 1);
98926650.5000001
sqlite> select round(98926650.50001 -0.0001, 1);
98926650.5000001
sqlite> select round(98926650.50001 -0.001, 1);
98926650.5000001
sqlite> select round(98926650.50001 -0.01, 1);
98926650.5000001
sqlite> select round(98926650.50001 -0.1, 1);
98926650.4
sqlite>

Oh, well, 9 digits of accuracy is way more than most
measurements we can do in daily life.
For money, use integers and express in cents / centimes or
something.
-- 
  (  Kees Nuyt
  )
c[_]

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to