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.
An alternative approach (and maybe more general?) would be to define
but I don't know what is best.
I also wonder if the
ifelse
innumbers.jl
could simply be a ternary, i.e.since, as noted in this PR, not all numbers can be negated.
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.
When
T
is unsigned, it is true that the ratio cannot be negative, so I guess this is fine. It's a bit weird to be using unsigned integers for rationals in the first place though, isn't it? I do think that @fredrikekre's suggestion for a generic definition that works for all rationals by callingabs
on the numerator is better.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.
Indeed @fredrikekre's proposal appears to be more general. Should I add another commit to the same PR making the change or resubmit a cleaner one?
By the way, I was using unsigned rationals since it is a possible tag type for EXIF metadata. I agree that they are a strange choice in a general use case.
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.
Just add more commits here. Much easier that way. We can squash it when it’s ready.