question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG 2.15] Number literals bigger than 9 digits break

See original GitHub issue

This is a good one.

If you pass a numeric reference to a helper/component, it works with numbers up to 9 digits. Number with 10 or 11 digits break glimmer with TypeError: reference.value is not a function If the number has 12 digits it doesn’t throw an exception, but the value received on the other side of the reference is undefined

I believe we have an access-out-of-bounds on the glimmer VM.

Quick repo to reproduce: https://github.com/cibernox/big-num-bug

Note that this only happens with number literals {{my-helper 123123123123}} not with bound values {{my-helper num}} no matter how big the value inside num is.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
tomdalecommented, Sep 5, 2017

I think this is related to how the Glimmer compiler encodes primitive literals. JavaScript coerces numbers into 32-bit integers when applying bitwise operations, which we use to store type information (boolean, string, object, etc.) about the literals in the lower 3 bits.

In practice, this means that even though JavaScript allows you to represent values up to 253, our combination of a) using bitwise operators and b) utilizing the lower 3 bits means that we can’t represent values greater than 229.

One way to deal with this would be to have a less-efficient primitive type (BigNum?) for >29-bit integers, although maybe it makes sense to have an external number pool just like we do with strings. Maybe @wycats or @chancancode can chime in since this is a system they came up with.

2reactions
cibernoxcommented, Sep 9, 2017

@roschaefer My temporary workaround is to put that number in the component/controller, and bind it. gets €{{number}} every year

Read more comments on GitHub >

github_iconTop Results From Across the Web

2. Values, expressions, and statements — Beginning Python ...
A sequence of characters starting with the escape character ( \ ) used to represent string literals such as linefeeds and tabs.
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
Bug :1523 - "[IDEA] Offload work by distributing trivial ebuild ... an input file size bigger than 2GB" status:RESOLVED resolution:OBSOLETE severity:normal ...
Read more >
Log4j – Changes - Apache Logging Services
Fix the number of {}-placeholders in the string literal argument does not match the number of other arguments to the logging call.
Read more >
Answers to Exercises - Springer Link
Over time the updates get bigger and, at a certain point, an update may not fit on a single floppy. This is why...
Read more >
Underscores in Numeric Literals
In Java SE 7 and later, any number of underscore characters ( _ ) can appear anywhere between digits in a numerical literal....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found