Skip to content
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

Promotion behavior of scalar-array operators with integer types #5806

Closed
simonster opened this issue Feb 13, 2014 · 2 comments
Closed

Promotion behavior of scalar-array operators with integer types #5806

simonster opened this issue Feb 13, 2014 · 2 comments
Milestone

Comments

@simonster
Copy link
Member

I was bit yesterday by ([uint8(1)]+1000)[1] != uint8(1)+1000. It looks like this change was made as a result of #1641. Is this documented? I don't know the rationale behind that change, but this seems more dangerous for integers than for floats, since for floats there is usually only loss of precision and if the new float is too large to fit you'll get Inf, whereas for integers there is silent truncation. Depending on our strategy here, this might be a dup of #5413.

@JeffBezanson
Copy link
Sponsor Member

I'd say #5413 is the best approach, but it would be nice to have an easy way to ask for array+n with overflow or saturation. Hard to think of a good notation for that.

@JeffBezanson
Copy link
Sponsor Member

Closed along with #5413.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants