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

Implement cld #8111

Merged
merged 2 commits into from
Sep 7, 2014
Merged

Implement cld #8111

merged 2 commits into from
Sep 7, 2014

Conversation

eschnett
Copy link
Contributor

This implements the "cld" function as suggested in #7132.

@StefanKarpinski
Copy link
Member

This is a nice thorough pull request and the complexity of the implementation makes me inclined to think that maybe we should include this. In particular, the -fld(-x,y) version doesn't work for small unsigned types. I'm not entirely convinced that all of the bittwiddly complex versions are necessary.

@eschnett
Copy link
Contributor Author

The "bitwiddly" versions are presumably the optimized implementations for integers when some arguments are known to be unsigned. This mirrors the implementation of fld, which looks equally complex, and has equally many versions. Using -fld(-x,y) doesn't work for integers if x or y have extreme or near-extreme values.

(If we wanted to allow wrong results for extreme values, then there exist much simpler and more efficient implementations for both fld and cld, but that doesn't sound like a good idea.)

@JeffBezanson
Copy link
Member

Very nice.

JeffBezanson added a commit that referenced this pull request Sep 7, 2014
@JeffBezanson JeffBezanson merged commit f665dae into JuliaLang:master Sep 7, 2014
@eschnett eschnett deleted the cld branch September 8, 2014 12:24
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

Successfully merging this pull request may close these issues.

3 participants