Implement `Ord` and `Eq` for unit types
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start with the discussion quoted from issue #707, then inspect the unit-type definitions and existing tests in the repository. Clarify whether the scope is limited to implementing Ord and Eq or also includes NaN handling, Option-based values, and constructors. Done means an agreed scope and corresponding trait behavior, but no files or tests are named here.
Written by the indexing model from the issue text.
Description
Thanks for explaining. It's probably fine as it is then, but if
ordered_floatis easy to implement then it might be nice.
I'll take another look tomorrow to see how faffy it is. Maybe it should be a separate PR.
Worth thinking about nans though. I don't imagine we'll ever want unit types to be nan, but there are certainly times where these could crop up and we'll need to deal with them. I wonder if
NotNancould be something to consider. This will panic if nans are ever encountered, which will force us to explicitly deal with these scenarios (e.g. adding an epsilon to prevent a 0/0 division)
Yeah, I don't think so either. I think it would be a bit more Rusty to have an Option<Activity> rather than an Activity that might be NaN. I've grepped the code base and it looks like the only NaN unit types that exist are in tests, so it might be safe to swap over.
My only worry is that there could be performance implications to the extra checks that would be implicitly needed for all kinds of floating point operations, but maybe that's not worth worrying about.
The other thing is that we would need to create unit types with a constructor, because writing e.g. Activity(1.0) wouldn't work anymore.
Originally posted by @alexdewar in https://github.com/EnergySystemsModellingLab/MUSE_2.0/issues/707#issuecomment-3103737555
- Dominant language
- Rust
- Stars
- 8
- Forks
- 5
- Avg merge
- 11h 31m
- Merged PRs (30d)
- 33
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from EnergySystemsModellingLab/MUSE2
-
bug documentation
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
EnergySystemsModellingLab/MUSE2#1367 · 1 comment ·
-
Remove the `ironing out iteration 0` prefix from debug files when the ironing out loop is turned off Openmuse xiii question
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
EnergySystemsModellingLab/MUSE2#1221 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
EnergySystemsModellingLab/MUSE2#1554 ·
-
bug
EnergySystemsModellingLab/MUSE2#1541 · 2 comments · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
EnergySystemsModellingLab/MUSE2#1526 ·
All issues in EnergySystemsModellingLab/MUSE2
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yantrikos/yantrik-os#255 ·
-
bug CLI custom-model
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
raphamorim/rio#1956 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
rust-bitcoin/rust-bitcoin#6930 · 1 comment ·