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

Math.log10 #11

Closed
Yaffle opened this issue Apr 8, 2012 · 11 comments
Closed

Math.log10 #11

Yaffle opened this issue Apr 8, 2012 · 11 comments

Comments

@Yaffle
Copy link
Contributor

Yaffle commented Apr 8, 2012

Math.log10(1e15) is 14.999999999999996 in Chrome 19

@paulmillr
Copy link
Owner

Do you propose to round the result?

The function uses just built-in js math funcs: Math.log(1e15) * 1 / Math.LN10 gives the same result.

@Yaffle
Copy link
Contributor Author

Yaffle commented Apr 8, 2012

rounding will not help

users of this shim should be informed...

@paulmillr
Copy link
Owner

I've added accuracy is 1e-11 to the readme.

@Yaffle
Copy link
Contributor Author

Yaffle commented Apr 8, 2012

how did you calculate this accuracy?

@paulmillr
Copy link
Owner

It's simple, it's the smallest accuracy when all math tests are passing.

@Yaffle
Copy link
Contributor Author

Yaffle commented Apr 8, 2012

Math.hypot(10e200, 0) - 10e200

@paulmillr
Copy link
Owner

and this is a bug in hypot. it should be probably for large numbers

function(x, y) {
  return Math.sqrt(x) * Math.sqrt(x) + Math.sqrt(y) * Math.sqrt(y);
};

@paulmillr
Copy link
Owner

meh, it gives incorrect result too

@Yaffle
Copy link
Contributor Author

Yaffle commented Apr 20, 2012

@paulmillr see https://gist.github.com/2427837 for "hypot" - http://www.netlib.org/fdlibm/e_hypot.c translated to js

@paulmillr paulmillr reopened this Apr 20, 2012
@paulmillr
Copy link
Owner

great, thanks, i'll look at it & try to merge

@Yaffle
Copy link
Contributor Author

Yaffle commented Apr 20, 2012

nice

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

No branches or pull requests

3 participants