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

setNumericRounding() returns old rounding value, instead of "NULL" #6112

Merged
merged 7 commits into from
May 1, 2024

Conversation

joshhwuu
Copy link
Member

Closes #6108

Changed setNumericRounding() to invisibly return the old value, allowing for this assignment:

old = setNumericRounding(2)     # store old value and initiate new value
setNumericRounding(old)         # restore old value

Should I include a change to test.data.table as outlined in the issue as well? Also, there are many instances where we use getNumericRounding() to set/restore numeric rounding and can be refactored following this change, are they worth changing?

Copy link

github-actions bot commented Apr 30, 2024

Comparison Plot

Generated via commit bb2f838

Download link for the artifact containing the test results: ↓ atime-results.zip

Time taken to finish the standard R installation steps: 11 minutes and 45 seconds

Time taken to run atime::atime_pkg on the tests: 3 minutes and 43 seconds

@MichaelChirico
Copy link
Member

there are many instances where we use getNumericRounding() to set/restore numeric rounding and can be refactored following this change, are they worth changing?

Sorry, I'm not seeing those, unless you're referring to usage outside data.table itself?

@MichaelChirico
Copy link
Member

Should I include a change to test.data.table as outlined in the issue as well?

Yes, the total change size is still pretty small --> safe to include here too. Thanks!

@joshhwuu
Copy link
Member Author

Sorry, I'm not seeing those, unless you're referring to usage outside data.table itself?

Yeah, I meant in tests.Rraw, a bunch of tests do this

@MichaelChirico
Copy link
Member

Yeah, I meant in tests.Rraw, a bunch of tests do this

Oh, I see it now. I guess tests.Rraw is not indexed for regex search by GitHub.

Let's mark it for follow-up since there are so many. Thanks!

@MichaelChirico
Copy link
Member

Implementation looks good, only nit-picky details left to fix, thanks!

@joshhwuu
Copy link
Member Author

Should we include a NEWS entry as well? Or is it minimal enough where it's not required?

@MichaelChirico
Copy link
Member

Should we include a NEWS entry as well? Or is it minimal enough where it's not required?

I think it warrants a NOTE

Copy link
Member

@MichaelChirico MichaelChirico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MichaelChirico MichaelChirico merged commit 65fbc2a into master May 1, 2024
3 of 5 checks passed
@MichaelChirico MichaelChirico deleted the setnumericreturn branch May 1, 2024 01:18
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

Successfully merging this pull request may close these issues.

setNumericRounding() should return the initial value
2 participants