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

Critical comparing bug: Int(100) is sometimes bigger than BInt("11173433833219812840") #80

Open
raspisanie opened this issue Oct 5, 2023 · 2 comments

Comments

@raspisanie
Copy link

let hundred = 100
if let bint = BInt("11173433833219812840") {
    
    if hundred < bint {
        print("bint(\(bint)) is bigger than a hundred")
    } else {
        print("bint(\(bint)) is lower than a hundred or equals")
    }
    
    if 100 < bint {
        print("bint(\(bint)) is bigger than 100")
    } else {
        print("bint(\(bint)) is lower than 100 or equals")
    }
    
}

bint(11173433833219812840) is lower than a hundred or equals
bint(11173433833219812840) is bigger than 100

It is ok when a Bint is compared with a numeric constant directly, but comparing with a "let constant" is not correct.

@SunZhiC
Copy link
Contributor

SunZhiC commented Oct 7, 2023

image

Did not meet the same error.

@raspisanie
Copy link
Author

raspisanie commented Oct 10, 2023

Oh, I'll make a sample project on git and leave a message here, soon.

I think it can be caused on specific environment.

Thank you for replying.

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

2 participants