Re: [stella] What's magic about a byte?

Subject: Re: [stella] What's magic about a byte?
From: Adam Wozniak <adam@xxxxxxxxxxxxxxxx>
Date: Wed, 13 Apr 2005 20:25:12 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 13 Apr 2005, Kirk Israel wrote:
> I still think it's funny that you can't store many
> fractions, even certain "hundreths", correctly in binary--people who
> don't know what they're doing in business software can get in trouble
> with that.

Hundreths?

Try 1/20 in binary:
.00001100110011001100110011001100110011001100110011001100110011001100...

I used to mentor teams for the annual ACM programming contest.  Early on,
I'd always give them problems involving money, with test cases that added
nickels to nickels to nickels... to get their programs to exhibit roundoff
errors.

After that, my teams never ever use floating point numbers to represent
money ever again.  Much easier to keep track of integer pennies anyway. :)

- -- 
adam@xxxxxxxxxxxxxxxx        http://cuddlepuddle.org/~adam
KG6GZR                       http://cuddlepuddle.org/~adam/resume.html

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFCXbhDyvXf5Z0z5zERAj3lAKDFPvZ+oPSZCmSRtjJieC7Pu0b7PACfXp6S
ufS6aLCUNI5i8d55MyBpAwI=
=UDPJ
-----END PGP SIGNATURE-----

Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com

Current Thread