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

fix BDouble init?(_ nStr: String) when String has scientific notation #81

Merged
merged 3 commits into from
Jan 8, 2024

Conversation

piggyse
Copy link

@piggyse piggyse commented Jan 8, 2024

Hi!
I think there is bug when init BDouble when String has scientific notation
So i fixd some logic and added tests
My changes passed all the Unit tests

Bug Example

       // MARK: Fail
        let a = BDouble("+2.46e+3")
        let b = BDouble(2460)
        XCTAssertEqual(a, b)
        XCTAssertEqual(a?.decimalDescription, b.decimalDescription)

        let c = BDouble("-2.46e+1")
        let d = BDouble(-24.6)
        XCTAssertEqual(c, d)

        XCTAssertEqual(c?.decimalDescription, d.decimalDescription)

        // MARK: Success
        let e = BDouble("-2.46e-2")
        let f = BDouble(-0.0246)
        XCTAssertEqual(e, f)
        XCTAssertEqual(e?.decimalDescription, f.decimalDescription)

@mkrd mkrd merged commit 78dcdcb into mkrd:master Jan 8, 2024
2 checks passed
@mkrd
Copy link
Owner

mkrd commented Jan 8, 2024

@piggy-park Thanks for your contribution :)

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.

3 participants