RE: precision on op:numeric-divide

From: Damien Fisher <damien@sodatech.com>
Date: Wed, 10 Dec 2003 14:31:46 +1100
To: "'Per Bothner'" <per@bothner.com>
Cc: <www-ql@w3.org>
Message-Id: <03Dec9.223203-0500_est.234403-21460+7109@ams.ftl.affinity.com>
```
But shouldn't the specification make it clear what the intended semantics
are?

How are people supposed to write implementation-independent queries if the
minimum level of precision isn't guaranteed?  xs:double follows the IEEE
standard, and hence, if someone needs to, they can make sure their code
works on many different platforms easily.  I don't  see how this is possible
with the xs:decimal functions (as they are currently defined).

Finally, exact rationals, while perhaps desirable in some cases, can lead to
an explosion in memory usage if not controlled carefully, since there is no
upper bound on the precision used in the calculations.  A simple example:
compute (1/2)^n, for some very large n.

-----Original Message-----
From: Per Bothner [mailto:per@bothner.com]
Sent: Wednesday, 10 December 2003 2:21 PM
To: Damien Fisher
Cc: www-ql@w3.org
Subject: Re: precision on op:numeric-divide

Damien Fisher wrote:
> And should rational answers always be returned exactly, even
> if that requires an enormous amount of precision?

Many language implementations (including any for full Common Lisp)
do support exact rationals, and people seem to like that.  (They also
support floating-point.)

In the Lisp family, exact rationals are usually implemented and
printed as simplified fractions; but using repeating decimals might
be more useful.  E.g. op:numeric-divide(5, 3) could return a
decimal whose literal form might be "1._6_" where digits between
_ and _ are infinitely repeating.
--
--Per Bothner
per@bothner.com   http://per.bothner.com/
```
Received on Tuesday, 9 December 2003 22:35:33 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:43:43 UTC