Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6064619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:18:00+00:00 2026-05-23T09:18:00+00:00

Lua by default uses a double precision floating point ( double ) type as

  • 0

Lua by default uses a double precision floating point (double) type as its only numeric type. That’s nice and useful. However, I’m working on software that expects to see 64bit integers, for which I don’t get around using actual 64bit integers one way or another.

The place where the integer type becomes relevant is for file sizes. Although I don’t truly expect to see file sizes beyond what Lua can represent with full “integer” precision using a double, I want to be prepared.

What strategies can you recommend when using a 64bit integer type in parallel with the default numeric type of Lua? I don’t really want to throw the default implementation overboard (and I’m not worried of its performance compared to integer arithmetics), but I need some way of representing 64bit integers up to their full precision without too much of a performance penalty.

My problem is that I’m unsure where to modify the behavior. Should I modify the syntax and extend the parser (numbers with appended LL or ULL come to mind, which to my knowledge doesn’t exist in default Lua) or should I instead write my own C module and define a userdata type that represents the 64bit integer, along with library functions able to manipulate the values? …

Note: yes, I am embedding Lua, so I am free to extend it whichever way I please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:18:00+00:00Added an answer on May 23, 2026 at 9:18 am

    As part of LuaJIT’s port to ARM CPUs (which often have poor floating-point), LuaJIT implemented a “Dual-number VM”, which allows it to switch between integers and floats dynamically as needed. You could use this yourself, just switch between 64-bit integers and doubles instead of 32-bit integers and floats.

    It’s currently live in builds, so you may want to consider using LuaJIT as your Lua “interpreter.” Or you could use it as a way to learn how to do this sort of thing.

    However, I do agree with Marcelo; the 53-bit mantissa should be plenty. You shouldn’t really need this for a good 10 years or so.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lua has a really nice no-parenthesis call syntax that coupled with function closures allow
I have a makefile that looks like: default: lua blah.lua Now, in Vim, I
Lua's tonumber function is nice but can only convert unsigned integers unless they are
I started learning about lua language to develop games,i percept that most people uses
When I see Lua, the only thing I ever read is great for embedding,
I have a Lua program that is consuming data from an external device. The
In lua, it's legal to do this : table={} bar if(table[key]==nil) then foo However,
I have a class that is wrapped with swig, and registered with lua. I
In Lua-scripting I found wxWidgets (wxLua) library very useful, so I'd wanted to found
The C# compiler requires that whenever a custom type defines operator == , it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.