-
Notifications
You must be signed in to change notification settings - Fork 33
[RFC/WIP] unify the concepts of Fixed and UFixed #32
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
Conversation
|
||
# constructor for manipulating the representation; | ||
# selected by passing an extra dummy argument | ||
FixedPoint(y::T, _) = new(i) |
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.
y->i
? (typo)
I assume you're noting it's still failing, seemingly due to the "not quite 1" issue I raised above. We might need a different implementation of |
Need any help? I'd love to get this finished, tagged, and then be able to tag new versions for Colors/ColorTypes/ColorVectorSpace/Images etc. |
Any help is appreciated, grad school got a bit in the way :). I just pushed the last changes I have around, but I think I am still missing some cases. So one of the issues is that for signed types |
@@ -1,4 +1,4 @@ | |||
VERSION >= v"0.4.0-dev+6521" && __precompile__() | |||
# ERSION >= v"0.4.0-dev+6521" && __precompile__() |
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.
oops :)
I added some comments, where I still have open questions and not necessary good answers. Essentially every bit of functionality that has a commented out version I was a bit unsure about. |
A fundamental problem I am running into that using Using A similar problem arises with signed fixedpoint numbers, where we need one bit to signal sign and so the question is if Maybe my brain is just going off on a tangent and I don't see the forest because of all the trees... |
You know, this rings a bell and is probably why I didn't unify them when I first wrote Sound reasonable? |
I am going to think this over, getting rid of a lot of code duplication would be really nice, but I don't really want to break the one major use case of FixedPointNumbers. (Even though UFixed should probably be called normalized numbers ;) ) |
Sounds good. I'll be out of touch for a couple of days. When I get back, I'll soon go ahead and tag a new release of Images and all related packages, just because it's overdue. If it takes a little longer to figure this out, that's fine---no rush. |
I am still interested in renaming |
I could go with such a renaming. (I probably won't do it myself, but happy to see it arrive, and even happier if someone helps fix the deprecations it will cause elsewhere 😉---EDIT: but don't worry about Images, that's in too much flux right now for anyone but me to touch.) |
If we're thinking about names, some other possible changes to consider:
|
After #27 UFixed and Fixed shared a lot of concepts and they do effectively the same thing, but sometimes a function is only implemented one way.
This is the current status of having only one type of FixedPoint and the underlying Type T defines whether it is a Unsigned or Signed type.
I added in comments the second implementation if the implementation is ambiguous and I haven't looked at the tests yet.
Merging those two concepts simplifies the code immensely, but it also highlights the subtle differences that where between Fixed and UFixed.