Skip to content

Conversation

@phelgo
Copy link
Member

@phelgo phelgo commented Jan 25, 2016

No description provided.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice solution, I think you could simplify the collatzCycles function removing the else clausure because the if always results in a return.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also find more readable n/2 than n>>1 The compilers are clever enough these days to apply this type of optimisations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, looks easier on the eyes without that else

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just having fun here 😄 (But I'm not entirely sure if that division is optimized btw, I recall some time ago confirming that * 0.5 was faster than / 2.0 for Floats)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants