Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/24/02 02:19
Read: times


 
#26210 - RE: Conversion from ASCII to floating point
I've thought about a way to do this:

Assume that I key in 123.45.
First I remove the dot at put it at a factor counter as 2 (because of the 2 floating point decimals), turning the number into 12345. eg: 123.45 = 12345 (f2). The value of 2 actually denotes 10^2 or 100.
Second I multiply each with a value to make it computer understandable, such as:
1 * A^4h + 2 *A^3h + 3 * A^2h + 4 * A^1h + 5 * A^0h, which will give me a hex value of 3039h (equivalent to 12345).
Thirdly I will use this number to do multiplication and addition, taking into account the factor counter.

It is easy to do multiplication because we need to add up the factor counters together.
eg: 123.45 * 1.111 = 12345(f2) * 1111 (f3) = 13715295 (f5) = 137.15295

The problem I now have is how do I do addition? If I have the following numbers:

12345 + 0.0595 = 12345 (f0) + 595 (f4)

Do I really need to increase the factor of 12345 to factor 4? eg: 12345 (f0) = 123450000 (f4)? To do that I need to multiply again 12345 with 10000, which needs to implement 3 bytes multiplication routines. Are there any alternatives? Thanks.

List of 31 messages in thread
TopicAuthorDate
Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating po            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: floating point code size- Luca            01/01/70 00:00      
RE: floating point code size- Luca            01/01/70 00:00      
RE: floating point code size- Luca            01/01/70 00:00      
RE: floating point - Improper fractions?            01/01/70 00:00      
RE: floating point code size- Luca            01/01/70 00:00      
A new dimension to the problem...            01/01/70 00:00      
RE: A new dimension to the problem...            01/01/70 00:00      
ADD: A new dimension to the problem...            01/01/70 00:00      
RE: ADD: A new dimension to the problem...            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: Conversion from ASCII to floating point            01/01/70 00:00      
RE: floating point - Improper fractions?            01/01/70 00:00      

Back to Subject List