Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
tjpc3

How to exceed te maxiumum numbers allowed by Lua?

Question

Posted

I'm a situation where I'm writing programs that do arithmetic on large numbers for encryption. However, Lua hates large numbers and changes any number that is 2^1024 or over. Is there any addon or something else that I could use to bypass this?

 

Example:

print(4265 ^ 6219)

> inf

2 answers to this question

Recommended Posts

  • 0
Posted

Not really. Lua uses 64-bit signed integers as long as possible (unless you force floating-point numbers by writing 4265.0 instead of 4265) and switches to double-precision floats for anything outside of that range. And if you exceed that range, then you get float infinity.

 

If you're doing cryptography, you might want to look at the Data Card though. If I remember correctly the higher tiers provide some cryptographic functions too.

  • 0
Posted

there is a bigint implementation that I used in cc from a WoW add-on you'll have to google it but its out there in pure lua but it's not the fastest animal if you don't need to perform calculations against the return value convert it to string.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.