# Example of how to rb\_class\_new\_instance(... rb\_cBignum)?

**URL:** <https://rubytalk.org/t/example-of-how-to-rb-class-new-instance-rb-cbignum/25388>\
**Category:** ruby-talk\
**Created:** [3 March 2006 00:58 UTC](https://rubytalk.org/t/example-of-how-to-rb-class-new-instance-rb-cbignum/25388 "2006-03-03T00:58:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clifford\_Heath3](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@Clifford\_Heath3](https://rubytalk.org/u/Clifford_Heath3)\
**Post date:** [3 March 2006 00:58 UTC](https://rubytalk.org/t/example-of-how-to-rb-class-new-instance-rb-cbignum/25388/1 "2006-03-03T00:58:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Logan\_Capaldo](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@Logan\_Capaldo](https://rubytalk.org/u/Logan_Capaldo)\
**Post date:** [3 March 2006 01:07 UTC](https://rubytalk.org/t/example-of-how-to-rb-class-new-instance-rb-cbignum/25388/2 "2006-03-03T01:07:43Z")

</div>

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

> **···**
>
> 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.

---

<div class="post-metadata">

**Author:** ![Daniel\_Harple](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@Daniel\_Harple](https://rubytalk.org/u/Daniel_Harple)\
**Post date:** [3 March 2006 01:16 UTC](https://rubytalk.org/t/example-of-how-to-rb-class-new-instance-rb-cbignum/25388/3 "2006-03-03T01:16:25Z")

</div>

VALUE foo = LL2NUM(my\_long);

-- Daniel

> **···**
>
> 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.

---

<div class="post-metadata">

**Author:** ![Clifford\_Heath3](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@Clifford\_Heath3](https://rubytalk.org/u/Clifford_Heath3)\
**Post date:** [3 March 2006 01:18 UTC](https://rubytalk.org/t/example-of-how-to-rb-class-new-instance-rb-cbignum/25388/4 "2006-03-03T01:18:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Clifford\_Heath3](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@Clifford\_Heath3](https://rubytalk.org/u/Clifford_Heath3)\
**Post date:** [3 March 2006 04:33 UTC](https://rubytalk.org/t/example-of-how-to-rb-class-new-instance-rb-cbignum/25388/5 "2006-03-03T04:33:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Logan\_Capaldo](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@Logan\_Capaldo](https://rubytalk.org/u/Logan_Capaldo)\
**Post date:** [3 March 2006 01:39 UTC](https://rubytalk.org/t/example-of-how-to-rb-class-new-instance-rb-cbignum/25388/6 "2006-03-03T01:39:47Z")

</div>

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

> **···**
>
> 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.
