Forum: Ruby Example of how to rb_class_new_instance(... rb_cBignum)?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
260b864377cc125e575de59843cb02b3?d=identicon&s=25 Clifford Heath (Guest)
on 2006-03-03 02:00
(Received via mailing list)
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 Heath.
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-03-03 02:09
(Received via mailing list)
On Mar 2, 2006, at 7:58 PM, Clifford Heath 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 Heath.
>

Basing this purely on a random guess (based on reasonable assumptions
about ruby) try:
LONGLONG2NUM()
9358cc96c46055cd68d4a76a9aefe026?d=identicon&s=25 Daniel Harple (Guest)
on 2006-03-03 02:18
(Received via mailing list)
On Mar 3, 2006, at 1:58 AM, Clifford Heath 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 Heath.

VALUE foo = LL2NUM(my_long);

-- Daniel
260b864377cc125e575de59843cb02b3?d=identicon&s=25 Clifford Heath (Guest)
on 2006-03-03 02:18
(Received via mailing list)
Logan Capaldo 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.
E34b5cae57e0dd170114dba444e37852?d=identicon&s=25 Logan Capaldo (Guest)
on 2006-03-03 02:39
(Received via mailing list)
On Mar 2, 2006, at 8:18 PM, Clifford Heath wrote:

> Logan Capaldo 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))
260b864377cc125e575de59843cb02b3?d=identicon&s=25 Clifford Heath (Guest)
on 2006-03-03 05:34
(Received via mailing list)
Daniel Harple 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 Heath.
This topic is locked and can not be replied to.