Describe the bug
When use big number div, it will hang when the number beyond some value.
Reproduction Steps
big.v
module main
import math.big
import strconv
import os
const d_2 = big.integer_from_int (2 )
const d_4 = big.integer_from_int (4 )
const d_10 = big.integer_from_int (10 )
fn main () {
mut n := 96320
if os.args.len > 1 {
n = strconv.atoi (os.args[1 ]) or { n }
}
dump (n)
base := d_10 .pow (u32 (n - 1 ))
a := d_4 * base // 40000000....00
b := d_2 * base // 20000000....00
dump (a.bit_len ())
dump (b.bit_len ())
c := a / b // c should be 2
dump (c.bit_len ())
dump (c)
}
v big.v -prod
./big 96320
./big 96321
Expected Behavior
mars@mars-QiTianM428-A688:~ /v/bug$ ./big
[big.v:17] n: 96320
[big.v:21] a.bit_len (): 319967
[big.v:22] b.bit_len (): 319966
[big.v:24] c.bit_len (): 2
[big.v:25] c: 2
mars@mars-QiTianM428-A688:~ /v/bug$ ./big 96321
[big.v:17] n: 96321
[big.v:21] a.bit_len (): 319971
[big.v:22] b.bit_len (): 319970
[big.v:24] c.bit_len (): 2
[big.v:25] c: 2
Current Behavior
mars@mars-QiTianM428-A688:~ /v/bug$ ./big
[big.v:17] n: 96320
[big.v:21] a.bit_len (): 319967
[big.v:22] b.bit_len (): 319966
[big.v:24] c.bit_len (): 2
[big.v:25] c: 2
mars@mars-QiTianM428-A688:~ /v/bug$ ./big 96321
[big.v:17] n: 96321
[big.v:21] a.bit_len (): 319971
[big.v:22] b.bit_len (): 319970
the second run will hang ....
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.9 ab2eb00
Environment details (OS name and version, etc.)
V full version
V 0.4.9 ab2eb00
OS
linux, Ubuntu 24.04.2 LTS
Processor
8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
Memory
13.86GB/15.51GB
V executable
/media/HD/github/kbkpbot/v/v
V last modified time
2025-02-25 14:20:44
V home dir
OK, value: /media/HD/github/kbkpbot/v
VMODULES
OK, value: /home/mars/.vmodules
VTMP
OK, value: /tmp/v_1000
Current working dir
OK, value: /home/mars/v/bug
Git version
git version 2.43.0
V git status
weekly.2025.09-1-gab2eb001
.git/config present
true
cc version
cc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
gcc version
gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
clang version
Ubuntu clang version 18.1.3 (1ubuntu1)
tcc version
tcc version 0.9.28rc 2024-07-31 HEAD@1cee0908 (x86_64 Linux)
tcc git status
thirdparty-linux-amd64 0134e9b9-dirty
emcc version
N/A
glibc version
ldd (Ubuntu GLIBC 2.39-0ubuntu8.4) 2.39
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
Describe the bug
When use big number div, it will hang when the number beyond some value.
Reproduction Steps
big.v
Expected Behavior
Current Behavior
the second run will hang ....
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.9 ab2eb00
Environment details (OS name and version, etc.)
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.