Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

comment-out R::pythag#826

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

Merged
eddelbuettel merged 2 commits intomasterfromfeature/Rmath_header_cleanup
Mar 2, 2018
Merged

Conversation

@eddelbuettel
Copy link
Member

Per email from BDR

@eddelbuettel
Copy link
MemberAuthor

No comments by anyone? Should be harmless -- may just merge in a few ...

@kevinushey
Copy link
Contributor

We might (?) need a few more changes on our side:

inst/include/Rcpp/sugar/functions/complex.h28:# define RCPP_HYPOT ::Rf_pythaginst/include/Rcpp/sugar/undoRmath.h110:#undef pythaginst/include/Rcpp/Rmath.h222:    inline double pythag(double a, double b)        { return ::Rf_pythag(a, b); }

I think the bit inundoRmath.h can stay, but we might want to tweak what we have incomplex.h:

kevin@cdrv:~/r/pkg/Rcpp [rng-state]$ ag -Q "RCPP_HYPOT"inst/include/Rcpp/sugar/functions/complex.h26:# define RCPP_HYPOT ::hypot28:# define RCPP_HYPOT ::Rf_pythag83:             y.r = ::log( RCPP_HYPOT( x.r, x.i ) );90:         if( (mag = RCPP_HYPOT(z.r, z.i)) == 0.0)144:    t1 = 0.5 * RCPP_HYPOT(x + 1, y);145:    t2 = 0.5 * RCPP_HYPOT(x - 1, y);

If I understand correctly, R removed that function because C99 now defines::hypot() and so R doesn't need to provide its own definition. (If I understand correctly,Rf_pythag() was R's own definition of::hypot(), for platforms that didn't provide it back in the day)

eddelbuettel reacted with thumbs up emoji

@kevinushey
Copy link
Contributor

That said, if everything compiles and checks okay we can probably leave it as is?

@eddelbuettel
Copy link
MemberAuthor

There is indeed a bit more. You first catch is good: RCPP_HYPOT is conditionally defined with a now-dead fallback. Theundef is harmless. Theinline we can just comment out as well.

The use ofRCPP_HYPOT may need a second look as RCPP_HYPOT now has no fallback. Question is then ... would#ifdef HAVE_HYPOT ever not be true? And if so, shall we just emit a warning there?

man 3 hypot points to C99, POSIX.1-2001, POSIX.1-2008. Good enough?

Also:

edd@rob:~$ grep HAVE_HYPOT~/svn/r-devel/config.status S["RMATH_HAVE_HYPOT"]="# define HAVE_HYPOT 1"D["HAVE_HYPOT"]=" 1"edd@rob:~$

@eddelbuettel
Copy link
MemberAuthor

The cleanest may just be to rewritecomplex.h and do away withRCPP_HYPOT in favour of::hypot. Let me pile that on later today.

@kevinushey
Copy link
Contributor

I thinkHAVE_HYPOT is effectively always true since (as you pointed out) it's defined by the C99 standard and I think R requires C99 or greater during compilation of R + extensions.

eddelbuettel reacted with thumbs up emoji

@eddelbuettel
Copy link
MemberAuthor

@kevinushey That was an excellent catch. I maded some changes, when you have moment, could you peruse?

@kevinushey
Copy link
Contributor

LGTM -- thanks for taking care of this!

@eddelbuetteleddelbuettel merged commit06b1f62 intomasterMar 2, 2018
@eddelbuetteleddelbuettel deleted the feature/Rmath_header_cleanup branchMarch 8, 2018 13:30
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@kevinusheykevinusheykevinushey approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@eddelbuettel@kevinushey

[8]ページ先頭

©2009-2025 Movatter.jp