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

nthroot(1024000, 2) looping forever #83

Open
tekbob27 opened this issue Apr 29, 2024 · 0 comments
Open

nthroot(1024000, 2) looping forever #83

tekbob27 opened this issue Apr 29, 2024 · 0 comments

Comments

@tekbob27
Copy link

I have implemented a wrapper class for use in a set of mathemetical calculations I am experimenting with. I am trying to present an arbitrary math set of tools largely because IEEE standards introduce many approximations. So I have been unit testing the use of BDouble to support my needs, and i have found several use cases where BDouble loops infinitely. one such use case is the square root of 1024000.0. My unit test is very simple.
func testSqrt1MPure() {
BDouble.precision = 30

    let testcase = BDouble("1024000")!
    
    let testResult = testcase.nthroot(2)
    
    XCTAssert(testResult - BDouble("1011.92885125388138623964593421847026868")! < Double.ulpOfOne, "testcase5 =  testResult.decimalExpansion(precisionAfterDecimalPoint: 30))")
}
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