Commit Graph

47 Commits

Author SHA1 Message Date
Jeroen van Rijn
5c95a48bc7 Clean up core:math/big
- Deprecate the u64/u32 implementation so we can use fewer nails and have an easier time of maintaining and optimizing the package going forward. The remaining implementation still works on 32-bit targets, it's just a smidge less efficient.

- Use only 1 nail instead of 4. The tests now run 3.5% faster as a result.

Future optimizations may including using fully packed backing (no nails) using `intrinsics.overflow_*` to handle borrow and carry safely.
2026-02-15 17:00:53 +01:00
Jeroen van Rijn
1ea5990be2 Speed up big.itoa
Extract 18 (64-bit) or 8 (32-bit) digits per big division.
This gives a 2.5x speedup for a 1024-bit bigint.
2025-11-27 15:35:05 +01:00
gingerBill
0d16ab2783 Add alias Okay = None 2025-11-27 09:14:39 +00:00
gingerBill
53876907c6 Handle Allocator_Error correctly in core:math/big 2025-11-27 09:10:03 +00:00
gingerBill
842cfee0f3 Change Odin's LICENSE to zlib from BSD 3-clause
This change was made in order to allow things produced with Odin and using Odin's core library, to not require the LICENSE to also be distributed alongside the binary form.
2025-10-28 14:38:25 +00:00
Jeroen van Rijn
c4c2431997 Package lines for core:math and more. 2025-10-09 19:56:21 +02:00
Jeroen van Rijn
3c9538c708 Change the way math/big constants are initialized 2025-09-10 21:02:24 +02:00
gingerBill
eb799393d5 Fix -vet-tabs issues 2024-08-24 13:56:41 +01:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
gingerBill
b8c4bf2afb Add #partial [Enum]Type{...} support to check for missing enumerated array fields 2022-02-05 14:02:21 +00:00
gingerBill
6418ec3b21 Correct #sparse usage and error messages 2022-02-05 13:09:16 +00:00
gingerBill
c85ac955f7 Simplify docs to hide the copyright 2022-01-17 19:00:47 +00:00
gingerBill
94bad4d786 Merge branch 'master' of https://github.com/odin-lang/Odin 2021-12-09 15:36:12 +00:00
gingerBill
1e9b30666f Minor style change 2021-12-09 15:34:17 +00:00
Jeroen van Rijn
c94098c2ab [math/big] Fix int_set and int_get. 2021-12-09 16:14:04 +01:00
Jeroen van Rijn
5619b349be big: Remove core:fmt usage + Add a little demo to examples/demo. 2021-09-06 23:26:19 +02:00
gingerBill
2800d4b8d0 Merge branch 'master' into optional-semicolons 2021-09-06 16:46:57 +01:00
Jeroen van Rijn
de5d897b5c Add internal_int_(pack, unpack). 2021-09-06 12:57:48 +02:00
Jeroen van Rijn
3faac14d62 big: Add ASCII file import/export. 2021-09-05 15:50:23 +02:00
Jeroen van Rijn
1f5ce91ae2 big: Add internal_random_prime. 2021-09-05 10:40:35 +02:00
Jeroen van Rijn
52da5b8724 big: Default to Frobenius-Underwood. It's 10% faster than Lucas-Selfridge. 2021-09-03 23:54:54 +02:00
Jeroen van Rijn
31918d3b8f big: Add internal_int_is_prime. 2021-09-02 18:31:08 +02:00
Jeroen van Rijn
65a15e9c06 big: Add internal_int_exponent_mod. 2021-09-01 19:13:47 +02:00
gingerBill
720884e0f1 Strip even more semicolons if followed by a } or ) on the same line 2021-08-31 23:47:57 +01:00
gingerBill
f57201bbd1 Remove unneeded semicolons from the core library 2021-08-31 22:32:53 +01:00
gingerBill
251da264ed Remove unneeded semicolons from the core library 2021-08-31 22:21:13 +01:00
Jeroen van Rijn
23d29be4d8 big: Update license to BSD-3. 2021-08-19 12:12:59 +02:00
Jeroen van Rijn
0db86a0638 big: Add workaround for DLL globals bug. 2021-08-14 13:51:17 +02:00
Jeroen van Rijn
12f9b6db63 big: Add int_to_bytes_{big, little} + Python compatible variants. 2021-08-11 20:59:54 +02:00
Jeroen van Rijn
851780b8f4 big: Add arguments and usage to test.py. 2021-08-11 20:59:54 +02:00
Jeroen van Rijn
5f34ff9f9f big: Add _private_int_sqr_toom. 2021-08-11 20:59:54 +02:00
Jeroen van Rijn
d505a05d36 big: More refactoring. 2021-08-11 20:59:53 +02:00
Jeroen van Rijn
40b7b9ecdf big: Refactor exponents and such. 2021-08-11 20:59:53 +02:00
Jeroen van Rijn
777e17d80f big: Improve tunables. 2021-08-11 20:59:53 +02:00
Jeroen van Rijn
2323ca1622 big: Add MATH_BIG_FORCE_64/32_BIT flags. 2021-08-11 20:59:52 +02:00
Jeroen van Rijn
fc0a92f8ac big: Add constants. 2021-08-11 20:59:52 +02:00
Jeroen van Rijn
97d80d03f9 big: Error.None -> nil 2021-08-11 20:59:52 +02:00
Jeroen van Rijn
627872db97 big: Timed factorial. 2021-08-11 20:59:52 +02:00
Jeroen van Rijn
491e4ecc74 big: Add binary split factorial. 2021-08-11 20:59:52 +02:00
Jeroen van Rijn
e80ac18324 big: Add factorial, have tests use hex strings. 2021-08-11 20:59:52 +02:00
Jeroen van Rijn
db0196abc7 big: Test root_n. 2021-08-11 20:59:52 +02:00
Jeroen van Rijn
2179cc2bc7 big: Improved test driver. 2021-08-11 20:59:52 +02:00
Jeroen van Rijn
85aa4dd670 big: Start test suite. 2021-08-11 20:59:51 +02:00
Jeroen van Rijn
5f63e3952e big: Correct pow bugs from the original. 2021-08-11 20:59:51 +02:00
Jeroen van Rijn
f34ba44bf8 big: Add shl, shr and shrmod. 2021-08-11 20:59:51 +02:00
Jeroen van Rijn
78c0877994 big: Add get(a, type) and get_float. 2021-08-11 20:59:51 +02:00
Jeroen van Rijn
7648f2e655 big: Finish big ZII refactor. 2021-08-11 20:59:50 +02:00