Unitless values should not compare as equal to unitful values
See original GitHub issue(Edit after the fact by @nex3)
Tasks:
- Deprecate existing behavior in
stable
. - Remove behavior from
master
.
I know the existing behavior was intentional, but it breaks the basic rules of math: if 1px == 1
and 1 == 1em
, then 1px == 1em
. That sounds like a bug to me. In CSS the actual unit or lack of unit is very important. I can’t think of any real use-case where I would be equally happy with or without a unit.
Issue Analytics
- State:
- Created 9 years ago
- Comments:26 (15 by maintainers)
Top Results From Across the Web
Conversion/promotion · Unitful.jl
Convert a Unitful.Quantity to different units. The conversion will fail if the target units a have a different dimension than the dimension of...
Read more >Utility Functions and Classes
Parameters: value – A value that may or may not be unitful. units – Units to be assumed for value if it does...
Read more >Make Unitful simplify expressions like 1μm/1m to a unitless ...
I freguently perform computations like 1μm/1m and would like Unitful to return a unitless number by default rather than having to do NoUnits(1μm/1m)....
Read more >Unitless line-heights – Eric's Archived Thoughts
If I assign a relative value of 1em to the line-height I would expect it to pass on relative as 1em and not...
Read more >Does the term ##ln(k)## have units in reaction based ...
The more diluted solution the close the value of activity coefficient ... Not only are the outputs of logarithms and exponentials unitless, ...
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
That’s correct. There are no plans to change anything but boolean operators (and so far, only
==
).Thanks @nex3 ; so I can take it that unit/unitless operations remain a stable core behavior? i.e.
1px + 1
will always be2px
? It’s just a question related to the sass-calc PR reference above.