Skip to content

Update Cython vs Numba.ipynb - #1

Open
robertwb wants to merge 1 commit into
elgehelge:masterfrom
robertwb:patch-1
Open

Update Cython vs Numba.ipynb#1
robertwb wants to merge 1 commit into
elgehelge:masterfrom
robertwb:patch-1

Conversation

@robertwb

Copy link
Copy Markdown

The primary difference in Numba vs. Cython here is that Cython refuses by default to infer fixed-size integer types for ints used in arithmetic (to avoid changing overflow behavior).

The primary difference in Numba vs. Cython here is that Cython refuses by default to infer fixed-size integer types for ints used in arithmetic (to avoid changing overflow behavior).
@elgehelge

Copy link
Copy Markdown
Owner

Wow. I did not know about that. This makes it much easier to use Cython. But can you tell me a little bit about the drawback of doing this. Why is it not the default?

@robertwb

Copy link
Copy Markdown
Author

The goal is to be able to take your Python code, compile it with Cython,
and have it behave exactly the same. If you have (for example)

def squares(a, b):
for k in range(a, b):
print k*k

this will overflow whenever b > sqrt(sys.maxint). Even k+1 could overflow.

Granted, our heuristics are probably a bit too conservative. For
floats/doubles it's easy--we always infer.

On Thu, Jan 14, 2016 at 9:35 AM, Helge Munk Jacobsen <
notifications@github.com> wrote:

Wow. I did not know about that. This makes it much easier to use Cython.
But can you tell me a little bit about the drawback of doing this. Why is
it not the default?


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

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.

2 participants