[Edu-sig] Rational Division

Gerrit Holl gerrit@nl.linux.org
Tue, 8 Feb 2000 15:21:40 +0100


Tim Peters wrote on 949970551:
> 1. 2/3 is 0.  Like C, Fortran and Python today.  Unlike real life outside
> computer languages.
> 
> 2. 2/3 is 0.666... but not exactly ("binary floating point").  Like Perl.
> Vulnerable to excruciatingly subtle correctness surprises.
> 
> 3. 2/3 is 2/3 ("rationals").  Like ABC (and what newbie testing there
> determined *was* least surprising).  Also like DrScheme (but not all flavors
> of Scheme).  Vulnerable to memory-use and timing surprises.
> 
> 4. 2/3 is 0.666... but using decimal floating-point.  Like REXX, hand
> calculators, and paper-and-pencil math.  Much in common with #2, but under
> #2 0.1 is not exactly one tenth (you don't need testing to discover *that's*
> confusing -- I've been explaining that one to frustrated newbies and
> professionals(!) for 20-some years).
> 
> 5. 2/3 is 2/3, and sin(asin(2/3)) is 2/3 exactly, and exp(log(2/3)) is 2/3
> exactly, ... "the constructive reals".  I'm not aware of any general-purpose
> language that offers these (they're slow, and e.g. testing for equality is
> undecidable).
> 
> If anyone has another in mind, let me know!  I'll keep a list.

2/3 is 0 rest 1. That's what I learned when I was 7, 8 years old.
However, returning a tuple for 2/3 might break some existing code :)

regards,
Gerrit.

-- 
Homepage: http://www.nl.linux.org/~gerrit
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O
!M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth