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

Unexpected NaN from sqrt() #164

Open
hypcos opened this issue Mar 25, 2024 · 0 comments
Open

Unexpected NaN from sqrt() #164

hypcos opened this issue Mar 25, 2024 · 0 comments

Comments

@hypcos
Copy link

hypcos commented Mar 25, 2024

I expected that X.sqrt() should give similar result to X.pow(0.5), but it doesn't.
Especially when the layer is 1.
Example:

> new Decimal(1e-16).pow(0.5)+''
< '1.000000000000002e-8'
> new Decimal(1e-16).sqrt()+''
< 'NaN'
> new Decimal(1e16).neg().pow(0.5)+''
< 'NaN'
> new Decimal(1e16).neg().sqrt()+''
< '99999999.99999979'
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

1 participant