Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Greetings,

As a returnee to programming (last time in the 90's with Borland Pascal 5.5, stop laughing) I want to know the handiest way of comparing 2 numbers within 2 decimals.

As the origin of the data is a string (gps feed), I'm thinking along the line doing a Convert.ToDouble(sVar but not sure how to Implement string formats here.

The long way would be to search for the decimal point and then place the next 2 numbers in a single string and convert.ToInt and compare then but if possible want something a bit less code and brainpower consuming

Any Idea's welcome as this is my back to work project if I can pull this bit of software off.


Thanks,

BBB
Posted

1 solution

This[^] might help.

As might this[^].
 
Share this answer
 
Comments
BBBwex 20-Jul-12 18:53pm    
Thanks, the 1st one would perfect, just dVar = Convert.Todouble(sVar) and use that Math.Round(dVar, 2)in the comparison between last and current position

nice 1
R. Giskard Reventlov 20-Jul-12 18:58pm    
Cool! Hit me with some points, baby! :-)
BBBwex 20-Jul-12 19:45pm    
Not sure what u mean with the points thing, but gave your reply 5 stars..
R. Giskard Reventlov 20-Jul-12 21:07pm    
That's like oxygen on this site! :-)
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900