Re: [osdcmy-public] cpu bug on plus minus operations detected
Take a look at http://speleotrove.com/decimal/ for a workaround On Thu, Sep 23, 2010 at 2:06 PM, simpleLinux 2fz...@gmail.com wrote: Have you reported this bug to the Community? On Sun, Sep 5, 2010 at 1:18 PM, Walter Heck - OlinData.com walterh...@olindata.com wrote: Yep, that is why MySQL for instance has the data type NUMERIC/DECIMAL as opposed to FLOAT and DOUBLE (See: http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html) Also, a lot of programming languages have special datatypes used for storing financial values as they are particularly nasty for rounding errors. Never seen a 0.01 cent difference when Adding a number of items on an invoice programmatically? Walter On Sun, Sep 5, 2010 at 12:37, Aizuddin a.k.a ak47suk1 kaibatheleg...@gmail.com wrote: Hmmm... Tested on my lappy, AMD Turion64 X2, Ubuntu Lucid Lynx 64-bit. OpenOffice Calc: Input: =161001.165-10.009-6.7-1000.456 Output: 0.000557065504835919 Input: =161001.165+(-10.009-6.7-1000.456) Output: 0 Input: =((161001.165-10.009)-6.7)-1000.456 Output: 0.000557065504835919 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'), - - (-10.009, 'all'), - - (-6.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 rajaiskand...@gmail.com 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 walterh...@olindata.com 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.comosdcmy-list%2bunsubscr...@googlegroups.com 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.comosdcmy-list%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en -- Walter Heck Founder @ OlinData (http://olindata.com) -- 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.comosdcmy-list%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en -- Fariz Luqman The Chairman of SimpleLinux Visit: http://www.simplelinux.tk There IS a Malaysian Linux Distro -- 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.comosdcmy-list%2bunsubscr...@googlegroups.com For
[osdcmy-public] cpu bug on plus minus operations detected
guys, need some help testing this out taufiq has detected a bug involving a plus minus operations that should result in zero but does not ! try the following in openoffice calc, ms excel, javascript, google calc =161001.165-10.009-6.7-1000.456 // will not return zero =161001.165+(-10.009-6.7-1000.456) // this does =((161001.165-10.009)-6.7)-1000.456 // and this not read the test case : http://software.krimnet.com/cpu-precision-bug-plus-minus-operation.htm#comment-491 so far we have tested on intel atom, intel core2, intel xeon need to see if the same problem happens on amd cpu -- 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en
Re: [osdcmy-public] cpu bug on plus minus operations detected
This is floating point rounding causing you hassles. Read this for more info: http://docs.sun.com/source/806-3568/ncg_goldberg.html (that gest very technical though :) ) On Sun, Sep 5, 2010 at 10:01, Raja Iskandar Shah rajaiskand...@gmail.com wrote: guys, need some help testing this out taufiq has detected a bug involving a plus minus operations that should result in zero but does not ! try the following in openoffice calc, ms excel, javascript, google calc =161001.165-10.009-6.7-1000.456 // will not return zero =161001.165+(-10.009-6.7-1000.456) // this does =((161001.165-10.009)-6.7)-1000.456 // and this not read the test case : http://software.krimnet.com/cpu-precision-bug-plus-minus-operation.htm#comment-491 so far we have tested on intel atom, intel core2, intel xeon need to see if the same problem happens on amd cpu -- 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en -- Walter Heck Founder @ OlinData (http://olindata.com) -- 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en
Re: [osdcmy-public] cpu bug on plus minus operations detected
i was also reading that article. but in that article, all the examples given involves multiplication and divisions and exponents. this has been noted before. the bug have the same root cause, but none has given a simple addition and subtraction case example yet. it is just 4 numbers and 3 decimal places. the example test case is actual data from our ida application. fortunately, the 12th decimal place is not significant. but imagine the problem occurring in astrophysics or quantum mechanics, dealing with pie and prime numbers ! i wonder how is it handled in nuclear research and atomic super colliders ? small error - but wham ! bang ! good bye world ! http://software.krimnet.com/cpu-precision-bug-plus-minus-operation.htm On Sun, Sep 5, 2010 at 10:11 AM, Walter Heck - OlinData.com walterh...@olindata.com wrote: This is floating point rounding causing you hassles. Read this for more info: http://docs.sun.com/source/806-3568/ncg_goldberg.html (that gest very technical though :) ) On Sun, Sep 5, 2010 at 10:01, Raja Iskandar Shah rajaiskand...@gmail.com wrote: guys, need some help testing this out taufiq has detected a bug involving a plus minus operations that should result in zero but does not ! try the following in openoffice calc, ms excel, javascript, google calc =161001.165-10.009-6.7-1000.456 // will not return zero =161001.165+(-10.009-6.7-1000.456) // this does =((161001.165-10.009)-6.7)-1000.456 // and this not read the test case : http://software.krimnet.com/cpu-precision-bug-plus-minus-operation.htm#comment-491 so far we have tested on intel atom, intel core2, intel xeon need to see if the same problem happens on amd cpu -- 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.comosdcmy-list%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en -- Walter Heck Founder @ OlinData (http://olindata.com) -- 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.comosdcmy-list%2bunsubscr...@googlegroups.com 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en
Re: [osdcmy-public] cpu bug on plus minus operations detected
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 On Sun, Sep 5, 2010 at 10:33, Raja Iskandar Shah rajaiskand...@gmail.com wrote: i was also reading that article. but in that article, all the examples given involves multiplication and divisions and exponents. this has been noted before. the bug have the same root cause, but none has given a simple addition and subtraction case example yet. it is just 4 numbers and 3 decimal places. the example test case is actual data from our ida application. fortunately, the 12th decimal place is not significant. but imagine the problem occurring in astrophysics or quantum mechanics, dealing with pie and prime numbers ! i wonder how is it handled in nuclear research and atomic super colliders ? small error - but wham ! bang ! good bye world ! http://software.krimnet.com/cpu-precision-bug-plus-minus-operation.htm On Sun, Sep 5, 2010 at 10:11 AM, Walter Heck - OlinData.com walterh...@olindata.com wrote: This is floating point rounding causing you hassles. Read this for more info: http://docs.sun.com/source/806-3568/ncg_goldberg.html (that gest very technical though :) ) On Sun, Sep 5, 2010 at 10:01, Raja Iskandar Shah rajaiskand...@gmail.com wrote: guys, need some help testing this out taufiq has detected a bug involving a plus minus operations that should result in zero but does not ! try the following in openoffice calc, ms excel, javascript, google calc =161001.165-10.009-6.7-1000.456 // will not return zero =161001.165+(-10.009-6.7-1000.456) // this does =((161001.165-10.009)-6.7)-1000.456 // and this not read the test case : http://software.krimnet.com/cpu-precision-bug-plus-minus-operation.htm#comment-491 so far we have tested on intel atom, intel core2, intel xeon need to see if the same problem happens on amd cpu -- 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en -- Walter Heck Founder @ OlinData (http://olindata.com) -- 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en -- Walter Heck Founder @ OlinData (http://olindata.com) -- 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en
Re: [osdcmy-public] cpu bug on plus minus operations detected
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 walterh...@olindata.com 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en
Re: [osdcmy-public] cpu bug on plus minus operations detected
Hmmm... Tested on my lappy, AMD Turion64 X2, Ubuntu Lucid Lynx 64-bit. OpenOffice Calc: Input: =161001.165-10.009-6.7-1000.456 Output: 0.000557065504835919 Input: =161001.165+(-10.009-6.7-1000.456) Output: 0 Input: =((161001.165-10.009)-6.7)-1000.456 Output: 0.000557065504835919 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'), - - (-10.009, 'all'), - - (-6.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 rajaiskand...@gmail.com 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 walterh...@olindata.com 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.comosdcmy-list%2bunsubscr...@googlegroups.com 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en
Re: [osdcmy-public] cpu bug on plus minus operations detected
Yep, that is why MySQL for instance has the data type NUMERIC/DECIMAL as opposed to FLOAT and DOUBLE (See: http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html) Also, a lot of programming languages have special datatypes used for storing financial values as they are particularly nasty for rounding errors. Never seen a 0.01 cent difference when Adding a number of items on an invoice programmatically? Walter On Sun, Sep 5, 2010 at 12:37, Aizuddin a.k.a ak47suk1 kaibatheleg...@gmail.com wrote: Hmmm... Tested on my lappy, AMD Turion64 X2, Ubuntu Lucid Lynx 64-bit. OpenOffice Calc: Input: =161001.165-10.009-6.7-1000.456 Output: 0.000557065504835919 Input: =161001.165+(-10.009-6.7-1000.456) Output: 0 Input: =((161001.165-10.009)-6.7)-1000.456 Output: 0.000557065504835919 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'), - - (-10.009, 'all'), - - (-6.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 rajaiskand...@gmail.com 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 walterh...@olindata.com 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en -- Walter Heck Founder @ OlinData (http://olindata.com) -- 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 osdcmy-list@googlegroups.com To unsubscribe from this group, send email to osdcmy-list+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/osdcmy-list?hl=en