- Notifications
You must be signed in to change notification settings - Fork55
fix sign() to handle NaN#321
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This commit fixes the sign() function to properly handle NaN values. When NaN is given, it now correctly returns NaN instead of incorrectly returning zero. Related bug report:https://gitlab.com/conradsnicta/armadillo-code/-/issues/169
eddelbuettel commentedJan 6, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I am sorry but why do you suggest all of a sudden to patch your code in our package? I mean 🤷♂️ sure why not but why not rely on what we have for ten years and have your release signify your release? |
eddelbuettel commentedJan 6, 2021
And of course, don't get me wrong a bug is a bug and a bug needs fixing but ... around here people look first for the Rcpp (Sugar) vectorised functions, and that one works: > library(Rcpp)> cppFunction("arma::vec arma_sign(arma::vec d) { return arma::sign(d); }",depends="RcppArmadillo")> sapply(c(-1,0,1,NA,NaN),arma_sign)[1]-10100>> cppFunction("NumericVector rcpp_sign(NumericVector d) { NumericVector x(sign(d)); return x;}")> sapply(c(-1,0,1,NA,NaN),rcpp_sign)[1]-101NANA> So I think we can just wait this out to the next upgrade. |
conradsnicta commentedJan 6, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
|
eddelbuettel commentedJan 6, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Dear Conrad, please consider: Re 1: Yes, and R users almost always call Re 2: We have posted some markdown files in various places and stated our position repeatedly: astrong preference for issue tickets and discussion leading to some consensus before unsolicited PRs. Now, granted, this PR is fairly local and focussed but .... this is simply not the right way to go about things. Especially as every other library I cover as a port or integration to R via Rcpp works via their own well managed git repsository. Yours was always a little, ahem, "special" with your insistence on tarballs with overwritten file timestamps etc. Your code, your repo, your rules, so at some point years ago I gave up pointing this out. This here, however, is our repo so I would appreciate if you could play by its rules. And issue ticket pointed to a commit of yours (over at GitLab) may suffice and make life a lot easier for you too. |
eddelbuettel commentedJan 6, 2021
Also as discussed last time, it is preferred that PRs come with a corresponding ChangeLog entry in the standard format identifying the author, file, and purpose. |
codecov-io commentedJan 6, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## master #321 +/- ##======================================= Coverage 34.29% 34.29% ======================================= Files 65 65 Lines 2356 2356 ======================================= Hits 808 808 Misses 1548 1548 Continue to review full report at Codecov.
|
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
eddelbuettel commentedJan 9, 2021
Incorporporated this by hand indb84fc2 so PR no redundant --> closing |
This commit fixes the sign() function to properly handle NaN values.
When NaN is given, it now correctly returns NaN instead of incorrectly returning zero.
Related bug report:https://gitlab.com/conradsnicta/armadillo-code/-/issues/169