flexfloat 0.1.5__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {flexfloat-0.1.5 → flexfloat-0.3.0}/.bumpversion.cfg +1 -1
  2. {flexfloat-0.1.5 → flexfloat-0.3.0}/PKG-INFO +48 -25
  3. {flexfloat-0.1.5 → flexfloat-0.3.0}/README.md +47 -24
  4. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat/__init__.py +1 -1
  5. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat.egg-info/PKG-INFO +48 -25
  6. {flexfloat-0.1.5 → flexfloat-0.3.0}/pyproject.toml +1 -1
  7. {flexfloat-0.1.5 → flexfloat-0.3.0}/.github/workflows/build-check.yml +0 -0
  8. {flexfloat-0.1.5 → flexfloat-0.3.0}/.github/workflows/manual-release.yml +0 -0
  9. {flexfloat-0.1.5 → flexfloat-0.3.0}/.github/workflows/pr-labeler.yml +0 -0
  10. {flexfloat-0.1.5 → flexfloat-0.3.0}/.github/workflows/release.yml +0 -0
  11. {flexfloat-0.1.5 → flexfloat-0.3.0}/.github/workflows/test.yml +0 -0
  12. {flexfloat-0.1.5 → flexfloat-0.3.0}/.github/workflows/version-bump.yml +0 -0
  13. {flexfloat-0.1.5 → flexfloat-0.3.0}/.github/workflows/version-check.yml +0 -0
  14. {flexfloat-0.1.5 → flexfloat-0.3.0}/.gitignore +0 -0
  15. {flexfloat-0.1.5 → flexfloat-0.3.0}/LICENSE +0 -0
  16. {flexfloat-0.1.5 → flexfloat-0.3.0}/MANIFEST.in +0 -0
  17. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat/bitarray/__init__.py +0 -0
  18. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat/bitarray/bitarray.py +0 -0
  19. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat/bitarray/bitarray_bigint.py +0 -0
  20. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat/bitarray/bitarray_bool.py +0 -0
  21. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat/bitarray/bitarray_int64.py +0 -0
  22. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat/bitarray/bitarray_mixins.py +0 -0
  23. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat/core.py +0 -0
  24. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat/py.typed +0 -0
  25. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat/types.py +0 -0
  26. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat.egg-info/SOURCES.txt +0 -0
  27. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat.egg-info/dependency_links.txt +0 -0
  28. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat.egg-info/requires.txt +0 -0
  29. {flexfloat-0.1.5 → flexfloat-0.3.0}/flexfloat.egg-info/top_level.txt +0 -0
  30. {flexfloat-0.1.5 → flexfloat-0.3.0}/scripts/validate_cicd.py +0 -0
  31. {flexfloat-0.1.5 → flexfloat-0.3.0}/scripts/version_manager.py +0 -0
  32. {flexfloat-0.1.5 → flexfloat-0.3.0}/setup.cfg +0 -0
  33. {flexfloat-0.1.5 → flexfloat-0.3.0}/setup.py +0 -0
  34. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/__init__.py +0 -0
  35. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/test_addition.py +0 -0
  36. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/test_bigint_bitarray.py +0 -0
  37. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/test_bitarray.py +0 -0
  38. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/test_bitarray_implementations.py +0 -0
  39. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/test_conversions.py +0 -0
  40. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/test_division.py +0 -0
  41. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/test_flexfloat.py +0 -0
  42. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/test_multiplication.py +0 -0
  43. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/test_power.py +0 -0
  44. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/test_str_representation.py +0 -0
  45. {flexfloat-0.1.5 → flexfloat-0.3.0}/tests/test_subtraction.py +0 -0
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.1.5
2
+ current_version = 0.3.0
3
3
  commit = False
4
4
  tag = False
5
5
  allow_dirty = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexfloat
3
- Version: 0.1.5
3
+ Version: 0.3.0
4
4
  Summary: A library for arbitrary precision floating point arithmetic
