Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Numeric types #9

@magik6k

Description

@magik6k

There seems to be a problem with handling of numeric types that I haven't seen mentioned yet:

JavaScript and JSON both default to float64 for number representation. This is a problem when handling CBOR or any other 'non-strict' format which can distinguish ints vs floats. Currently when int encoded within CBOR is encoded to JSON and back, it will get back as a cbor with float.

Possible solutions are:

  • Constrain canonical ipld-cbor to one numeric type
  • Add type metadata to json/js serializations
  • asm.js seems to be trying to do something about this, I haven't read much into it, but it may give some hints: http://asmjs.org/spec/latest/#value-types

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