Skip to content

Added Sqrt and SqrtRound functionality#130

Open
ldcicconi wants to merge 2 commits intoshopspring:masterfrom
ldcicconi:sqrt
Open

Added Sqrt and SqrtRound functionality#130
ldcicconi wants to merge 2 commits intoshopspring:masterfrom
ldcicconi:sqrt

Conversation

@ldcicconi
Copy link
Copy Markdown

Based this on #111 , but corrected an algorithmic bug.

Not sure why those other changes are showing up.

@huahuayu
Copy link
Copy Markdown

huahuayu commented Dec 1, 2020

I need decimal to be sqrt(), it's current missed, please merge the function

@mwoss mwoss mentioned this pull request Mar 25, 2021
@mwoss
Copy link
Copy Markdown
Member

mwoss commented Mar 26, 2021

The implementation overall looks good. If you can @ldcicconi, please rebase it so I can merge it to master and add unit tests for this implementation. If you don't have time I can do it and write unit tests for this implementation.

@ldcicconi
Copy link
Copy Markdown
Author

@mwoss on it.

@ldcicconi
Copy link
Copy Markdown
Author

@mwoss I added some unit tests and made a few other changes. Let me know what you think.

note: the second test case in the vals map currently fails. I must be missing something for numbers near 0.

@mwoss
Copy link
Copy Markdown
Member

mwoss commented Mar 30, 2021

Hmm, I'm not sure why this algorithm is failing on numbers in the range (0, 1). What method you have used for calculating sqrt? Can you point me to the paper or any article?

@qiquanlu
Copy link
Copy Markdown

Can we get this PR merged? The code looks good, only issue is a couple digit off, and it's way more than enough for most use cases. #222

decimal_test.go:2913: Square root of 0.002342 should be 0.0483942145302514, not 0.0483942145302509 (error: %!s())

thanks

@jaitaiwan
Copy link
Copy Markdown

Fair few years on, is there an intention to merge this?

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

Successfully merging this pull request may close these issues.

5 participants