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

can the sum overflow? #2

Open
dilbert-ro opened this issue Aug 19, 2017 · 2 comments
Open

can the sum overflow? #2

dilbert-ro opened this issue Aug 19, 2017 · 2 comments

Comments

@dilbert-ro
Copy link

const mid = Math.floor((end + start) / 2);

@jiayihu
Copy link
Owner

jiayihu commented Aug 19, 2017

It's very unlikely that you have numbers so huge to overflow , especially on the client

@utkarshbhatt12
Copy link

You can use (start + ((end - start) / 2) to avoid the overflow, in case that happens.

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

3 participants