Commit graph

114 commits

Author SHA1 Message Date
Mike
8578fd477a
math.big: fix zero base in big_mod_pow(), add tests (#24940) 2025-07-21 17:07:38 +03:00
Mike
080b56f0a9
math.big: fix big_mod_pow() (#24939) 2025-07-21 08:46:00 +03:00
Mike
46d4a6f8af
math.big: add shrink zeros to karatsuba and toom-cook (#24937) 2025-07-20 20:47:17 +03:00
Mike
987c211517
math.big: fix the order of calculations in mod_pow() to improve performance (#24935) 2025-07-20 15:27:20 +03:00
Mike
f06def7d6d
math.big: fix toom-cook 3-way multiplication (#24888) 2025-07-13 18:36:46 +03:00
Mike
502f0e7e77
math.big: remove unnecessary code from / and % (the same is done in div_mod, which they call) (#24766) 2025-06-21 06:31:59 +03:00
Mike
25264e0fbe
math.big: remove minus from zero result in right_shift(), add tests (#24767) 2025-06-21 06:29:46 +03:00
Mike
5a81d8a509
math.big: add mod_euclid() and mod_euclid_checked, similar to libgmp's mpz_mod(), add tests (#24764) 2025-06-20 19:22:20 +03:00
Mike
6e271b2ae6
math.big: change the handling of negatives in div_mod() to match gmp and Julia, add tests (#24713) 2025-06-15 10:51:40 +03:00
Mike
e8fe334396
math.big: speed up ~10x integer_from_radix() (#24674) 2025-06-09 11:13:07 +03:00
Mike
cecbc7294a
math.big: improve the performance of radix_str() ~9 times (#24666) 2025-06-08 13:02:33 +03:00
Mike
366f3d6b98
math.big: add test for radix_str() and integer_from_radix() (#24644) 2025-06-02 22:20:57 +03:00
Mike
b19fa76c6e
math.big: make is_power_of_2() be false for negatives (it now matches Julia's ispow2/1) (#24619) 2025-05-31 08:11:16 +03:00
Mike
0d00eb712c
math.big: remove unnecessary casting from Integer.is_power_of_2/0 (#24614) 2025-05-30 14:15:39 +03:00
Delyan Angelov
3ecffe68ff
math.big, docs: document the behaviour of % for negative numbers; in V: -10 % 7 == -3 (#24604) 2025-05-30 05:49:19 +03:00
Mike
ca379439fb
math.big: rewrite subtract_in_place() to fix Karatsuba, add tests (#24563) 2025-05-25 13:14:08 +03:00
Mike
f19e8a7fa3
math.big: optimize divide_array_by_digit() (#24566) 2025-05-25 13:06:27 +03:00
Mike
c27bc602bd
math.big: fix Karatsuba's add_in_place() function, add carry handler on exit (#24541) 2025-05-21 13:54:21 +03:00
Mike
341008687d
math.big: add missing assert for test_multiply_karatsuba_02 (#24534) 2025-05-21 06:06:28 +03:00
Mike
029564bab1
math.big: respect the sign of the dividend in % operator, add test (#24489) 2025-05-15 13:17:36 +03:00
Mike
65767d23d8
math.big: fix the + operator for big.Integer for negative numbers, add test (#24487) 2025-05-14 20:13:02 +03:00
Mike
861adfcc65
math.big: add new .bitwise_com/0 method + tests (#24476) 2025-05-13 23:28:57 +03:00
Delyan Angelov
35b1cff2d3
tools: support // vtest build: !do_not_test ?, // vtest build: !windows && tinyc to skip files during testing on specific platforms, without having to keep centralised skip lists (#23900) 2025-03-11 21:57:47 +02:00
Delyan Angelov
4877417adf
math.big: make ./v -prod -cstrict -cc gcc-11 test vlib/math/ pass cleanly (workaround a problem in V's cgen, that -cstrict discovered) 2025-03-08 13:45:31 +02:00
Delyan Angelov
9b8a1607ed
math.big: add vlib/math/big/big_division_test.v (follow-up to 270941a) 2025-02-26 05:25:51 +02:00
Delyan Angelov
270941a6bd
math.big: bump newton_division_limit to 1_000_000 (workaround issue #23806) 2025-02-26 04:54:01 +02:00
Delyan Angelov
6d017f3a31
math.big: fix 1/115792089237316195423570985008687907853269984665640564039457584007908834671663 leading to panic (fix #23771) 2025-02-20 18:19:55 +02:00
Emma
6b92f8fada
all: remove ancient deprecations (#23479) 2025-01-16 16:36:12 +02:00
Delyan Angelov
ef7fdd0f84
math.big: fix assert big.integer_from_int(1) == big.integer_from_bytes([u8(0), 0, 0, 0, 1]) (fix #23115) (#23124) 2024-12-10 18:18:30 +02:00
Delyan Angelov
81129d197b
math.big: use @[manualfree] to workaround -autofree compilation issues with gitly, and other projects using crypto.rand and math.big 2024-11-21 22:06:49 +02:00
kbkpbot
0224581bc6
math.big: improve the performance of left_shift_digits_in_place and right_shift_digits_in_place (#22450) 2024-10-08 21:48:26 +03:00
Delyan Angelov
6ba87b948a
math.big: fix a + b and a - b, when the signs are different, add more test cases (#22330) 2024-09-27 17:13:39 +03:00
yuyi
008aaad999
fmt: remove the prefixed module name of const names, that are in the same module (related #22183) (#22185) 2024-09-10 11:25:56 +03:00
yuyi
c51d30bf53
fmt: fix alignment of struct init fields (#22025) 2024-08-11 09:11:24 +03:00
Ikko Eltociear Ashimine
328e53bff3
math.big: fix typo tranform -> transform in special_array_ops.v (#21475) 2024-05-08 18:10:21 +03:00
Turiiya
1a35a783f1
breaking,checker: disallow initializing private struct fields outside structs module (#21183) 2024-04-12 13:53:02 +03:00
Delyan Angelov
4dcc9265e1
examples: add pidigits.v; optimise math.big's Integer divide a bit (#21239) 2024-04-09 17:01:05 +03:00
Turiiya
9704a01406
parser: fix case of falsely registering imports as used, remove unused imports (#21156) 2024-04-01 19:46:50 +03:00
Pierre Curto
900ec70711
checker: add cast overflow checks (#20641) 2024-01-24 18:36:39 +02:00
Delyan Angelov
856984aa14
cleanup: turn .microseconds() ... us to .microseconds() ... µs (#20588) 2024-01-20 07:16:24 +02:00
Alexander Medvednikov
f09826e928 all: unwrap const() blocks 2023-11-25 10:02:51 +03:00
Joe C
757929392e
all: update attributes to use new syntax 2023-11-15 16:16:01 +11:00
Artem Yurchenko
97f7c3f609
builtin: move min/max integer values consts from math to builtin (#19809) 2023-11-08 20:43:48 +02:00
shove
69d62e458b
math.big: fix incorrect division with negative numbers (fix #19585) (#19587) 2023-10-18 00:37:37 +03:00
yuyi
55ca8d8d8e
fmt: align the custom values of the enum fields (#19331) 2023-09-12 14:44:38 +03:00
Delyan Angelov
c9e46d34aa
math.big: fix notice for compilation with latest v 2023-08-23 08:10:55 +03:00
Delyan Angelov
679cbf1490
math.big: restore gdc_euclid, use it for smaller numbers, fix bench_euclid.v . 2023-08-14 18:37:48 +03:00
phoebe
dcbc9e0b9b
math.big: add isqrt_checked and standardize error format (#18939) 2023-07-22 09:20:45 +03:00
phoebe
7b306e9b8f
math.big: add checked division methods (#18924) 2023-07-21 20:06:54 +03:00
phoebe
93b3f1ca55
math.big: make is_odd public and add test cases (#18916) 2023-07-20 13:52:50 +03:00