Primitive 0x2, int32, and overflow

(1/1)

rufio:
I am guessing that the expression primitive does signed 16-bit math, correct?  Is there any way to coerce it into doing 32-bit math, or unsigned math, or getting it to check for overflow?  Or would I have to implement that myself if I wanted it?

J. M. Pescado:
Quote from: rufio on 2010 January 25, 20:23:33

I am guessing that the expression primitive does signed 16-bit math, correct?  Is there any way to coerce it into doing 32-bit math, or unsigned math, or getting it to check for overflow?
Nope.

Inge:
EA make liberal use of mod and div and store values in multiple variables, one for units, one for tens of thousands etc :) 

J. M. Pescado:
That method is only used to store money and not really for anything else, and represents more of a special, handmade behavior than true 32-bit math.

rufio:
Yes, I was actually looking at the earned money value when I asked this - if you use the Date Counter thingy from Darcyland to track wealth, you can see that there appears to be some kind of horrible overflow problem with it, so that my sim has apparently made "92 thousand, -3029 simoleans".  It obviously doesn't affect things badly enough that sims can't still make $100K in a reasonable amount of time, but it's extremely annoying when I'm trying to keep track as I go along.  I don't know why they didn't simply use (or simulate) 32-bit ints there - it would have made much more sense and probably would have been easier to debug.

Navigation

[0] Message Index