Code: Select all
Let>VALUE=12^2
//VALUE=144
Moderators: Dorian (MJT support), JRL
Code: Select all
Let>VALUE=12^2
//VALUE=144
Code: Select all
Let>value={12^2}
Code: Select all
Let>Number=4
Let>Remaining={%Number% mod 3}
//Remaining=1
Let>Remaining={%Number% mod 2}
//Remaining=0
Code: Select all
Let>Number1=4
Let>Number2=3
Let>Remaining={%Number1% mod %Number2%}
Let>Whole={%Number1% div %Number2%}
MDL>%Number1%/%Number2% = %Whole% + %Remaining%/%Number2%
Code: Select all
Let>Result=0
//{1 shl 0} = //binary = 000 000 001 //decimal = 1
//Let>Error=1 would also work for this bit...
Let>Error={1 shl 0}
Let>Result={%Result% or %Error%}
//result = 000 000 001
//{1 shl 1} = //binary = 000 000 010 //decimal = 2
Let>Error={1 shl 1}
Let>Result={%Result% or %Error%}
//result = 000 000 011
//{1 shl 2} = //binary = 000 000 100 //decimal = 4
Let>Error={1 shl 2}
Let>Result={%Result% or %Error%}
//result = 000 000 111
//... add any bit as a 1 for any new error, just remember to shift it to the left to add it to the unique bit
//{1 shl 7} = //binary = 010 000 000 //decimal = 128
Let>Error={1 shl 7}
Let>Result={%Result% or %Error%}
//result = 010 000 111
//to act on a given error, let's say error if bit 2 is a 1
Let>ErrorCode={1 shl 2}
Let>ShouldIAct={%Result% and %ErrorCode%}
//ShouldIAct is set to 4
If>ShouldIAct=ErrorCode
//if the return value = error code the error bit has been set...
Endif>
IfNot>ShouldIAct=0
//if this is more logical for you... then use this one
Endif>
//to act on a given error, let's say error if bit 5 is a 1
Let>ErrorCode={1 shl 5}
Let>ShouldIAct={%Result% and %ErrorCode%}
//we haven't set the fifth bit to 1, ShouldIAct=0
//to act on a given error, let's say error if bit 0 is a 1
Let>ErrorCode={1 shl 0}
Let>ShouldIAct={%Result% and %ErrorCode%}
//ShouldIAct=1
Code: Select all
//maximum of 62 error to be stored, MS uses double and thus the biggest value is 64 bit long
Let>MaximumBit=62
Let>Result={0 shl %MaximumBit%}
Let>Error={1 shl 0}
Let>Result={%Result% or %Error%}
Let>Error={1 shl 1}
Let>Result={%Result% or %Error%}
Let>Error={1 shl 2}
Let>Result={%Result% or %Error%}
Let>Error={1 shl 7}
Let>Result={%Result% or %Error%}
ArrayDim>ERRORS,MaximumBit
Let>k=-1
While>k<MaximumBit
Let>k=k+1
Let>Temp={1 shl %k%}
Let>Temp={%Result% and %Temp%}
If>Temp>0
Let>ERRORS_%k%=1
Else>
Let>ERRORS_%k%=0
Endif>
EndWhile>