比较2个双精度变量和2个小数 [英] Comparing 2 double variables withing 2 decimals
问题描述
问候,
作为编程的返回者(上次使用Borland Pascal 5.5时是90年代,别再笑了),我想知道比较2位小数内的2个数字最方便的方法.
由于数据的来源是字符串(gps提要),因此我正在考虑做 Convert.ToDouble(sVar ),但不确定如何在此处实现字符串格式.
很长的路要走,就是搜索小数点,然后将接下来的2个数字放在单个字符串中,然后进行 convert.ToInt 进行比较,但是如果可能的话,则需要更少的代码和脑力消耗
任何想法都会受到欢迎,因为如果可以将这部分软件放到这里,这将是我的重返项目.
谢谢,
BBB
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
推荐答案
^ ]可能会有所帮助.
可能此 [
This[^] might help.
As might this[^].
这篇关于比较2个双精度变量和2个小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!