This is just for information for anyone having trouble with decimal math on Picaxe. I am sure this is already posted in some form on here already, but it's always helpful to us newbies.
I was trying to multiply a variable w0 by 1.47. Tried the recommended ways such as w1 = w0 * 147/100 , etc. Still came up with screwy results, probably due to overflow.
But then I remembered, Picaxe does math Left to Right. I was putting the variable I wanted to multiply by 1.47 (w0) at the beginning of the equation because it looked proper. However, I found I got much better results when I put the variable (w0) at the END.
I rewrote the equation to be w1 = 147/100 * w0. Do the math first, then throw in the variable.
I get much better results this way.
I hope this info helps someone.
I was trying to multiply a variable w0 by 1.47. Tried the recommended ways such as w1 = w0 * 147/100 , etc. Still came up with screwy results, probably due to overflow.
But then I remembered, Picaxe does math Left to Right. I was putting the variable I wanted to multiply by 1.47 (w0) at the beginning of the equation because it looked proper. However, I found I got much better results when I put the variable (w0) at the END.
I rewrote the equation to be w1 = 147/100 * w0. Do the math first, then throw in the variable.
I get much better results this way.
I hope this info helps someone.