Round-trip failure with certain unsigned int64 values

Open
#1,264 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
json
Domain
compilers

Research direction

Reproduce the behavior using the test.jsonnet example and inspect how numeric literals are represented and serialized. The issue names no implementation files or tests and does not define a target for changing Jsonnet's 64-bit-float number model, so the desired behavior would need clarification before work can be considered done.

Written by the indexing model from the issue text.

Description

Jsonnet produces surprising output for certain unsigned int64 values. For example, with this test.jsonnet:

{
    a_uint: 18446744073709551615,
    b_uint: 9223372036854775807
}

jsonnet test.jsonnet produces this output:

{
   "a_uint": 18446744073709551616,
   "b_uint": 9223372036854775808
}

Tagging Framework-R-D/phlex#243.

EDIT: Evidently this is because all numbers are 64-bit floats in Jsonnet.

Dominant language
Jsonnet
Stars
7.6k
Forks
475
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/jsonnet

All issues in google/jsonnet

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.