A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cython/cython/issues/2133 below:

Exponentiation of integer constants interpreted as integer · Issue #2133 · cython/cython · GitHub

Problem

When specifying numeric constants with the unusual syntax:
10 ** -1
cython most probably inteprets the result as integer, while the python interpreter interprets it as float.
This only affects constants and does not affect variables.

Minimal Example Code

test.pyx / test.py

print (10 ** -1)
print (1E-1)
a = 10
print (a ** -1)

setup.py

from distutils.core import setup
from Cython.Build import cythonize

setup(
    ext_modules = cythonize("test.pyx")
)

Compilation

python ./setup.py build_ext --inplace
Results

python -c "import test" # with uncompiled test.py

python -c "import test" # with compiled test.pyx


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4