Skip to main content
GameDev.net gamedev.net
🔒 Locked

lua: number always double?

Started by cruppstahl Dec 2, 2008 at 2:49 PM 1 replies 1.2k views
Original Post
cruppstahl
cruppstahl
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
rip-off
rip-off
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]
cruppstahl
cruppstahl
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...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.