Debian Codegraph @

mypyc/doc/float_operations.rst

raw
1 .. _float-ops:
2
3 Native float operations
4 ========================
5
6 These ``float`` operations have fast, optimized implementations. Other
7 floating point operations use generic implementations that are often
8 slower.
9
10 Construction
11 ------------
12
13 * Float literal
14 * ``float(x: int)``
15 * ``float(x: i64)``
16 * ``float(x: i32)``
17 * ``float(x: i16)``
18 * ``float(x: u8)``
19 * ``float(x: str)``
20 * ``float(x: float)`` (no-op)
21
22 Operators
23 ---------
24
25 * Arithmetic (``+``, ``-``, ``*``, ``/``, ``//``, ``%``)
26 * Comparisons (``==``, ``!=``, ``<``, etc.)
27 * Augmented assignment (``x += y``, etc.)
28
29 Functions
30 ---------
31
32 * ``int(f)``
33 * ``i64(f)`` (convert to 64-bit signed integer)
34 * ``i32(f)`` (convert to 32-bit signed integer)
35 * ``i16(f)`` (convert to 16-bit signed integer)
36 * ``u8(f)`` (convert to 8-bit unsigned integer)
37 * ``abs(f)``
38 * ``math.sin(f)``
39 * ``math.cos(f)``
40 * ``math.tan(f)``
41 * ``math.sqrt(f)``
42 * ``math.exp(f)``
43 * ``math.log(f)``
44 * ``math.floor(f)``
45 * ``math.ceil(f)``
46 * ``math.fabs(f)``
47 * ``math.pow(x, y)``
48 * ``math.copysign(x, y)``
49 * ``math.isinf(f)``
50 * ``math.isnan(f)``