Double or decimal for latitude/longitude values in C#

前端 未结 4 1560
臣服心动
臣服心动 2020-12-24 04:02

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

4条回答
  •  甜味超标
    2020-12-24 05:02

    Go for double, there are several reasons.

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

提交回复
热议问题