Forums

Big Numbers?

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Big Numbers?

Postby _Gold_Fish » Thu Jul 01, 2010 2:58 pm

class Program
def main
print 2**30
print 2**31
print 2**32

returns
Code: Select all
1073741824
-2147483648
-2147483648


The first is correct, the second is the negative of the proper answer answer, and the third is totally wrong.

I know (think) this has to do with int32 limits. Which leads me to my question: is there a built in class(s) in Cobra for operating with large numbers (over uint64's limit)?

In another thread in this forum, someone suggested a C# library (BIGINT, I think), however it looks messy (things like needing extra parenthesis) and I'd rather use something native to Cobra.
_Gold_Fish
 
Posts: 18

Re: Big Numbers?

Postby Charles » Thu Jul 01, 2010 6:22 pm

We do not have a "BigDecimal" or "BigInteger" type at this time. Can you tell me what applications you had in mind that will exceed, say int64?
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Big Numbers?

Postby _Gold_Fish » Fri Jul 02, 2010 3:50 am

I've been messing around with some physics stuff in Cobra, and you can get pretty numbers pretty quickly. Also, ProjectEuler :D
_Gold_Fish
 
Posts: 18


Return to Discussion

Who is online

Users browsing this forum: No registered users and 78 guests

cron