2004-03-16 06:18 PM
2004-03-16 01:29 AM
Hallo!
I have to realize a division by 10 of some integer values, as follows: ex. 128/10 =12 (it would be better 13 but it is not indispensable). Does it exists a method to realize this by-10-division (in C or assembler or bit-oriented, for ST62T60C) in the less expensive way? (i.e. without implement a whole division procedure - i have that but it is too heavy) Is it possible to use in some way the fact that, in these kind of divisions, we only have to throw away the last number of the decimal notation? Thanks and regards2004-03-16 04:18 AM
Are you talking about 8 or 16bit division, a simple 8bit div10 could be done in about 34 bytes. Is that too much of an overhead ?
Regards sjo2004-03-16 06:18 PM
I am talking about a 16 bit division but if you kindly have a solution for 8 bit it could be also useful to me for other purposes... I made the general division (by an integer number) by using recursive subtractions and then evaluating the result at every step( the so called ''rest theorem''). Have you something better?
Thank you very much for your interest, bye Marco