5
5
  Author: Ferran Sanchez Llado
6
6
  License: MIT
@@ -45,7 +45,7 @@ A high-precision Python library for arbitrary precision floating-point arithmeti
45
45
  - **🔢 Growable Exponents**: Dynamically expand exponent size to handle extremely large (>10^308) or small (<10^-308) numbers
46
46
  - **🎯 Fixed-Size Fractions**: Maintain IEEE 754-compatible 52-bit fraction precision for consistent accuracy
47
47
  - **⚡ Full Arithmetic Support**: Addition, subtraction, multiplication, division, and power operations
48
- - **🔧 Multiple BitArray Backends**: Choose between list-based and int64-based implementations for optimal performance
48
+ - **🔧 Multiple BitArray Backends**: Choose between bool-list, int64-list, and big-integer implementations for optimal performance
49
49
  - **🌟 Special Value Handling**: Complete support for NaN, ±infinity, and zero values
50
50
  - **🛡️ Overflow Protection**: Automatic exponent growth prevents overflow/underflow errors
51
51
  - **📊 IEEE 754 Baseline**: Fully compatible with standard double-precision format as the starting point
@@ -81,12 +81,15 @@ print(f"Exponent bits: {len(large_result.exponent)}") # > 11 (grown beyond IEEE
81
81
  print(f"Can represent: {large_result}") # No overflow!
82
82
  ```
83
83
 
84
- ### Advanced Examples
84
+ ### Advanced Features
85
85
 
86
86
  ```python
87
- from flexfloat import FlexFloat
87
+ from flexfloat import FlexFloat, BigIntBitArray
88
+
89
+ # Use different BitArray implementations for specific needs
90
+ FlexFloat.set_bitarray_implementation(BigIntBitArray)
88
91
 
89
- # Mathematical operations
92
+ # Mathematical operations with unlimited precision
90
93
  x = FlexFloat.from_float(2.0)
91
94
  y = FlexFloat.from_float(3.0)
92
95
 
@@ -98,10 +101,13 @@ print(power_result.to_float()) # 8.0
98
101
  e_result = FlexFloat.e ** x # e^2
99
102
  print(f"e^2 ≈ {e_result.to_float()}")
100
103
 
104
+ # Absolute value operations
105
+ abs_result = abs(FlexFloat.from_float(-42.0))
106
+ print(f"|-42| = {abs_result.to_float()}") # 42.0
107
+
101
108
  # Working with extreme values
102
- tiny = FlexFloat.from_float(1e-300)
103
109
  huge = FlexFloat.from_float(1e300)
104
- extreme_product = tiny * huge
110
+ extreme_product = huge * huge
105
111
  print(f"Product: {extreme_product.to_float()}") # Still computable!
106
112
 
107
113
  # Precision demonstration
@@ -111,35 +117,40 @@ print(f"1/3 with 52-bit precision: {precise_calc}")
111
117
 
112
118
  ## 🔧 BitArray Backends
113
119
 
114
- FlexFloat supports multiple BitArray implementations for different performance characteristics:
120
+ FlexFloat supports multiple BitArray implementations for different performance characteristics. You can use them directly or configure FlexFloat to use a specific implementation:
115
121
 
