On 28 Sep 2009, at 5:31 pm, John Cowan wrote:
> That strikes me as over-specification.  Most people in other languages
> don't worry much about the range of the largest kind of fixnums they
> have,
> and it should not be a requirement that Scheme implementations signal
> an error on fixnum overflow -- returning an inexact result should
> still
> be fine.
>
> But that does mean that it's acceptable to return either exact or
> inexact
> 2^24 when you add 2^23 to 2^23, which seems to count as meaning
> "dependent
> on an implementation-specified integer range".

Would it be acceptable to say:

1) R7RS compatible Schemes support exact integers up to some
implemendation-defined maximum, which may depend on runtime
environmental conditions (eg, limits of RAM) or some static limit (eg,
limit of fixed-sized integers), but the time complexity of numerical
operations may worsen as the numbers get bigger, and overflow results
in an error being throw.

2) (as an SRFI) implementations may provide special sets of numerical
operations with prefixes - fx+ fx- etc - that have special semantics:
fx+ might work only in some defined exact integer ring and wrap
around, f+ might return exact integers when the result is an exact
integer within a range but return inexact reals when presented with
rationals, inexact reals, or exact integers that are too large to fit
in some bound (so would be good for real-time systems that still want
as accurate maths as they can get), all with more tightly bound time
complexities, for the real-timers?

I agree with John's desire to provide specialised numerical semantics
for special uses (real time systems being dear to my heart, in
particular), but I worry vaguely about applications expecting
different semantics of basic operations like + based on some big nasty
global property of the implementation.

So a small realtime embedded Scheme might provide +-*/ that check for
overflow, and fx+ that work on simple integers, and f+ that does its
best to be as accurate as it can while still using well-bounded time
and space?

ABS

--
Alaric Snell-Pym
Work: http://www.snell-systems.co.uk/
Play: http://www.snell-pym.org.uk/alaric/
Blog: http://www.snell-pym.org.uk/archives/author/alaric/




_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to