-
Notifications
You must be signed in to change notification settings - Fork 6
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
More comparisons #55
More comparisons #55
Conversation
This is roughly equivalent to the `is` operator in Python in that it checks normal objects for pointer equality, but numbers are checked for value equality. Note that SOM (or, at least, java-som) doesn't define/implement the latter cases properly yet (see SOM-st/SOM#23) so this commit makes us diverge slightly.
|
||
double10 = ( | ||
run = ( | ||
(1.0 = 0) println. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be ==
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SOM is a little unusual (to our eyes) in this regadr. =
means "check the values for equality". ==
means (roughly) "check the data pointer for equality" (though for integers this is overridden -- Python effectively does something similar).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thanks for the explanation.
(1.0 > 2) println. | ||
(2.0 > 0) println. | ||
|
||
(1.0 >= 1) println. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, so in SOM, 1.0 == 1
is false, 1.0 > 1
is false, but 1.0 >= 1
is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
==
is very different from the other two, and unrelated.
1.0 > 1
and 1 > 1
should yield both false
, no? (minus issues with number representations for floating points, which hopefully do not matter for 1-like values, but will crop up with int-like values > 53-or-something bits).
And 1.0 >= 1
and 1 >= 1
should both be true in an ideal world (minus floating point issues)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks! With this comment and @ltratt's comment above, this makes a lot more sense now.
@smarr Just to confirm, do all the checks make sense to you (at least in yksom)? |
@ltratt sorry, I didn't check in detail the true/false values. The test structure makes it hard for me to match up tested expression and expected value. |
I compare Java SOM and yksom's output if that's any help. There are differences in |
|
@smarr OK, thanks! yksom, of course, aims to be an ideal world, a veritable nirvana, a stronghold of God's will on Earth. Except bugs, of course ;) |
Okay, I guess this is ready to merge then and I can tell bors the good news? |
Yes please! |
bors r+ |
55: More comparisons r=ptersilie a=ltratt This PR adds more comparisons to yksom: reference equality (1dca2bc) and various comparisons for doubles (82d35c5). Notice that the former commit means that we diverge slightly from SOM's current semantics (see SOM-st/SOM#23) although I think it's fair to say that @smarr thinks the approach we're taking in this PR is the right one (and if I've got that wrong, hopefully he'll shout!). Co-authored-by: Laurence Tratt <[email protected]>
Timed out |
Sorry, my CI changes yesterday broke this. I've applied the fix, but I just need a: bors r+ |
55: More comparisons r=vext01 a=ltratt This PR adds more comparisons to yksom: reference equality (1dca2bc) and various comparisons for doubles (82d35c5). Notice that the former commit means that we diverge slightly from SOM's current semantics (see SOM-st/SOM#23) although I think it's fair to say that @smarr thinks the approach we're taking in this PR is the right one (and if I've got that wrong, hopefully he'll shout!). Co-authored-by: Laurence Tratt <[email protected]>
bors r+ |
Already running a review |
Build succeeded |
This PR adds more comparisons to yksom: reference equality (1dca2bc) and various comparisons for doubles (82d35c5). Notice that the former commit means that we diverge slightly from SOM's current semantics (see SOM-st/SOM#23) although I think it's fair to say that @smarr thinks the approach we're taking in this PR is the right one (and if I've got that wrong, hopefully he'll shout!).