RE: Rationals

>-----Original Message-----
>From: public-owl-wg-request@w3.org [mailto:public-owl-wg-request@w3.org]
>On Behalf Of Alan Ruttenberg
>Sent: Monday, November 10, 2008 10:03 PM
>To: W3C OWL Working Group
>Subject: Rationals
>
>
>Following the discussion of rational numbers I haven't found any
>reason to support lexical rationals versus a datatype. However I have
>some questions about conformance and implementation burden.
>
>1) What is the proposed minimal conformance, i.e. what rational
>literals are core literals?
>2) What are the implementation requirements for core rational
>literals? One needs to be able to both compare rationals to other
>numeric datatypes as well as compare them to each other. Analogous to
>the issues we discussed with implementation of rational numbers, how
>does one implement a satisfiability test for  r1 < f < r2 where r1 and
>r2 are rationals and f is a floating point number?
>
>Note: Implementations of rational numbers I'm aware of use arbitrary
>precision arithmetic. As I recall, the reason we did not require
>arbitrary precision integer arithmetic for minimal conformance so as
>to avoid the necessity of all implementation using such.

What comes to mind: xsd:integer also needs to be represented internally by
an arbitrary length datatype ("BigInteger"). Rationals are just two such
BigIntegers. And at least decimals, having a representation

  0.d1...dn

can be transformed into

  d1...dn / 10^n

i.e. a rational again. So a comparison of rationals and decimals does not
seem hard to me. I don't know for xsd:double.

Note that rationals are generally supported by computer languages, at least
in the form of additional libraries. Haskell, for example, supports them out
of the box [1]. For C++, there is a library in the set of "Boost" libraries
[2]. And for Java, one easily finds implementations on the Web, such as [3].

So there is enough stuff around, if its efficient is a different story.

Michael

[1] <http://www.haskell.org/onlinereport/ratio.html>
[2] <http://www.boost.org/doc/libs/1_37_0/libs/rational/index.html>
[3] <http://www.cs.princeton.edu/introcs/92symbolic/BigRational.java.html>

Received on Monday, 10 November 2008 21:54:36 UTC