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

Adds iceil, ifloor and itrunc to BigFloat #3041

Merged
merged 3 commits into from
May 8, 2013

Conversation

andrioni
Copy link
Member

@andrioni andrioni commented May 7, 2013

They convert to a Clong if it fits, otherwise to BigInt. It is inspired by #3040, but doesn't solve it directly.

@andrioni
Copy link
Member Author

andrioni commented May 7, 2013

These random test errors are getting a bit annoying. Does anyone knows why do they happen? I sometimes get them on my machine too.

@Keno
Copy link
Member

Keno commented May 7, 2013

Yeah, caused by #3015

@JeffBezanson
Copy link
Sponsor Member

They should always return BigInt, until there is a type argument as for iround.

@andrioni
Copy link
Member Author

andrioni commented May 7, 2013

I improved the state of iround too, but now another issue arises: 'overflow' in conversions. int8(1355) returns 75, and not some kind of error, so the following happens:

julia> iround(Int8, 1355.12)
75

julia> iround(Int8, BigFloat(1355.12))
75

I'm throwing an error in conversions from BigInt/BigFloat to small fixed types that are bigger than typemax(Clong)/typemax(Culong), but right now it is the 'outlier' case.

@JeffBezanson
Copy link
Sponsor Member

Please rebase then I will merge it.

They convert to a Int64 if it fits, otherwise to BigInt.
It also includes extensive changes to the conversion of both BigInt
and BigFloat in order to make them more general and to start raising
errors when trying to convert values bigger than Clong/Culong.
@andrioni
Copy link
Member Author

andrioni commented May 8, 2013

Rebased.

StefanKarpinski added a commit that referenced this pull request May 8, 2013
Adds iceil, ifloor and itrunc to BigFloat
@StefanKarpinski StefanKarpinski merged commit 8464314 into JuliaLang:master May 8, 2013
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

Successfully merging this pull request may close these issues.

4 participants