116
122
  ```python
117
123
  from flexfloat import (
118
124
  FlexFloat,
119
- set_default_implementation,
120
- get_available_implementations
125
+ ListBoolBitArray,
126
+ ListInt64BitArray,
127
+ BigIntBitArray
121
128
  )
122
129
 
123
- # View available implementations
124
- print(get_available_implementations()) # ['list', 'int64']
125
-
126
- # Use list-based implementation (default, more flexible)
127
- set_default_implementation('list')
128
- flex_list = FlexFloat.from_float(42.0)
130
+ # Configure FlexFloat to use a specific BitArray implementation
131
+ FlexFloat.set_bitarray_implementation(ListBoolBitArray) # Default
132
+ flex_bool = FlexFloat.from_float(42.0)
129
133
 
130
- # Use int64-based implementation (faster for small bit arrays)
131
- set_default_implementation('int64')
134
+ FlexFloat.set_bitarray_implementation(ListInt64BitArray) # For performance
132
135
  flex_int64 = FlexFloat.from_float(42.0)
133
136
 
134
- # Both produce the same results with different performance characteristics
137
+ FlexFloat.set_bitarray_implementation(BigIntBitArray) # For very large arrays
138
+ flex_bigint = FlexFloat.from_float(42.0)
139
+
140
+ # Use BitArray implementations directly
141
+ bits = [True, False, True, False]
142
+ bool_array = ListBoolBitArray.from_bits(bits)
143
+ int64_array = ListInt64BitArray.from_bits(bits)
144
+ bigint_array = BigIntBitArray.from_bits(bits)
135
145
  ```
136
146
 
137
147
  ### Implementation Comparison
138
148
 
139
149
  | Implementation | Best For | Pros | Cons |
140
150
  |---------------|----------|------|------|
141
- | `list[bool]` | Smaller exponents and testing | Flexible, easy to understand | Slower for large numbers |
142
- | `list[int64]` | Standard operations | Fast for bigger numbers, efficient memory | Overhead for small numbers |
151
+ | `ListBoolBitArray` | Testing and development | Simple, flexible, easy to debug | Slower for large operations |
152
+ | `ListInt64BitArray` | Standard operations | Fast for medium-sized arrays, memory efficient | Some overhead for very small arrays |
153
+ | `BigIntBitArray` | Any usescases | Python already optimizes it | Overhead for small arrays |
143
154
 
144
155
  ## 📚 API Reference
145
156
 
@@ -159,6 +170,11 @@ abs(a), -a
159
170
 
160
171
  # Mathematical functions
161
172
  FlexFloat.e ** x # Exponential function
173
+ flexfloat.exp() # Natural exponential
174
+ flexfloat.abs() # Absolute value
175
+
176
+ # BitArray configuration
177
+ FlexFloat.set_bitarray_implementation(implementation: Type[BitArray])
162
178
  ```
163
179
 
164
180
  ### Special Values
@@ -269,8 +285,9 @@ flexfloat/
269
285
  ├── types.py # Type definitions
270
286
  ├── bitarray/ # BitArray implementations
271
287
  │ ├── bitarray.py # Abstract base class
272
- │ ├── bitarray_list.py # List-based implementation
273
- │ ├── bitarray_int64.py # Int64-based implementation
288
+ │ ├── bitarray_bool.py # List[bool] implementation
289
+ │ ├── bitarray_int64.py # List[int64] implementation
290
+ │ ├── bitarray_bigint.py # Python int implementation
274
291
  │ └── bitarray_mixins.py # Common functionality
275
292
  └── __init__.py # Public API exports
276
293
  ```
@@ -301,8 +318,14 @@ flexfloat/
301
318
  ### Optimization Tips
302
319
 
303
320
  ```python
304
- # Prefer int64 implementation for standard operations
305
- set_default_implementation('int64')
321
+ from flexfloat import FlexFloat, ListInt64BitArray, BigIntBitArray
322
+
323
+ # Choose the right BitArray implementation for your use case
324
+ # For standard operations with moderate precision
325
+ FlexFloat.set_bitarray_implementation(ListInt64BitArray)
326
+
327
+ # For most use cases, Python's int is already optimized
328
+ FlexFloat.set_bitarray_implementation(BigIntBitArray)
306
329
 
307
330
  # Batch operations when possible
308
331
  values = [FlexFloat.from_float(x) for x in range(1000)]
@@ -11,7 +11,7 @@ A high-precision Python library for arbitrary precision floating-point arithmeti
11
11
  - **🔢 Growable Exponents**: Dynamically expand exponent size to handle extremely large (>10^308) or small (<10^-308) numbers
12
12
  - **🎯 Fixed-Size Fractions**: Maintain IEEE 754-compatible 52-bit fraction precision for consistent accuracy
13
13
  - **⚡ Full Arithmetic Support**: Addition, subtraction, multiplication, division, and power operations
14
- - **🔧 Multiple BitArray Backends**: Choose between list-based and int64-based implementations for optimal performance
14
+ - **🔧 Multiple BitArray Backends**: Choose between bool-list, int64-list, and big-integer implementations for optimal performance
15
15
  - **🌟 Special Value Handling**: Complete support for NaN, ±infinity, and zero values
16
16
  - **🛡️ Overflow Protection**: Automatic exponent growth prevents overflow/underflow errors
17
17
  - **📊 IEEE 754 Baseline**: Fully compatible with standard double-precision format as the starting point
@@ -47,12 +47,15 @@ print(f"Exponent bits: {len(large_result.exponent)}") # > 11 (grown beyond IEEE
47
47
  print(f"Can represent: {large_result}") # No overflow!
48
48
  ```
49
49
 
50
- ### Advanced Examples
50
+ ### Advanced Features
51
51
 
52
52
  ```python
53
- from flexfloat import FlexFloat
53
+ from flexfloat import FlexFloat, BigIntBitArray
54
+
55
+ # Use different BitArray implementations for specific needs
56
+ FlexFloat.set_bitarray_implementation(BigIntBitArray)
54
57
 
55
- # Mathematical operations
58
+ # Mathematical operations with unlimited precision
56
59
  x = FlexFloat.from_float(2.0)
57
60
  y = FlexFloat.from_float(3.0)
58
61
 
@@ -64,10 +67,13 @@ print(power_result.to_float()) # 8.0
64
67
  e_result = FlexFloat.e ** x # e^2
65
68
  print(f"e^2 ≈ {e_result.to_float()}")
66
69
 
70
+ # Absolute value operations
71
+ abs_result = abs(FlexFloat.from_float(-42.0))
72
+ print(f"|-42| = {abs_result.to_float()}") # 42.0
73
+
67
74
  # Working with extreme values
68
- tiny = FlexFloat.from_float(1e-300)
69
75
  huge = FlexFloat.from_float(1e300)
70
- extreme_product = tiny * huge
76
+ extreme_product = huge * huge
71
77
  print(f"Product: {extreme_product.to_float()}") # Still computable!
72
78
 
73
79
  # Precision demonstration
@@ -77,35 +83,40 @@ print(f"1/3 with 52-bit precision: {precise_calc}")
77
83
 
78
84
  ## 🔧 BitArray Backends
79
85
 
80
- FlexFloat supports multiple BitArray implementations for different performance characteristics:
86
+ FlexFloat supports multiple BitArray implementations for different performance characteristics. You can use them directly or configure FlexFloat to use a specific implementation:
81
87
 
82
88
  ```python
83
89
  from flexfloat import (
84
90
  FlexFloat,
85
- set_default_implementation,
86
- get_available_implementations
91
+ ListBoolBitArray,
92
+ ListInt64BitArray,
93
+ BigIntBitArray
87
94
  )
88
95
 
89
- # View available implementations
90
- print(get_available_implementations()) # ['list', 'int64']
91
-
92
- # Use list-based implementation (default, more flexible)
93
- set_default_implementation('list')
94
- flex_list = FlexFloat.from_float(42.0)
96
+ # Configure FlexFloat to use a specific BitArray implementation
97
+ FlexFloat.set_bitarray_implementation(ListBoolBitArray) # Default
98
+ flex_bool = FlexFloat.from_float(42.0)
95
99
 
96
- # Use int64-based implementation (faster for small bit arrays)
97
- set_default_implementation('int64')
100
+ FlexFloat.set_bitarray_implementation(ListInt64BitArray) # For performance
98
101
  flex_int64 = FlexFloat.from_float(42.0)
99
102
 
100
- # Both produce the same results with different performance characteristics
103
+ FlexFloat.set_bitarray_implementation(BigIntBitArray) # For very large arrays
104
+ flex_bigint = FlexFloat.from_float(42.0)
105
+
106
+ # Use BitArray implementations directly
107
+ bits = [True, False, True, False]
108
+ bool_array = ListBoolBitArray.from_bits(bits)
109
+ int64_array = ListInt64BitArray.from_bits(bits)
110
+ bigint_array = BigIntBitArray.from_bits(bits)
101
111
  ```
102
112
 
103
113
  ### Implementation Comparison
104
114
 
105
115
  | Implementation | Best For | Pros | Cons |
106
116
  |---------------|----------|------|------|
107
- | `list[bool]` | Smaller exponents and testing | Flexible, easy to understand | Slower for large numbers |
108
- | `list[int64]` | Standard operations | Fast for bigger numbers, efficient memory | Overhead for small numbers |
117
+ | `ListBoolBitArray` | Testing and development | Simple, flexible, easy to debug | Slower for large operations |
118
+ | `ListInt64BitArray` | Standard operations | Fast for medium-sized arrays, memory efficient | Some overhead for very small arrays |
119
+ | `BigIntBitArray` | Any usescases | Python already optimizes it | Overhead for small arrays |
109
120
 
110
121
  ## 📚 API Reference
111
122
 
@@ -125,6 +136,11 @@ abs(a), -a
125
136
 
126
137
  # Mathematical functions
127
138
  FlexFloat.e ** x # Exponential function
139
+ flexfloat.exp() # Natural exponential
140
+ flexfloat.abs() # Absolute value
141
+
142
+ # BitArray configuration
143
+ FlexFloat.set_bitarray_implementation(implementation: Type[BitArray])
128
144
  ```
129
145
 
130
146
  ### Special Values
@@ -235,8 +251,9 @@ flexfloat/
235
251
  ├── types.py # Type definitions
236
252
  ├── bitarray/ # BitArray implementations
237
253
  │ ├── bitarray.py # Abstract base class
238
- │ ├── bitarray_list.py # List-based implementation
239
- │ ├── bitarray_int64.py # Int64-based implementation
254
+ │ ├── bitarray_bool.py # List[bool] implementation
255
+ │ ├── bitarray_int64.py # List[int64] implementation
256
+ │ ├── bitarray_bigint.py # Python int implementation
240
257
  │ └── bitarray_mixins.py # Common functionality
241
258
  └── __init__.py # Public API exports
242
259
  ```
@@ -267,8 +284,14 @@ flexfloat/
267
284
  ### Optimization Tips
268
285
 
269
286
  ```python
270
- # Prefer int64 implementation for standard operations
271
- set_default_implementation('int64')
287
+ from flexfloat import FlexFloat, ListInt64BitArray, BigIntBitArray
288
+
289
+ # Choose the right BitArray implementation for your use case
290
+ # For standard operations with moderate precision
291
+ FlexFloat.set_bitarray_implementation(ListInt64BitArray)
292
+
293
+ # For most use cases, Python's int is already optimized
294
+ FlexFloat.set_bitarray_implementation(BigIntBitArray)
272
295
 
273
296
  # Batch operations when possible
274
297
  values = [FlexFloat.from_float(x) for x in range(1000)]
@@ -24,7 +24,7 @@ from .bitarray import (
24
24
  )
25
25
  from .core import FlexFloat
26
26
 
27
- __version__ = "0.1.5"
27
+ __version__ = "0.3.0"
28
28
  __author__ = "Ferran Sanchez Llado"
29
29
 
30
30
  __all__ = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexfloat
3
- Version: 0.1.5
3
+ Version: 0.3.0
4
4
  Summary: A library for arbitrary precision floating point arithmetic
5
5
  Author: Ferran Sanchez Llado
6
6
  License: MIT
@@ -45,7 +45,7 @@ A high-precision Python library for arbitrary precision floating-point arithmeti
45
45
  - **🔢 Growable Exponents**: Dynamically expand exponent size to handle extremely large (>10^308) or small (<10^-308) numbers
46
46
  - **🎯 Fixed-Size Fractions**: Maintain IEEE 754-compatible 52-bit fraction precision for consistent accuracy
47
47
  - **⚡ Full Arithmetic Support**: Addition, subtraction, multiplication, division, and power operations
48
- - **🔧 Multiple BitArray Backends**: Choose between list-based and int64-based implementations for optimal performance
48
+ - **🔧 Multiple BitArray Backends**: Choose between bool-list, int64-list, and big-integer implementations for optimal performance
49
49
  - **🌟 Special Value Handling**: Complete support for NaN, ±infinity, and zero values
50
50
  - **🛡️ Overflow Protection**: Automatic exponent growth prevents overflow/underflow errors
51
51
  - **📊 IEEE 754 Baseline**: Fully compatible with standard double-precision format as the starting point
@@ -81,12 +81,15 @@ print(f"Exponent bits: {len(large_result.exponent)}") # > 11 (grown beyond IEEE
81
81
  print(f"Can represent: {large_result}") # No overflow!
82
82
  ```
83
83
 
84
- ### Advanced Examples
84
+ ### Advanced Features
85
85
 
86
86
  ```python
87
- from flexfloat import FlexFloat
87
+ from flexfloat import FlexFloat, BigIntBitArray
88
+
89
+ # Use different BitArray implementations for specific needs
90
+ FlexFloat.set_bitarray_implementation(BigIntBitArray)
88
91
 
89
- # Mathematical operations
92
+ # Mathematical operations with unlimited precision
90
93
  x = FlexFloat.from_float(2.0)
91
94
  y = FlexFloat.from_float(3.0)
92
95
 
@@ -98,10 +101,13 @@ print(power_result.to_float()) # 8.0
98
101
  e_result = FlexFloat.e ** x # e^2
99
102
  print(f"e^2 ≈ {e_result.to_float()}")
100
103
 
104
+ # Absolute value operations
105
+ abs_result = abs(FlexFloat.from_float(-42.0))
106
+ print(f"|-42| = {abs_result.to_float()}") # 42.0
107
+
101
108
  # Working with extreme values
102
- tiny = FlexFloat.from_float(1e-300)
103
109
  huge = FlexFloat.from_float(1e300)
104
- extreme_product = tiny * huge
110
+ extreme_product = huge * huge
105
111
  print(f"Product: {extreme_product.to_float()}") # Still computable!
106
112
 
107
113
  # Precision demonstration
@@ -111,35 +117,40 @@ print(f"1/3 with 52-bit precision: {precise_calc}")
111
117
 
112
118
  ## 🔧 BitArray Backends
113
119
 
114
- FlexFloat supports multiple BitArray implementations for different performance characteristics:
120
+ FlexFloat supports multiple BitArray implementations for different performance characteristics. You can use them directly or configure FlexFloat to use a specific implementation:
115
121
 
