[tpm] Talk topics
Abram Hindle
abram.hindle at softwareprocess.es
Thu Nov 29 21:47:52 PST 2012
On 12-11-29 10:19 PM, Scott Elcomb wrote:
> On Thu, Nov 29, 2012 at 9:56 PM, Tom Legrady <legrady at gmail.com> wrote:
>> I can just imagine the CNC carving right through the object, pieces flying
>> in every direction, because you used the wrong browser.
>
> Or client-side math... :-)
>
> 0.1 + 0.2 != 0.3 // true
>
Watch out with floating point comparisons and floating point
accumulation too.
perl -e 'print abs((0.1 + 0.2) - 0.3)'
5.55111512312578e-17
python
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> abs((0.1 + 0.2) - 0.3)
5.551115123125783e-17
The page:
https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
Shows:
Number Value
0.1 0.1 (duh)
float(.1) 0.100000001490116119384765625
double(.1) 0.10000000000000000555111512312578270211815834045 41015625
And of course "What Every Computer Scientist Should Know About
Floating-Point Arithmetic"
http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
Summary: Floats are dangerous.
abram
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20121129/c8565f2b/attachment.bin>
More information about the toronto-pm
mailing list