Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 2 commits into from
Jul 10, 2014
Merged

Generate ufuncs for frexp and ldexp #4852

merged 2 commits into from
Jul 10, 2014

Conversation

ewmoore
Copy link
Contributor

@ewmoore ewmoore commented Jul 8, 2014

No description provided.

@rgommers
Copy link
Member

rgommers commented Jul 9, 2014

The Python 3.x builds are failing.

@ewmoore
Copy link
Contributor Author

ewmoore commented Jul 9, 2014

Yes. That's what I get for rushing and then not testing python 3.

On Wednesday, July 9, 2014, Ralf Gommers [email protected] wrote:

The Python 3.x builds are failing.


Reply to this email directly or view it on GitHub
#4852 (comment).

@ewmoore
Copy link
Contributor Author

ewmoore commented Jul 9, 2014

Fixed.

@@ -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.
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

@charris
Copy link
Member

charris commented Jul 9, 2014

Looks generally good to me, but have some questions.

@charris
Copy link
Member

charris commented Jul 9, 2014

Oh, and if you want to add some documentation about the workings of the code generator, that would be welcome also.

@charris
Copy link
Member

charris commented Jul 10, 2014

Let's give it a shot, so merging, thanks.

Because you have been working on the code generator recently, it would be helpful if you could document it. I find that every time I deal with it I need to work through the code again to see just what is does.

charris added a commit that referenced this pull request Jul 10, 2014
Generate ufuncs for frexp and ldexp
@charris charris merged commit ea6f909 into numpy:master Jul 10, 2014
@ewmoore
Copy link
Contributor Author

ewmoore commented Jul 14, 2014

Thanks!

@juliantaylor
Copy link
Contributor

this PR seems to cause build failures with MSVC, unresolved external symbol _ldexp and _frexp

@charris
Copy link
Member

charris commented Jul 20, 2014

Not unexpected ;) They are in msvc 2008, I checked before merging, but we may need to do something more to use them, flags perhaps, or link some library. Are you using gcc or msvc?

@ewmoore
Copy link
Contributor Author

ewmoore commented Jul 21, 2014

Looking at this again, the only other changes I made regarding these functions in #3010 was to delete a few lines in numpy/core/src/private/npy_config.h (see be42cae) These changes did build with MSVC 2008 when I was working on #3010. Unfortunately I no longer have access to a windows machine to test things.

@juliantaylor
Copy link
Contributor

removing those lines seems to fix the build for me, but I'm don't know what now happens with frexpl/ldexpl but the testsuite succeeds

@charris
Copy link
Member

charris commented Jul 23, 2014

Hmm, it seems that those lines should be OK since on Windows long double is double. OTOH, I think mingw does implement true long doubles. There may be another problem with the long double configuration somewhere.

@robberphex
Copy link
Contributor

I meet build failure in VS2010+Win8.1.

Because in math.h, ldexpl is macro(math.h Line 282):

#define ldexpl(x,y)     ((long double)ldexp((double)(x), (y)))*

But the commit undef it!

juliantaylor added a commit to juliantaylor/numpy that referenced this pull request Oct 19, 2014
The functions are macros in msvc which we undefine and redeclare in
npy_math. Since we now generate the ldexpl and frexpl ufuncs in numpygh-4852
this was broken by the extra logic for them in npy_config.h
abrodkin added a commit to abrodkin/buildroot that referenced this pull request Sep 15, 2017
Note previously used location for releases on SourceForge is no longer
supported (latest tarball v1.11.2 available there is dated 2016-10-04)
so as other distros
(see, Fedora http://pkgs.fedoraproject.org/cgit/rpms/numpy.git/tree/numpy.spec?id=7013948f8ba073c69a91a545f0a0898cb62652fa#n22)
we get release tarball directly from GitHub.

Also note 0001-no-fenv-on-uclibc.patch was rebased on v1.13.1 and
0002-Don-t-blindly-enable-frexpl-and-ldexpl-for-uClibc.patch was
removed completely as corresponding code got nuked with
numpy/numpy#4852. I'm not really sure
if something similar to Arnout's patch is still required so it would be good
if somebody more knowledgeable checks that.

Signed-off-by: Alexey Brodkin <[email protected]>
Cc: Rahul Bedarkar <[email protected]>
Cc: Gwenhael Goavec-Merou <[email protected]>
Cc: Arnout Vandecappelle <[email protected]>
Cc: Peter Korsgaard <[email protected]>
buildroot-auto-update pushed a commit to buildroot/buildroot that referenced this pull request Sep 19, 2017
Note previously used location for releases on SourceForge is no longer
supported (latest tarball v1.11.2 available there is dated 2016-10-04)
so as other distros
(see, Fedora http://pkgs.fedoraproject.org/cgit/rpms/numpy.git/tree/numpy.spec?id=7013948f8ba073c69a91a545f0a0898cb62652fa#n22)
we get release tarball directly from GitHub.

Also note 0001-no-fenv-on-uclibc.patch was rebased on v1.13.1.

0002-Don-t-blindly-enable-frexpl-and-ldexpl-for-uClibc.patch is no
longer needed. Since numpy/numpy#4852, there
is a wrapper for frexpl and ldexpl like for the other math functions.

Signed-off-by: Alexey Brodkin <[email protected]>
Cc: Rahul Bedarkar <[email protected]>
Cc: Gwenhael Goavec-Merou <[email protected]>
Cc: Arnout Vandecappelle <[email protected]>
Cc: Peter Korsgaard <[email protected]>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
[Arnout: improve explanation of 0002-Don-t-blindly-enable-frexpl-and-ldexpl-for-uClibc.patch]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants