does the number always round downwards
Probably - but it's an excellent question
Have to ask "rounds downwards" compared to what and under what circumstances - a perfect infinite digit accuracy calculator that evaluates any arbitrary expression in a PICAXE-like way (main features being left to right with no brackets)?
I don't think I'd trust the simulator too much - I doubt there is an identical code base between the simulator and the PICAXE runtime firmware (a number of differences have been found in the past) - and I'd certainly check with a calc that produces greater than 0.5 at the end e.g. 23/12
EDIT- sorry Rick - I now see you did that with 11/3
I'm sure (exercise for others
) that some expressions can be proposed where:
- overall, the answer is rounded down to the nearest correct integer compared with an infinite digit accuracy calculator e.g. 9/4, 23/12 etc
- overall the answer is lower and completely wrong (at the integer level) compared with an infinite digit accuracy calculator e.g. 23/12*12
- (maybe) overall the answer is higher and completely wrong (at the integer level) compared with an infinite digit accuracy calculator e.g. errr...can't think of one off-hand
I don't think there is a simple answer - other than to carefully look at every calc you do. In the past, I've used a spreadsheet with a column for the 'perfect maths' outputs for a calc and a column for the 'PICAXE maths' calculations and eyeballed/auto-colour coded the differences (usually resulting in reworking the 'PICAXE maths' to get more appropriate answers)