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

equal func in vm/vm.go bug #192

Open
chyroc opened this issue Apr 3, 2018 · 3 comments
Open

equal func in vm/vm.go bug #192

chyroc opened this issue Apr 3, 2018 · 3 comments

Comments

@chyroc
Copy link
Contributor

chyroc commented Apr 3, 2018

this is ok in anko,but it should be not ok

{script: `1 == 1.1`, runOutput: true}, // convert 1.1 to 1 , so return true
{script: `1.1 == 1`, runOutput: false}, // convert 1 to 1.0 , so return false(1.1 != 1.0)
@MichaelS11
Copy link
Contributor

I like to look to Javascript to check on these kind of issues:

a = 1
b = 1.1
console.log(a == b) // false

a = "1"
b = "1.1"
console.log(a == b) // false

a = 1
b = 1.1
console.log(a == b) // false

a = 1
b = "1.1"
console.log(a == b) // false

a = "1"
b = 1.1
console.log(a == b) //false

The Javascript answers look correct to me.

@chyroc
Copy link
Contributor Author

chyroc commented Apr 4, 2018

maybe we can define equalStrict

@MichaelS11
Copy link
Contributor

MichaelS11 commented Apr 4, 2018

Thinking about this more, I think you are correct, we should add ===

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