v() bug
Reptorian1125 opened this issue · 4 comments
Just run this code.
foo: v:=v(0,192928249295) echo $v
It just halts or something. I don't see output of $v, and CPU stays at 8%.
Workaround using int(u(0,192928249295)) works though.
Thanks @Reptorian1125 , very interesting bug.
Fixed with GreycLab/CImg@ab7c3a6
Anyway, I had to limit the capabilities of the random integer functions to a 32bits range.
Thanks. Does this mean I will have to use int(u()) workaround for larger numbers?
Thanks. Does this mean I will have to use int(u()) workaround for larger numbers?
OK, I've extended the functions to generate 64bits random integers.
Commit : GreycLab/CImg@32ae702
But please note technically speaking, larger numbers than +-2^32 cannot be considered as integer anymore (cannot be stored in a 64bits integer). So there are no chances you can get accurate random numbers with larger ranges.
Got it. Though you can represent up to 2^53 in double format.
Actually, maybe a check to see if any boundary are outside +-2^32 and switch to int(u()).