Trying to figure out how to compare to a value with decimal places


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    157

    Default Trying to figure out how to compare to a value with decimal places

    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

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Trying to figure out how to compare to a value with decimal places

    Multiply the values by 10 to remove the decimal.

    IF X > 550 and X < 575 THEN...
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    157


    Did you find this post helpful? Yes | No

    Default Re: Trying to figure out how to compare to a value with decimal places

    Quote Originally Posted by mackrackit View Post
    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!

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts