Another alternative that could possibly result in some lost precision (but probably not a big deal in most cases):
a = x + ((y * 1)/ 10); b = x + ((y * 3)/ 10); c = x + ((y * 3)/ 20);
Basically, if you do the multiplication first, you're getting a larger number that you're then dividing, rather than a fraction which gets truncated to 0.
You'll have to try out different methods, I guess. If neither of these work and you actually want to work with fixed point math, then some better examples of that can be provided! The Crappy Gamez Xplosions that Ovk has been holding have made certain that I am a fixed-point ninja. Or, at least, a low-level spy.
Oh and, for the curious, that's part of my my super-new-fancy-automated leveling-up-algorthm-thingy. (Tm). (Read Preceeding "Stat Whore" post as to reasons why. :P)
Comments 3
(The comment has been removed)
a = x + ((y * 10) / 100); // factored out *100/10
Another alternative that could possibly result in some lost precision (but probably not a big deal in most cases):
a = x + ((y * 1)/ 10);
b = x + ((y * 3)/ 10);
c = x + ((y * 3)/ 20);
Basically, if you do the multiplication first, you're getting a larger number that you're then dividing, rather than a fraction which gets truncated to 0.
You'll have to try out different methods, I guess. If neither of these work and you actually want to work with fixed point math, then some better examples of that can be provided! The Crappy Gamez Xplosions that Ovk has been holding have made certain that I am a fixed-point ninja. Or, at least, a low-level spy.
Reply
Reply
Reply
Leave a comment