Summarize integer type promotion rules with a lattice?
See original GitHub issue@jakevdp suggested that a nice way to summarize the signed/unsigned integer type promotion rules would be with a lattice, e.g.,
i*
denotes a Python int
(with unspecified precision).
This is a subset of the full type promotion lattice from the JAX docs: https://jax.readthedocs.io/en/latest/type_promotion.html
The lattice for floats would just be f* -> f4 -> f8
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:32 (23 by maintainers)
Top Results From Across the Web
Implicit type promotion rules - Stack Overflow
Whenever a small integer type is used in an expression, it is implicitly converted to int which is always signed. This is known...
Read more >INT02-C. Understand integer conversion rules
Integer promotions require the promotion of each variable ( c1 and c2 ) to int size. The two int values are added, and...
Read more >Type Promotion Rules — Python array API standard 2021.12 ...
Type promotion rules must apply when determining the common result type for two array operands during an arithmetic operation, regardless of array dimension....
Read more >NOTE 223 – Lattice Expression Language - Casacore
An expression can be seen as a lattice (or image) in itself. ... Mixed data type arithmetic and automatic data type promotion. Support...
Read more >Type promotion semantics - JAX documentation
This document describes JAX's type promotion rules–i.e., the result of ... type promotion behavior is determined via the following type promotion lattice:.
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 FreeTop 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
Top GitHub Comments
Fair enough.
My first time through the doc, it took me five minutes to peruse the several tables and get a big picture view of what they were saying, and even then I didn’t understand how Python scalars play into things until my next read-through when I noticed the “Notes” section below them. I would have grokked all of that in under 15 seconds had there been a lattice displaying the same information.
The styling looks really nice!