[om] OM Floats (XML Representation)

David Carlisle davidc at nag.co.uk
Mon Dec 1 17:38:53 CET 2003


Bruce

  If Schema are just used to validate OM documents, how could their
  broken description of NaN's affect OM?  Could the schema ever come into
  play transforming an OM doc, using the broken arithmetic?

In schema itself it probably doesn't make any difference for the foat
and double themseleves, but it does affect validation against derived
types.  For example if you define a restricted type based on float using
maxExclusive then you will exclude NaN as (according to XSD) NaN is
larger than all other values including INF, conversely if you restrict
using a lower bound, then NaN will be allowed as a value of the
restricted type.

Also schema types get used in other places (specifically xquery/xpath/xslt 2)
and there of course operations such as equality testing and sorting are
defined. However I just checked and they don't follow schema there:

Despite Schema specifying NaN sorts high, XSL 2 draft says

  However, NaN values, for sorting purposes, are considered to be equal
  to each other, and less than any other numeric value. 


(note that this is for xsl:sort, the rules for < and =  operators are as
below)


similarly despite schema specifying that NaN values compare equal,
XPath/Xquery specifies

  Each comparison operator returns a boolean value. If either, or both,
  operands are NaN, false is returned. 

So there is precedent for using the schema type but explictly specifying
different comparison and sorting semantics than the schema rec.
This might possibly be more useful in tems of code generation than using
a regexp constrained string, however there might be some merit in (as
currently) avoiding these issues with xsd:double and sticking to
string. Comments welcome:-)

David






-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--
om at openmath.org  -  general discussion on OpenMath
Post public announcements to om-announce at openmath.org
Automatic list maintenance software at majordomo at openmath.org
Mail om-owner at openmath.org for assistance with any problems



More information about the Om mailing list