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
Gray arithmetic #38
Comments
For the record, here's the logic behind the current choices:
I don't even begin to pretend I know how to make the right call here. This is murky territory, so I invite debate. |
so long as there is a logic, i think i can live with it. thanks. |
I do wonder if we should change addition and subtraction, though. |
addition and subtraction treat
|
Base julia uses an interesting rule: when performing an operation on an array and a scalar, the type of the array wins. For example: julia> typeof(UInt8(5)+3)
Int64
julia> typeof([UInt8(5)]+3)
Array{UInt8,1} This was chosen to prevent promotion from blowing up the size required to store the result. |
from users' experience, what can we expect about the output type of some complicated function? "Colorants in, Colorants out" satisfies me most |
There's real merit in that. The current system may be too complicated to intuit. A defense of the current system, though, might be meanval = mean(img) # this would be Gray
ratio = img ./ meanval # this would be Float64 To me this makes a bit of sense, if I'm computing a ratio I expect a plain number. Anyway, I'm open to changing this. |
Fixed by #131 |
when mixing
Gray
withNumber
the type of the result depends on the order of the inputs:my feeling is that the results should always be
Gray
, but wanted to ask for opinions before submitting a PR to fix it, as a whole a lot has to be changed, for all of+
and-
always returnsNumber
when the inputs are of mixed types:The text was updated successfully, but these errors were encountered: