Commit graph

49 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
f06def7d6d
math.big: fix toom-cook 3-way multiplication (#24888) 2025-07-13 18:36:46 +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
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
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
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
6d017f3a31
math.big: fix 1/115792089237316195423570985008687907853269984665640564039457584007908834671663 leading to panic (fix #23771) 2025-02-20 18:19:55 +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
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
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
679cbf1490
math.big: restore gdc_euclid, use it for smaller numbers, fix bench_euclid.v . 2023-08-14 18:37:48 +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
phoebe
6fef2c2ae8
math.big: add test cases for is_power_of_2 (#18910) 2023-07-20 02:34:31 +03:00
phoebe
a49b8f28b1
math.big: rework function naming and documentation (#18890) 2023-07-20 02:33:07 +03:00
phoebe
735654296c
math.big: refactor big_test.v for scalability (#18696) 2023-06-28 13:35:13 +03:00
phoebe
a3f24caffc
math.big: add mod_inverse and improve big_mod_pow to allow for large exponents and moduli (#18461) 2023-06-19 17:59:49 +03:00
phoebe
37386697a3
math.big: fix internal subtract_align_last_byte_in_place overflow (#18413) 2023-06-12 13:33:53 +03:00
Subhomoy Haldar
8759409a69
math.big: fix min i32 value bug (#17775)
* attempt big int min value fix

* cast value for correct comparison

* update edge case

* add one more test
2023-03-26 08:45:42 +03:00
Felipe Pena
6a179a2926
checker: add int signedness mismatch checking for function call arguments (#16750) 2022-12-24 06:28:35 +02:00
Delyan Angelov
ed17779434
math.big: fix Integer.bit_len() when there are no digits in the number 2022-05-18 08:29:08 +03:00
Alexander Medvednikov
fb192d949b all: replace []byte with []u8 2022-04-15 15:35:35 +03:00
Alexander Medvednikov
d4a0d6f73c all: byte => u8 2022-04-15 14:58:56 +03:00
Subhomoy Haldar
7ef7188f4b
math.big: add bit_len, optimize gcd, add documentation (#13872) 2022-03-30 15:52:09 +03:00
Subhomoy Haldar
072480352c
math.big: add get_bit, set_bit, big_mod_pow (#13507) 2022-02-18 11:53:39 +03:00
Subhomoy Haldar
96d4a0777f
math.big: fix comparison and add tests (#11449) 2021-09-08 20:30:20 +03:00
Subhomoy Haldar
dadfda9400
math.big: implement big.integer in V (#11352) 2021-08-31 19:21:00 +03:00
Miccah
19abe8c750
math.big: add from_bytes function (#11213) 2021-08-17 09:12:39 +03:00
blackshirt
1eac351f25
math.big: change the return value of divmod to (quotient, remainder) (#10993) 2021-07-30 02:28:32 +03:00
Uwe Krüger
f457b94fe4
cgen: properly support reference args in receivers and arithmetic op methods (#10873) 2021-07-20 15:08:32 +03:00
Delyan Angelov
732d8101e0
math.big: add .bytes() and .bytes_trimmed() methods, big.from_int(1024).bytes_trimmed() == [byte(0x00), 0x04] 2021-07-19 17:17:08 +03:00
Delyan Angelov
3e297bced4
ci: remove some tests from skip_with_werror in v test-self 2021-04-14 12:47:24 +03:00
Lukas Neubert
8b61891348
fmt: smarter if condition wrapping (#8201) 2021-01-23 10:33:22 +02:00
Swastik Baranwal
0ca36aafe2
cgen: allow assignment operators for type aliases (#8086) 2021-01-15 02:27:19 +01:00
joe-conigliaro
5f90192970
math: use full import module name in tests 2020-12-23 01:38:17 +11:00
Delyan Angelov
93c0f503a2 math.big: make big.from_string take a decimal, add big.from_hex_string 2020-12-22 09:45:56 +02:00
Alexander Medvednikov
939e10cb28 math.big: minor clean up 2020-12-22 08:27:50 +01:00
Alexander Medvednikov
b3e0926601 json: decode/encode time.Time 2020-12-22 07:24:44 +01:00
LilEnvy
665e6cc957
math.big: fix big.from_string #7313 (#7351) 2020-12-16 02:23:02 +01:00
LilEnvy
069d77d1c5
math.big: implement decimal .str() for big numbers (#7314) 2020-12-14 11:53:18 +02:00
Alexander Medvednikov
568d859fc0 bignum: move to math.big 2020-03-10 19:31:01 +01:00