Skip to content

Infinity and NaN #7

Description

@MarcoCostantini

The file openmath-spec.litcoffee says:

Floats can't have keys other than t and v, and their values must be numbers
passing `isFinite` and failing `isNaN`.
            expect( OMNode.checkJSON { t : 'f', v : -15.9, x : 'thing' } ) \
                .toMatch /Key x not valid in object of type f/
            expect( OMNode.checkJSON { t : 'f', v : '-15.9' } ) \
                .toMatch /Not a number: -15\.9 of type string/
            expect( OMNode.checkJSON { t : 'f', v : Infinity } ) \
                .toMatch /OpenMath floats must be finite/
            expect( OMNode.checkJSON { t : 'f', v : -Infinity } ) \
                .toMatch /OpenMath floats must be finite/
            expect( OMNode.checkJSON { t : 'f', v : NaN } ) \
                .toMatch /OpenMath floats cannot be NaN/

but infinity and NaN are supported both by Javascript and by OpenMath, hence also
openmath-js should support them.
See
https://www.openmath.org/standard/om20-2019-07-01/omstd20.html#sec_xml-desc
https://www.openmath.org/standard/om20-2019-07-01/omstd20.html#sec_compl_xml_encoding_val
https://www.openmath.org/standard/om20-2019-07-01/omstd20.html#chgenc

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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