双人或C#中的十进制纬度/经度值 [英] Double or decimal for latitude/longitude values in C#

查看:191
本文介绍了双人或C#中的十进制纬度/经度值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是C#存储geopositional数据时使用的最佳数据类型?为它的正确性,但十进制浮点数运算速度较慢然后二进制浮点数字(双)我会使用十进制。

What is the best data type to use when storing geopositional data in C#? I would use decimal for it's exactness, but operations on decimal floating point numbers are slower then binary floating point numbers (double).

我读到的大部分时间,你赢了'T需要更多的那么精确6或7位数纬度或经度。请问双打的不精确甚至事那么还是可以忽略?

I read that most of the time you won't need any more then 6 or 7 digits of precision for latitude or longitude. Does the inexactness of doubles even matter then or can it be ignored?

推荐答案

去双,有几个原因。


  • 三角函数仅适用于双

  • 的双精度远远超出你永远需要什么对于纬度/经度值

  • 第三方模块(如 DotSpatial )也使用了双坐标

  • Trigonometric functions are available only for double
  • Precision of double is far beyond anything you'll ever require for Lat/Lon values
  • Third-Party modules (e.g. DotSpatial) also use double for coordinates

这篇关于双人或C#中的十进制纬度/经度值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