-
Notifications
You must be signed in to change notification settings - Fork 17
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
Dynamic prefix selection #164
Open
dmcclean
wants to merge
14
commits into
bjornbm:master
Choose a base branch
from
dmcclean:dynamic-prefix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+160
−40
Open
Changes from 7 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
67e42f9
Added dynamic prefix selection. Fixes #163.
dmcclean 5542c68
Merge branch 'master' into dynamic-prefix
dmcclean 9799f38
Changelog.
dmcclean 3b919c8
Relaxed type of appropriatePrefix to allow its use in more complicate…
dmcclean b7bc2cc
Changed handling when value is smaller than the smallest unit to be c…
dmcclean 1736698
Added very important absolute value to unit selection.
dmcclean badc738
Removed redundant import.
dmcclean ea6d3fe
Changed Prefix so that emptyPrefix can be a Prefix.
dmcclean 23635e3
Implemented PrefixSets to allow more choice in dynamic prefix selection.
dmcclean 5a2f443
Added filtering of PrefixSets. Added explicit Typeable instance for o…
dmcclean 0d023b7
Merge branch 'master' into dynamic-prefix
dmcclean 8679099
Merge branch 'master' into dynamic-prefix
dmcclean 87ee280
Added equality for units.
dmcclean 925819d
Added tests for appropriate prefix selection.
dmcclean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change limiting? I'm thinking of, e.g., Kilo (=1024) as used in KB. Not saying that this example is particularly relevant to the intended use of dimensional, but do any relevant prefixes that are not powers of ten exist? Is there a reasonable workaround for defining such prefixes without
Prefix
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question.
Options: We could expose
Prefix
, we could exposePrefix
from an 'Internal' module (actually we may already?).We could add the IEC/ISO binary prefixes (
kibi
,mebi
, etc) (which are approved by NIST but not by BIPM). If we wanted to get carried away we could changeMetricality
to have three alternatives instead of two, introduce amount of data as a base dimension, and limit their use only to where ISO/NIST say they should be used.Outside of units for amount of data (which we currently don't recognize at all), I am not aware of any prefixes that are not powers of ten.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to redo this to work around the change to
scaleExponent
? Or leave it as is?Even in the case of moving to binary prefixes we could conceivably keep this API and add
scaleBase
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't thought of any other prefixes so you can leave as is. Regarding the binary prefixes I wouldn't want to pollute dimensional with them. I think they would be better handled by an ad hoc data type (outside of the scope of dimensional) rather than adding another dimension.