Skip to content

Numerical error on division (np vs jnp) #24937

Answered by pearu
JLjw8 asked this question in Q&A
Discussion options

You must be logged in to vote

First, the original example in the issue and the provided reproducer are not related with respect to the source of numerical errors. While JAX and numpy apparently use different algorithms for arcsin (or these use different FTZ modes), the differences between results are within acceptable limits (less than or equal to 1 ULP).

The example tries to evaluate cos_az close to (south?) pole where its expression is 0/0 indeterminate. It is not clear from the post which of the results is expected. So, when applying L’Hopital’s Rule for the limit process lat->-pi/2, I conclude that the expected result of cos_az approaches to 0. This matches with JAX results. On the other hand, I would not blame nu…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@JLjw8
Comment options

@jakevdp
Comment options

Comment options

You must be logged in to vote
1 reply
@JLjw8
Comment options

Answer selected by JLjw8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants