コード例 #1
0
def main() -> None:
    """
    See README.md for exercises.
    :return: None
    """

    print(f"Subtracting 2 from 4")
    c = subtract(4, 2)
    print(f"Result: {c}")

    print(f"Subtracting 2 from 4.4")
    c = subtract(4.4, 2)
    print(f"Result: {c}")

    print(f"Subtracting 2 from 4.6")
    c = subtract(4.6, 2)
    print(f"Result: {c}")

    print(f"Subtracting 2.2 from 4")
    c = subtract(4, 2.2)
    print(f"Result: {c}")

    print(f"Subtracting 1.9 from 4")
    c = subtract(4, 1.9)
    print(f"Result: {c}")
コード例 #2
0
ファイル: main.py プロジェクト: emanuelegiona/hpc-python
def main(a, b) -> None:
    """
    See README.md for exercises.
    :return: None
    """

    print(f"Subtracting {b} from {a}")
    c = subtract(a, b)
    print(f"Result: {c}")
コード例 #3
0
from cyt_module import subtract
from add_module import add

sol = subtract(4.5, 2)
print(sol)

print(add(1000, 5000))
コード例 #4
0
ファイル: use_cyt.py プロジェクト: Iain-S/hpc-python
from cyt_module import subtract
print(subtract(1, 4))
print(subtract(1.1, 4))
コード例 #5
0
ファイル: subtract.py プロジェクト: jalopy41/hpc-python
from cyt_module import subtract

a = subtract(4.5, 2)
print(a)
コード例 #6
0
from cyt_module import subtract

print(subtract(4.5, 2))
コード例 #7
0
from cyt_module import subtract

subtract(4.5, 2)
コード例 #8
0
from cyt_module import subtract
"""
As the C-extension implements the fully dynamic Python code (just using the Python C-API), transforming the pure Python 
module into C-extension gives normally only very modest speed-ups. However, as we will discuss in the following steps, 
by adding Cython language extensions into the code (.pyx?, so it is no longer valid Python code) it is possible to achieve much 
more significant performance improvements.

Uses the cyt_module.cp37-win_amd64.pyd C-extension.
"""

z = subtract(5, 2)
print(z)
コード例 #9
0
ファイル: example.py プロジェクト: Fratorhe/hpc-python
from cyt_module import subtract

a = subtract(4.5, 1.5)
print(a)
コード例 #10
0
def main():

	print(subtract(4.5, 2))
	x = np.array((1,2,3,4,5,6,7,8,9,10))
	y = np.array((4.2, 5.2, 5.7, 4, 5.3, 5, 6.32, 5, 6.6, 10))
	print(subtract(x, y))
コード例 #11
0
from cyt_module import subtract
'''
1. internal var result declared as int: 
for float intputs, subtraction is computed and then rounded down to the nearest integer

2. func arguments declared as int
for float inputs, arguments are first rounded down to nearest integer and then subtraction is computed

3. error: cannot assign type 'float' to 'int'

 '''

print(subtract(4, 3))
print(subtract(5.0, 2.4))