v-community / v_rosetta

Collection of source code for Rosetta Code
MIT License
13 stars 2 forks source link

Create square_root_by_hand.v #7

Closed VincentLaisney closed 3 years ago

VincentLaisney commented 3 years ago

From index 310 the result of sqrt(2) is erroneous. There is a problem in the math.big library which uses the tiny-bignum that has limited capabilities.

VincentLaisney commented 3 years ago

From index 310 the result of sqrt(2) is erroneous. There is a problem in the math.big library which uses the tiny-bignum that has limited capabilities.

In order to control the problem of the big "big-int", I have made a go program to generarate random big-int, perform the 5 basic operations on them and record the results. A second program in V can do the same but also read the (go-)output and make the same operation and record the results. For little big-int the V-calculation give the same results as Go (exept for negative numbers which tiny-bignum does not support). But for large big.int (e.g. 300 decimal digits) the results are different.