-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Generate ufuncs for frexp and ldexp #4852
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -343,6 +343,7 @@ double npy_log2(double x) | |
* asinh, acosh, atanh | ||
* | ||
* hypot, atan2, pow, fmod, modf | ||
* ldexp, frexp | ||
* | ||
* We assume the above are always available in their double versions. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a good assumption for us? It didn't used to be, but admittedly, that was a long time ago. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I suppose I don't really know. I know linux and windows have them both and I'd assume apple does too. Anything beyond that I can't say. Both are part of C89 FWIW. I suppose if we'd like I could add a implementation to npymath. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to follow up here, python uses both of these unconditionally. We're fine. |
||
* | ||
|
@@ -405,6 +406,26 @@ double npy_log2(double x) | |
} | ||
#endif | ||
|
||
#ifdef ldexp@c@ | ||
#undef ldexp@c@ | ||
#endif | ||
#ifndef HAVE_LDEXP@C@ | ||
@type@ npy_ldexp@c@(@type@ x, int exp) | ||
{ | ||
return (@type@) npy_ldexp((double)x, exp); | ||
} | ||
#endif | ||
|
||
#ifdef frexp@c@ | ||
#undef frexp@c@ | ||
#endif | ||
#ifndef HAVE_FREXP@C@ | ||
@type@ npy_frexp@c@(@type@ x, int* exp) | ||
{ | ||
return (@type@) npy_frexp(x, exp); | ||
} | ||
#endif | ||
|
||
/**end repeat**/ | ||
|
||
|
||
|
@@ -451,6 +472,20 @@ double npy_log2(double x) | |
} | ||
#endif | ||
|
||
#ifdef HAVE_LDEXP@C@ | ||
@type@ npy_ldexp@c@(@type@ x, int exp) | ||
{ | ||
return ldexp@c@(x, exp); | ||
} | ||
#endif | ||
|
||
#ifdef HAVE_FREXP@C@ | ||
@type@ npy_frexp@c@(@type@ x, int* exp) | ||
{ | ||
return frexp@c@(x, exp); | ||
} | ||
#endif | ||
|
||
/**end repeat**/ | ||
|
||
|
||
|
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.
Would it not be better to put this if first? I think this if block can be cleaned up a bit.