Hmmm...

Tested on my lappy, AMD Turion64 X2, Ubuntu Lucid Lynx 64-bit.

OpenOffice Calc:

Input: =161001.165-100000.009-60000.7-1000.456
Output: 0.00000000000557065504835919

Input: =161001.165+(-100000.009-60000.7-1000.456)
Output: 0

Input: =((161001.165-100000.009)-60000.7)-1000.456
Output: 0.00000000000557065504835919

MySQL:

mysql>
mysql> CREATE TABLE `sumtest` (
    ->
    -> `numbers` double NOT NULL,
    ->
    -> `group` varchar(3) NOT NULL DEFAULT 'all'
    ->
    -> );
Query OK, 0 rows affected (0.14 sec)

mysql>
mysql>
mysql>
mysql> INSERT INTO `sumtest` (`numbers`, `group`) VALUES
    ->
    -> (161001.165, 'all'),
    ->
    -> (-100000.009, 'all'),
    ->
    -> (-60000.7, 'all'),
    ->
    -> (-1000.456, 'all');
Query OK, 4 rows affected (0.10 sec)
Records: 4  Duplicates: 0  Warnings: 0

mysql>
mysql>
mysql>
mysql> SELECT SUM( `numbers` )
    ->
    -> FROM `sumtest`
    ->
    -> WHERE `group` = 'all'
    ->
    -> GROUP BY `group`;
+----------------------+
| SUM( `numbers` )     |
+----------------------+
| 5.57065504835919e-12 |
+----------------------+
1 row in set (0.04 sec)


2010/9/5 Raja Iskandar Shah <[email protected]>

> cool ;-)
>
> i wonder if the bug is identical across all 32bit and 64bit cpu ? or intel
> treats them differently than amd, than sunsparc, than arm ?
>
>
>
> On Sun, Sep 5, 2010 at 10:55 AM, Walter Heck - OlinData.com <
> [email protected]> wrote:
>
>> Usually the programming languages used for those kind of programs have
>> their own datatypes for ultra-high precision floating points. A 32 or
>> 64 bit datatype is not enough for them anyway. They use all kinds of
>> tricks/smart-assing to get around floating point rounding errors.
>>
>> Walter
>>
>  --
> Join Open Source Developers Club Malaysia http://www.osdc.my/
>
> Facebook Fan page
>
> http://www.facebook.com/group.php?gid=98685301577
>
> http://www.facebook.com/OSDC.my
>
> You received this message because you are subscribed to the Google
>
> Groups "OSDC.my Mailing List" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<osdcmy-list%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/osdcmy-list?hl=en
>

-- 
Join Open Source Developers Club Malaysia http://www.osdc.my/

Facebook Fan page

http://www.facebook.com/group.php?gid=98685301577

http://www.facebook.com/OSDC.my

You received this message because you are subscribed to the Google

Groups "OSDC.my Mailing List" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/osdcmy-list?hl=en

Kirim email ke