cancel
Showing results for 
Search instead for 
Did you mean: 

ST62T60C division by 10

mbuto
Associate II
Posted on March 17, 2004 at 03:18

ST62T60C division by 10

3 REPLIES 3
mbuto
Associate II
Posted on March 16, 2004 at 10:29

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 regards
sjo
Associate II
Posted on March 16, 2004 at 13:18

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

sjo
mbuto
Associate II
Posted on March 17, 2004 at 03:18

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