Skip to content

when converting big floats to OpenMath, remove the + of the exponent #31

Description

@MarcoCostantini

the XML standard requires that the floats are without the + in the exponent, see https://docstore.mik.ua/orelly/xml/schema/ch04_04.htm
Hence 10.0**20 should be converted as <OMF dec="1e20"/>, not as <OMF dec="1e+20"/>

>>> encoder.encode_bytes(converter.to_openmath([10.0**20]))
b'<OMA xmlns="http://www.openmath.org/OpenMath"><OMS cdbase="http://www.openmath.org/cd" name="list" cd="list1"/><OMF dec="1e+20"/></OMA>'
>>> 

This output in fact doesn't validate, even if the OMOBJ tag is added, see
https://www.openmath.org/validation/omvalidate.html

To validate OpenMath, it can be used also the online validator
https://www.liquid-technologies.com/online-relaxng-validator
with the grammar copied from
https://www.openmath.org/standard/om20-2019-07-01/omstd20.html#app_openmath.rng

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions