Simulator is supposed to be used for debuging purpose... so this may append...You are correct, PE6 is not catching the error which we have now fixed for the next release.
Obviously anything more than <<16 is faulty on 32 bit maths anyway.
In simulation, SIN and COS are not conform to documentation for angle>90°http://www.picaxe.com/Software/PICAXE/PICAXE-Editor-6/#tRevisionHistory
Note that each command is only valid within certain values - for instance ATAN is only ever valid between 0-100 (0-1 when not multiplied by 100)
See here for sin and cos value info, which were already correct - http://www.picaxe.com/BASIC-Commands/Variables/let/
[COLOR=Blue]for [/COLOR][COLOR=Purple]w0 [/COLOR][COLOR=DarkCyan]= 0 [/COLOR][COLOR=Blue]to [/COLOR][COLOR=Navy]360
[/COLOR][COLOR=Purple]b2 [/COLOR][COLOR=DarkCyan]= sin [/COLOR][COLOR=Purple]w0
[/COLOR][COLOR=Blue]if [/COLOR][COLOR=Purple]b2 [/COLOR][COLOR=DarkCyan]>= [/COLOR][COLOR=Navy]128 [/COLOR][COLOR=Blue]then
[/COLOR][COLOR=Purple]b2 [/COLOR][COLOR=DarkCyan]= [/COLOR][COLOR=Purple]b2 [/COLOR][COLOR=DarkCyan]- [/COLOR][COLOR=Navy]128
[/COLOR][COLOR=Blue]sertxd ([/COLOR][COLOR=Black]#[/COLOR][COLOR=Purple]w0[/COLOR][COLOR=Black], [/COLOR][COLOR=Red]" -"[/COLOR][COLOR=Black],#[/COLOR][COLOR=Purple]b2[/COLOR][COLOR=Black],[/COLOR][COLOR=Blue]cr[/COLOR][COLOR=Black],[/COLOR][COLOR=Blue]lf)
else
sertxd ([/COLOR][COLOR=Black]#[/COLOR][COLOR=Purple]w0[/COLOR][COLOR=Black], [/COLOR][COLOR=Red]" +"[/COLOR][COLOR=Black],#[/COLOR][COLOR=Purple]b2[/COLOR][COLOR=Black],[/COLOR][COLOR=Blue]cr[/COLOR][COLOR=Black],[/COLOR][COLOR=Blue]lf)
end if
next [/COLOR][COLOR=Purple]w0[/COLOR]
You are right, and I did not read correctly the documentation :This example works ok for us in simulation. Can you be more precise in where you believe the error is?
PICaxe does not work "perfectly" (or at all) multiplying negative numbers.Picaxes perfectly working with two's complement negatives numbers, at least for add, substract and multiply.
Ohhhh ! Did not saw that ! Was only trying for -1 *2 or 2*-1Hi,
PICaxe does not work "perfectly" (or at all) multiplying negative numbers.
For example 255 * 255 (-1 * -1) produces a result of 65025 (-511) not +1 .
Cheers, Alan.
It is more correct to say that unsigned maths can, in appropriate circumstances, deliver a result as expected when two's complement values are used. In some cases the results will not be as expected. This is particularly so when mixing byte and word variables.I understood that it was two's complement... witch is coherent with Picaxes perfectly working with two's complement negatives numbers,
at least for add, substract and multiply.