-
Notifications
You must be signed in to change notification settings - Fork 33
Add unsigned fixed-point numbers #2
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
Fixed the error on 0.2. I was forced to test with a less stringent iteration syntax, due to issues with 0.2's range iteration. |
uf16 | ||
# should asraw be exported? | ||
|
||
asraw(x::AbstractFixed) = x.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.
Seems like this should be a method of reinterpret
.
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.
Seems reasonable. This will introduce a one-argument variant of reinterpret
, but I agree that makes sense.
These data types are kind of cool! |
The introduction of bd, ad = scaledual(b, a)
b*a == bd*ad but the RHS might be faster (particularly for floating-point The idea would be the following: say you're writing function imfilter(img::AbstractArray, kern::AbstractArray)
scalefac, imgd = scaledual(eltype(kern), img)
if scalefac != 1
kern = scalefac*kern
end
# Implement the filtering operation on imgd and kern
end |
I added some documentation. If you like |
I assume this come from the thing I mentioned on the Color package about considering Uint8 as a way of representing floating-point values 0/255, 1/255, etc.? |
Yes indeed! JuliaAttic/Color.jl#42. |
Bump. Color is waiting on this, and Images is waiting on Color. (I probably won't merge the Images changes immediately, but I think the Color one is ready to go.) |
Add unsigned fixed-point numbers
Thanks! |
CC @StefanKarpinski, since this was your suggestion!