PDA

View Full Version : Trying to figure out how to compare to a value with decimal places



andywpg
- 8th April 2012, 01:39
I am working on a project that uses a GPS module. The data on (for example) latitude comes in the data stream in the format:

ddmm.mmmm (23 degrees 53.8765 minutes would be 2353.8765).

I understand how to use the DEC modifier to separate degrees, minutes and decimal into separate variables to work on them, but, here is my problem.

I then have to 'massage' the data by comparing to values in six tables (for latitude and longitude) to convert the geodetic coordinates to grid square.

Five of the six tables are easy, it's the last one that I'm having a problem with. A portion of the table would be:

"If the minutes in the latitude are between 55.0 and 57.5, the letter representation is B"

Any idea how I can create (and compare to) a table whose values have to go 0.0, 2.5, 5.0, 7.5, 10.0 etc?

Any help would be appreciated.

I'm actually thinking about a math co-processor chip, but I'm not sure if it will help.

Thanks

Andy

mackrackit
- 8th April 2012, 06:31
Multiply the values by 10 to remove the decimal.

IF X > 550 and X < 575 THEN...

andywpg
- 8th April 2012, 15:11
Multiply the values by 10 to remove the decimal.

IF X > 550 and X < 575 THEN...

Its funny how I always think of the hardest way to do things. THANKS!