Example of how to rb_class_new_instance(... rb_cBignum)?


#1

I’m building a C extension and have a “long long”
which I want to turn into a Bignum. Can anyone
point me to an example please? I’ve googled without
success.

Clifford H…


#2

On Mar 2, 2006, at 7:58 PM, Clifford H. wrote:

I’m building a C extension and have a “long long”
which I want to turn into a Bignum. Can anyone
point me to an example please? I’ve googled without
success.

Clifford H…

Basing this purely on a random guess (based on reasonable assumptions
about ruby) try:
LONGLONG2NUM()


#3

On Mar 3, 2006, at 1:58 AM, Clifford H. wrote:

I’m building a C extension and have a “long long”
which I want to turn into a Bignum. Can anyone
point me to an example please? I’ve googled without
success.

Clifford H…

VALUE foo = LL2NUM(my_long);

– Daniel


#4

Logan C. wrote:

Basing this purely on a random guess (based on reasonable assumptions
about ruby) try:
LONGLONG2NUM()

Reasonable guess I suppose, except that doesn’t seem to
be declared anywhere (ruby 1.8.1-11) :-(.

Clifford.


#5

On Mar 2, 2006, at 8:18 PM, Clifford H. wrote:

Logan C. wrote:

Basing this purely on a random guess (based on reasonable
assumptions about ruby) try:
LONGLONG2NUM()

Reasonable guess I suppose, except that doesn’t seem to
be declared anywhere (ruby 1.8.1-11) :-(.

Clifford.

Hopefully by now you’ve seen Daniel’s more accurate response. (LL2NUM
(x))


#6

Daniel H. wrote:

VALUE foo = LL2NUM(my_long);

Thanks both. I have my extension working.

Kudos to Matz also - it’s really easy to build these things :-).

Clifford H…