I have a C module that I am testing with Ruby test by extending ruby with this piece of C code. Any number above 2 ** 24 -1 is being modified. I need to pass 64-bit values back and forth between Ruby and C and it should be bit-precise. Any thoughts would be appreciated.
in c extension:
long int sig_val;
sig_val = NUM2LL(sig) // sig is type VALUE and is ruby number to be passed on to C
. . . Few example of data I passed:
- (2^34 -1) * 16 ==> C receives (2^34) * 16
- (2^34 +1) * 16 ==> C receives (2^34) * 16
- (2^24 +1) * 16 ==> C receives (2^24) * 16
- (2^25 -1) ==> C receives (2^25)
- (2^24 -1) ==> C receives (2^24 -1) (Correct)
Any number below is also correct.
Thank you!