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

a little more accurate Math.cbrt #335

Merged
merged 1 commit into from
Apr 14, 2015
Merged

a little more accurate Math.cbrt #335

merged 1 commit into from
Apr 14, 2015

Conversation

Yaffle
Copy link
Contributor

@Yaffle Yaffle commented Apr 14, 2015

fix for #330

@@ -1269,7 +1269,13 @@
if (value === 0) { return value; }
var negate = value < 0, result;
if (negate) { value = -value; }
result = Math.pow(value, 1 / 3);
if (value === Infinity) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like the code path could be hit with -Infinity too, is that one accurate for the exp + log path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

-Infinity is converted to Infinity 2 lines above, so the "true" branch will be involved, and the "sign" will be set before return

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah ha, so it will, thanks

@ljharb
Copy link
Collaborator

ljharb commented Apr 14, 2015

This looks awesome, and your new tests already pass in everything I briefly checked.

Can you rebase this on top of the latest master (rather than merge) with (it looks like from your merge commit) git rebase paulmillr/master, and I'll get this merged?

@Yaffle
Copy link
Contributor Author

Yaffle commented Apr 14, 2015

@ljharb , ok, thanks for the command

ljharb added a commit that referenced this pull request Apr 14, 2015
a little more accurate Math.cbrt
@ljharb ljharb merged commit 5a7f3d7 into paulmillr:master Apr 14, 2015
@ljharb ljharb mentioned this pull request Apr 14, 2015
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