Why Python is like C++
Tim Chase
python.list at tim.thechases.com
Sat Dec 21 11:29:39 EST 2013
On 2013-12-21 10:59, Roy Smith wrote:
> > In know that my first BASIC, Applesoft BASIC had the 2-character
> > names, and you had to load Integer Basic (with Ints in addition
> > to the standard Floats used in the BASIC provided by the ROM, a
> > strange choice).
>
> Why is it a strange choice? If you're only going to support a
> single type of numeric value, floats make a lot more sense than
> ints. Floats are a superset of integers.
>
> Javascript, anyone?
It's one thing when JS uses bajillion-bit precision on the floats.
With an 8-bit processor, the accuracy was wanting (according to
Wikipedia[1], single-precision with 8-bit exponent & 31-bit
significand), so you'd often hit cases where INT1 + INT2 *should*
equal INT3
+ INT4, but because of floating-point errors, they wouldn't. It's
maddening to have the mathematical equivalent of
2 + 4 != 1 + 5
manifest itself in your programs. And even harder to explain to a
middle-schooler that I was at the time. :-/
Also, one of the main reasons to choose INTEGER BASIC on the Apple
was that was notably faster, since FP math was managed in software,
rather than in dedicated FP hardware.
-tkc
[1]
http://en.wikipedia.org/wiki/Applesoft_basic#Background
More information about the Python-list
mailing list