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

linspace construction failures #20520

Closed
StefanKarpinski opened this issue Feb 8, 2017 · 6 comments
Closed

linspace construction failures #20520

StefanKarpinski opened this issue Feb 8, 2017 · 6 comments
Assignees
Labels
domain:collections Data structures holding multiple items, e.g. sets

Comments

@StefanKarpinski
Copy link
Sponsor Member

Specifically this line fails on 32-bit systems. The failure is an InexactError and goes away when linspace construction in that loop is commented out, suggesting that there's some code somewhere that does a trunc, floor or ceil to Int with a value that is too large to represent as a 32-bit integer.

@timholy
Copy link
Sponsor Member

timholy commented Feb 8, 2017

Hmm, tricky. I just searched through twiceprecision, and all the Int conversions that look dangerous seem to be protected already via a maxintfloat. There are some unprotected computations on len, but I don't think that's relevant for any of your test cases and probably isn't a bug anyway.

@StefanKarpinski
Copy link
Sponsor Member Author

I think this will require a 32-bit VM to debug. Fortunately, it fails on both Win32 and Linux32.

@tkelman
Copy link
Contributor

tkelman commented Feb 8, 2017

you can use multilib compilers to build 32 bit julia on 64 bit linux. set ARCH = i686 in Make.user.

@ararslan ararslan added system:32-bit Affects only 32-bit systems domain:collections Data structures holding multiple items, e.g. sets labels Feb 8, 2017
@JeffBezanson
Copy link
Sponsor Member

I just saw what looks like a range length test failure on 64-bit, apparently due to unlucky random numbers:
https://travis-ci.org/JuliaLang/julia/jobs/199738457

@StefanKarpinski
Copy link
Sponsor Member Author

Hmm. Guess I didn't test thoroughly enough. Hi ho, hi ho, it's off to work we go...

hi ho hi ho

@StefanKarpinski
Copy link
Sponsor Member Author

I've actually managed to reproduce this on 64-bit with enough iterations. Some cases:

(start, step, stop, n) = (-1.7123204f0, 3.2072393f-8, -1.7123204f0, 2)
(start, step, stop, n) = (1.3173739f0, -2.3759904f-8, 1.3173739f0, 3)
(start, step, stop, n) = (1.2467973f0, 4.1729544f-9, 1.2467973f0, 2)

@StefanKarpinski StefanKarpinski changed the title linspace construction failures on 32-bit linspace construction failures Feb 9, 2017
@tkelman tkelman removed the system:32-bit Affects only 32-bit systems label Feb 9, 2017
timholy added a commit that referenced this issue Feb 9, 2017
The old code worked in the case where the inputs are expressible as rationals, but when that fails we were getting an InexactError.
@tkelman tkelman closed this as completed in 3bc9a16 Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:collections Data structures holding multiple items, e.g. sets
Projects
None yet
Development

No branches or pull requests

5 participants