116
122
  ```python
117
123
  from flexfloat import (
118
124
  FlexFloat,
119
- set_default_implementation,
120
- get_available_implementations
125
+ ListBoolBitArray,
126
+ ListInt64BitArray,
127
+ BigIntBitArray
121
128
  )
122
129
 
123
- # View available implementations
124
- print(get_available_implementations()) # ['list', 'int64']
125
-
126
- # Use list-based implementation (default, more flexible)
127
- set_default_implementation('list')
128
- flex_list = FlexFloat.from_float(42.0)
130
+ # Configure FlexFloat to use a specific BitArray implementation
131
+ FlexFloat.set_bitarray_implementation(ListBoolBitArray) # Default
132
+ flex_bool = FlexFloat.from_float(42.0)
129
133
 
130
- # Use int64-based implementation (faster for small bit arrays)
131
- set_default_implementation('int64')
134
+ FlexFloat.set_bitarray_implementation(ListInt64BitArray) # For performance
132
135
  flex_int64 = FlexFloat.from_float(42.0)
133
136
 
134
- # Both produce the same results with different performance characteristics
137
+ FlexFloat.set_bitarray_implementation(BigIntBitArray) # For very large arrays
138
+ flex_bigint = FlexFloat.from_float(42.0)
139
+
140
+ # Use BitArray implementations directly
141
+ bits = [True, False, True, False]
142
+ bool_array = ListBoolBitArray.from_bits(bits)
143
+ int64_array = ListInt64BitArray.from_bits(bits)
144
+ bigint_array = BigIntBitArray.from_bits(bits)
135
145
  ```
136
146
 
137
147
  ### Implementation Comparison
138
148
 
139
149
  | Implementation | Best For | Pros | Cons |
140
150
  |---------------|----------|------|------|
141
- | `list[bool]` | Smaller exponents and testing | Flexible, easy to understand | Slower for large numbers |
142
- | `list[int64]` | Standard operations | Fast for bigger numbers, efficient memory | Overhead for small numbers |
151
+ | `ListBoolBitArray` | Testing and development | Simple, flexible, easy to debug | Slower for large operations |
152
+ | `ListInt64BitArray` | Standard operations | Fast for medium-sized arrays, memory efficient | Some overhead for very small arrays |
153
+ | `BigIntBitArray` | Any usescases | Python already optimizes it | Overhead for small arrays |
143
154
 
144
155
  ## 📚 API Reference
145
156
 
@@ -159,6 +170,11 @@ abs(a), -a
159
170
 
160
171
  # Mathematical functions
161
172
  FlexFloat.e ** x # Exponential function
173
+ flexfloat.exp() # Natural exponential
174
+ flexfloat.abs() # Absolute value
175
+
176
+ # BitArray configuration
177
+ FlexFloat.set_bitarray_implementation(implementation: Type[BitArray])
162
178
  ```
163
179
 
164
180
  ### Special Values
@@ -269,8 +285,9 @@ flexfloat/
269
285
  ├── types.py # Type definitions
270
286
  ├── bitarray/ # BitArray implementations
271
287
  │ ├── bitarray.py # Abstract base class
272
- │ ├── bitarray_list.py # List-based implementation
273
- │ ├── bitarray_int64.py # Int64-based implementation
288
+ │ ├── bitarray_bool.py # List[bool] implementation
289
+ │ ├── bitarray_int64.py # List[int64] implementation
290
+ │ ├── bitarray_bigint.py # Python int implementation
274
291
  │ └── bitarray_mixins.py # Common functionality
275
292
  └── __init__.py # Public API exports
276
293
  ```
@@ -301,8 +318,14 @@ flexfloat/
301
318
  ### Optimization Tips
302
319
 
303
320
  ```python
304
- # Prefer int64 implementation for standard operations
305
- set_default_implementation('int64')
321
+ from flexfloat import FlexFloat, ListInt64BitArray, BigIntBitArray
322
+
323
+ # Choose the right BitArray implementation for your use case
324
+ # For standard operations with moderate precision
325
+ FlexFloat.set_bitarray_implementation(ListInt64BitArray)
326
+
327
+ # For most use cases, Python's int is already optimized
328
+ FlexFloat.set_bitarray_implementation(BigIntBitArray)
306
329
 
307
330
  # Batch operations when possible
308
331
  values = [FlexFloat.from_float(x) for x in range(1000)]
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "flexfloat"
7
- version = "0.1.5"
7
+ version = "0.3.0"
8
8
  description = "A library for arbitrary precision floating point arithmetic"
9
9
  readme = "README.md"
10
10
  authors = [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes