# Getting Decimal Values From Whole Numbers - Is This Fixed-Point Arithmetic? [closed]

I'm working with a device that allows remote updates via SNMP to change the FM input/ouput frequency of the device. When I query the devices, I get back whole numbers, but, in real life, FM frequencies have decimal values. I happened to stumble across some code for setting the frequency where the developer was taking decimal values (representing FM frequencies) and dividing them by 0.05 before saving them into the device. Inversely, for display purposes, the developer multiplied the numbers by 0.05 to turn them back into their decimal notation. For example:

107.1 / 0.05 = 2142
2142 * 0.05 = 107.1

There is no documentation that specifies the meaning of this operation. I thought it might be some kind of fixed-point arithmetic (popular before the days of FPUs, but I wasn't sure because I thought fixed-point arithmetic usually stuck to base 10 or base 2.

Is anybody able to explain this operation? Is my suspicion correct?

• This is not in-scope for this site. As Suresh says: 'This site is for research-level questions in theoretical computer science, that are likely to have short well-defined answers. "Research-level" means, roughly, questions that might be discussed between two professors, or between graduate students working on Ph.D.'s, but not usually between a professor and the typical undergraduate student.' – Mark Reitblatt Jan 15 '11 at 1:18
• A better place for this question is math.stackexchange.com. – Yuval Filmus Jan 15 '11 at 2:39
• This site is for research-level questions in theoretical computer science, that are likely to have short well-defined answers. "Research-level" means, roughly, questions that might be discussed between two professors, or between graduate students working on Ph.D.'s, but not usually between a professor and the typical undergraduate student. It does not include questions at the level of difficulty of undergraduate homework. You may want to try Math.SE or StackOverflow. Voting to close as off-topic. – Kaveh Jan 15 '11 at 6:06

## 1 Answer

The operation is discretization to steps of size $0.05\mathrm{Hz}$. In other words, in the computer the values stored are in a new unit which is 20 times smaller than a Hertz.

This corresponds to decimal values after the dot of the forms $.X$ and $.X5$. So two steps correspond to a change in the first digit after the dot.

In fixed-point arithmetic, there is a base (usually base 2), and you take a fixed number of digits after the dot. This works (somewhat artificially) in this case if you use base 20.