Sign in to follow this  

lua: number always double?

This topic is 3301 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, in my application i work a lot with 64bit numbers. i barely need floats/reals, only few of them. would u recommend me to change the number definition of the lua compiler/runtime to uint64, or would u rather recommend that i continue to use doubles, and use them for my calculations? i actually would like to NOT change the lua configuration, but it just "feels weird" to perform my uint64-stuff with doubles :) thanks Chris

Share this post


Link to post
Share on other sites
Quote:

i barely need floats/reals, only few of them.

Then I would stick with them.

Quote:

would u recommend me to change the number definition of the lua compiler/runtime to uint64, or would u rather recommend that i continue to use doubles, and use them for my calculations?

I would certainly not. If you were having considerable performance problems then maybe. But because it could potentially break any code which does any kind of math I would advise against it.

Quote:

it just "feels weird" to perform my uint64-stuff with doubles

You'd be surprised how quick you forget that is what is happening under the hood [wink]

Share this post


Link to post
Share on other sites
thanks for the reply.

i do not have any performance worries. but my C routines are based on uint64, and i surely will use the whole address space. i was initially worried about conversion errors, but i guess that's silly (my "math" is very simple, just addition/substraction and shifting bits (mul/div by 8).

i'll stick with the doubles...

Share this post


Link to post
Share on other sites

This topic is 3301 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this