[BUG 2.15] Number literals bigger than 9 digits break
See original GitHub issueThis 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:
- Created 6 years ago
- Reactions:9
- Comments:14 (12 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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.@roschaefer My temporary workaround is to put that number in the component/controller, and bind it.
gets €{{number}} every year