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

round() with BigFloat argument #2190

Closed
mbaz opened this issue Feb 5, 2013 · 6 comments
Closed

round() with BigFloat argument #2190

mbaz opened this issue Feb 5, 2013 · 6 comments

Comments

@mbaz
Copy link
Contributor

mbaz commented Feb 5, 2013

julia> ceil(BigFloat(2.1))
error: stack overflow
in ceil at math.jl:119

(The last line is repeated many times)

round() also fails in a similar manner; I haven't tested other similar functions.

@JeffBezanson
Copy link
Member

We have all these fallbacks of the form f(x::Real) = f(float(x)), which basically converts a no method error to a stack overflow in cases like BigFloat that don't yet implement ceil. I wonder if these should use ::Integer instead to help avoid this trap.

@nolta
Copy link
Member

nolta commented Feb 5, 2013

Partially fixed by 0c1a073, but round still has the same problem.

@andreasnoack
Copy link
Member

@JeffBezanson I think Integer is better. A no method error makes more sense here.

@nolta Maybe round should return an error.

Regarding 0c1a073, the new functions use the symbols in gmp whereas the old use gmp_wrapper. The latter is just renaming of functions in gmp and some memory allocation. Wouldn't it be more clean to remove all the renaming from gmp_wrapper.c and just have the memory allocation there? The rest can gmp directly, I think.

@ViralBShah
Copy link
Member

I wonder if we can get rid of gmp_wrapper.c completely. One can always allocate the memory as an array of Uint8s and pass it in. I do that in the wrappers for DSFMT.

@aviks
Copy link
Member

aviks commented Feb 6, 2013

#1887 : previous discussion around removing gmp_wrapper.c

@JeffBezanson
Copy link
Member

Fixed by f34c812.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants