Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

false equivalence between counting units #67

hynkle opened this Issue Mar 21, 2013 · 1 comment


None yet
2 participants

hynkle commented Mar 21, 2013

At the moment, counting units appear to be treated as interchangeable.

Unit.new('3 dB')       == Unit.new('3 sr')         # => true
Unit.new('3 sr')       == Unit.new('3 nt')         # => true
Unit.new('3 nt')       == Unit.new('3 bp')         # => true
Unit.new('3 bp')       == Unit.new('3 molecule')   # => true
Unit.new('3 molecule') == Unit.new('3 each')       # => true
Unit.new('3 each')     == Unit.new('3')            # => true

olbrich commented Mar 23, 2013

This is an interesting one because under the covers each of these units is represented as the same 'kind'. Equivalence checks to see if the scalars and the kind match up so that different expressions for the same thing will be correctly identified as equal. It seems in the case of counting units it should also be checking for the equivalence of the unit name so that:

Unit.new('3 dB') == Unit.new('3 sr')  # => false

I'll have to think about the implications of that one...

@olbrich olbrich pushed a commit that referenced this issue Jan 1, 2014

Kevin Olbrich add 'counting?' check for units, related to issue #67 d101fe3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment