File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,24 @@ The `float` type represents floating-point numbers with fixed precision (64-bit
4343| ` math.ceil(x) ` | O(1) | O(1) | Ceiling |
4444| ` math.trunc(x) ` | O(1) | O(1) | Truncate |
4545
46+ ## Instance Methods
47+
48+ | Method | Time | Space | Notes |
49+ | --------| ------| -------| -------|
50+ | ` is_integer() ` | O(1) | O(1) | Check if float is whole number |
51+ | ` as_integer_ratio() ` | O(1) | O(1) | Returns exact (numerator, denominator) tuple |
52+ | ` hex() ` | O(1) | O(1) | Convert to hexadecimal string |
53+ | ` fromhex(s) ` | O(n) | O(1) | Class method; create float from hex string |
54+ | ` conjugate() ` | O(1) | O(1) | Returns self; complex number compatibility |
55+ | ` from_number(x) ` | O(1) | O(1) | Class method; convert number to float (Python 3.14+) |
56+
57+ ## Numeric Attributes
58+
59+ | Attribute | Time | Notes |
60+ | -----------| ------| -------|
61+ | ` real ` | O(1) | Returns self; real part |
62+ | ` imag ` | O(1) | Always 0.0; imaginary part |
63+
4664## Common Operations
4765
4866### Basic Arithmetic
Original file line number Diff line number Diff line change @@ -54,6 +54,27 @@ The `int` type represents arbitrary precision integers. Python 3 has a single in
5454| ` repr(x) ` | O(n) | O(n) | String representation |
5555| ` int(x) ` | O(1) | O(1) | No-op if already int |
5656
57+ ## Instance Methods
58+
59+ | Method | Time | Space | Notes |
60+ | --------| ------| -------| -------|
61+ | ` bit_length() ` | O(1) | O(1) | Number of bits needed to represent value |
62+ | ` bit_count() ` | O(n) | O(1) | Count of 1 bits (popcount); Python 3.10+ |
63+ | ` to_bytes(length, byteorder) ` | O(n) | O(n) | Convert to bytes; n = length |
64+ | ` from_bytes(bytes, byteorder) ` | O(n) | O(n) | Class method; create int from bytes |
65+ | ` as_integer_ratio() ` | O(1) | O(1) | Returns (self, 1) tuple |
66+ | ` is_integer() ` | O(1) | O(1) | Always returns True for int |
67+ | ` conjugate() ` | O(1) | O(1) | Returns self; complex number compatibility |
68+
69+ ## Numeric Attributes
70+
71+ | Attribute | Time | Notes |
72+ | -----------| ------| -------|
73+ | ` real ` | O(1) | Returns self; real part |
74+ | ` imag ` | O(1) | Always 0; imaginary part |
75+ | ` numerator ` | O(1) | Returns self; for Rational interface |
76+ | ` denominator ` | O(1) | Always 1; for Rational interface |
77+
5778## Common Operations
5879
5980### Basic Arithmetic
You can’t perform that action at this time.
0 commit comments