| ??? 12/05/02 16:37 Read: times |
#33842 - RE: division with decimal??? |
If you are working in Assembler, then there is code in the code library of this web site that gives sample code for doing Integer divide. The numbers that this type of code works with are BINARY. The binary numbers are often re-formatted to HEX to make them more compact to type in or to read.
If you want to have the inputs and outputs in a base 10 (decimal) format then you need to convert binary to/from decimal. There is a common technique used by assembly language programmers in that they program in integers but keep track of a presumed decimal point. For example all numbers could be scaled 100x larger than the normal and the the integer arithmetic is handled normal fixed point. However on re-conversion to decimal at the time results are displayed the value can be divided by 100 whereby the remainder is the fractional part of result. This technigue is often done by running with the scaled up integers being 256x larger than normal. This eliminates the need to do an actual divide to find the remainder/fractional part of the result. The low byte of the numbers is the fractional part and the upper bytes are the whole number part. I hope this gives you some ideas. Michael Karas |
| Topic | Author | Date |
| division with decimal??? | 01/01/70 00:00 | |
| RE: division with decimal??? | 01/01/70 00:00 | |
| RE: division with decimal??? | 01/01/70 00:00 | |
| RE: division with decimal??? | 01/01/70 00:00 | |
| RE: division with decimal??? | 01/01/70 00:00 | |
| RE: division with decimal??? / Andy..... | 01/01/70 00:00 | |
| RE: division with decimal??? | 01/01/70 00:00 | |
RE: division with decimal??? / Andy..... | 01/01/70 00:00 |



