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

bigDecimalOf type cast error #293

Closed
Zhouenze opened this issue Sep 30, 2020 · 1 comment · Fixed by #294
Closed

bigDecimalOf type cast error #293

Zhouenze opened this issue Sep 30, 2020 · 1 comment · Fixed by #294
Assignees
Labels
bug Something isn't working

Comments

@Zhouenze
Copy link

Hi there,

I've found following issue with bigDecimalOf code:

    @Test
    fun typeCastIssue() {
        val zero = BigDecimal.ZERO
        println(zero == Decimal.NEGATIVE_ZERO) // true
        bigDecimalOf(zero) // throw exception
    }

Seems like the when condition here is an equivalence test, not asserting same object. So if num = BigDecimal.ZERO, then it enters this branch and fail type cast.

Could you take a look? Thanks!

@therapon
Copy link
Contributor

Thanks for the test to reproduce and the pointer to the code. There is a PR out to address the issue.

@therapon therapon self-assigned this Sep 30, 2020
@therapon therapon added the bug Something isn't working label Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants