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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/11/04 16:45
Read: times


 
Msg Score: +3
 +3 Informative
#72384 - Fractional Equivalence
In the monitoring systems I work on I frequently have to convert or scale values. The scaling values are almost always fractional, and since I refuse to use floating point because of its code size and speed impacts, I have to get my desired results through combined integer multiplication and division.

In searching the web I found a nice discussion of fractional equivalence, with an sequence of equations used to determine an integer fraction equivalent to a floating point value. I implemented these in an Excel spread sheet.

For instance, the conversion factor for converting gallons to liters is 3.7853, and using the spreadsheet I find that 53/14 is pretty close, 617/163 is closer and 1957/517 is still closer. I can choose a value that suits my accuracy needs, and adjust my variable size(s) to match the calculation to avoid integer overflow.

The spreadsheet is available at http://www.8052.com/users/dwelbourn/FrctEqv.xls

Dennis




List of 13 messages in thread
TopicAuthorDate
Fractional Equivalence            01/01/70 00:00      
   RE: Fractional Equivalence            01/01/70 00:00      
      RE: Fractional Equivalence            01/01/70 00:00      
         RE: Fractional Equivalence            01/01/70 00:00      
      RE: Fractional Equivalence            01/01/70 00:00      
         RE: Fractional Equivalence            01/01/70 00:00      
   RE: Fractional Equivalence            01/01/70 00:00      
      RE: Fractional Equivalence            01/01/70 00:00      
         RE: Fractional Equivalence            01/01/70 00:00      
            RE: Fractional Equivalence            01/01/70 00:00      
            RE: Fractional Equivalence            01/01/70 00:00      
               RE: Fractional Equivalence            01/01/70 00:00      
   RE: Fractional Equivalence            01/01/70 00:00      

Back to Subject List