How does \ or / actually work?
I know both are actually repeated subtraction so, for example:
8/2=4 because 2 can be subtracted four times: 8 - 2 - 2 - 2 - 2
But before any wisecracks stroke their beards wisely, then surely this can't be how the operator's are handled by the processor?
If I perform operation A (following), then it is certainly faster than operation B (even taking account for processor optimisations, code overhead etc etc).
A:B: x=1000Code:x=1000/2
Do
x=x-2
count=count+1
Loop until x<=2
Maybe it uses the mod operator on the individual digits in some way? Thoughts please.




Reply With Quote