Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

false equivalence between counting units #67

Open
hynkle opened this issue Mar 21, 2013 · 1 comment
Open

false equivalence between counting units #67

hynkle opened this issue Mar 21, 2013 · 1 comment

Comments

@hynkle
Copy link

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
Copy link
Owner

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants