Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add math.copySign #16406
Add math.copySign #16406
Changes from all commits
b77da8b
44a3295
62a250f
cfbddfe
7891b6c
cd1c38c
ac90382
7b4994e
2cafbc2
e1b4468
cfbe626
344a3e8
0e6ac7d
0b845d8
a3beedf
7280070
f8d5208
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
it won't fail in VM for a nim binary compiled after your PR
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.
The same story as #16406 (comment)
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.
better code for js via Object.is, see #16505 (comment)
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.
until timotheecour#499 is fixed, this test is meaningless:
both pass currently, which is not correct behavior IMO
IMO
doAssert copySign(-1.0, NaN) == 1.0
is probably correct (we can check with signbit once we have it), butdoAssert copySign(-1.0, -NaN) == 1.0
is probably not correct, and should be:likewise with
doAssert copySign(10.0, -NaN) == 10.0
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.
this test actually works in VM so long nim is compiled after this PR.
Simplest is to defined
nimHasCopySign
in condsyms.nim and then:(refs timotheecour#498)
note, the same
nimHasCopySign
could be re-used in your other math PR's that need vmops to avoid creating too many condsyms symbols (until we finally reconsider the much betternimVersionCT
approach, refs #14648)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 would rather make a follow-up PR to enable this test.
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.
And
tmath.nim
should support JS, I could try to enable JS tests(at least for copySign) in the next PR.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.
ya we definitely need this (in another PR as you say); refs timotheecour#494 (comment) ; it just requires a few disabling's for js to work (and vm already works)