Brian Mastenbrook scripsit:
> Once again, I'm not understanding why bignums are so difficult that
> they can't be expected from an implementation.
It's not about difficulty, it's about expectations. R5RS says that a
procedure which is trying to report an exact integer too large for the
implementation may silently report an inexact result or throw an error, at
its option. Some people *want* Schemes in which all numerical operations
run in essentially constant time. That leads to either a fixnum/flonum
system (#2 below) or a fixnum/flonum/compnum system (#3 below).
Let's look at my four numeric feature groups, + for present and - for
absent, and see what kind of Schemes they provide:
1) -bignums -inexact: This is a toy Scheme with fixnums only.
Providing ratios without bignums makes little sense. Gaussian
integers only doesn't make much sense either.
2) -bignums +inexact -complex: This is a Scheme where all numbers
are real and all arithmetic happens in essentially constant time.
Most non-Lisp languages look like this. Again, ratios without
bignums make little sense.
3) -bignums +inexact +complex: The complex-number equivalent of the
preceding. All non-real numbers are probably inexact/inexact.
Most non-Lisp languages with complex support (Fortran, notably)
look like this.
4) +bignums -ratios -inexact: Unlimited-precision integers only.
Pretty much another toy, given that / doesn't work. Fortunately,
ratios are cheap given bignums. Complex makes no sense here.
5) +bignums +ratios -inexact -complex: Exact numbers only.
Reasonable for some purposes, but will often be slow without
inexact support, so unsuitable for numerical work.
6) +bignums +ratios -inexact +complex: Like the above, but with exact
general complex numbers. Even less suitable for numerical work,
given that complex numbers are usually inexact/inexact.
7) +bignums -ratios +inexact -complex: A good all-round compromise,
providing exact integers and inexact real numbers. ISLisp looks
like this. Many people like this design.
8) +bignums -ratios +inexact +complex. The same as above, but with
inexact/inexact complex numbers.
9) +bignums +ratios +inexact -complex: Full numeric tower except
for general complex numbers. R5RS specifies this as an option,
though not explicitly.
10) +bignums +ratios +inexact +complex. Full numeric tower.
> [N]ot providing bignums seems to be a relatively rare choice among
> implementations that purport to implement the R5RS without restriction
> or limitation.
Part of the reason for small Scheme is to allow such implementations to
come out into the light, to claim conformance even though they are lacking
quite a lot of IEEE/R4RS/R5RS.
--
John Cowan [email protected]
I amar prestar aen, han mathon ne nen, http://www.ccil.org/~cowan
han mathon ne chae, a han noston ne 'wilith. --Galadriel, LOTR:FOTR
_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss