Skip to content

Clarify number formats allowed #53

Description

@qligier

Hey,

I've read the spec but I'm still not sure what number formats are allowed in integer and floating point types. Based on the Ruby and JS implementations, I think that the only valid formats are:

  • (0|[1-9][0-9]*) for unsigned integers
  • -?(0|[1-9][0-9]*) for signed integers
  • -?(0|[1-9][0-9]*)(.[0-9]*)? for floating points

But the spec says:

Signed integer literals are identified by the "i" tag, with an associated JSON string literal value containing the string representation of a valid JSON integer literal

and

Floating points [...] should use the native JSON syntax

In RFC 7159, valid numbers are defined as number = [ minus ] int [ frac ] [ exp ], so -1e+1=-10 and 3E-2=0.03 are valid JSON numbers, whereas they are not valid in TJSON (?)

Can you please clarify this for me? Thanks!

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