min max

Peter M

Senior Member
It would seem that the MIN command does not work in the simulator

let w0=w0-1 min 0

when using this w0 just rolled right on by back to 65k

let w0=w0+1 max 1023

Yet this worked as expected?

So unless i've done something dumb (wouldn't be the first time, won't be the last)

Ver 5.1.7
winXP
 

Technical

Technical Support
Staff member
You can't use this statement as you intend because of overflow - PICAXE doesn't support negative numbers.

if w0 = 1
so w0 = 1 - 1 which is 0, correct

if w0 =0
so w0 = 0 - 1 which is 65535, which is greater than 0, still correct.
 

Peter M

Senior Member
yep.. Thanks (I did try it at 1 but forgot to set w1 at 1)

like I said won't be the last!
 
Top