proper/best type for storing latitude and longitude

前端 未结 13 878
天涯浪人
天涯浪人 2020-12-07 11:21

In a system level programming language like C, C++ or D, what is the best type/encoding for storing latitude and longitude?

The options I see are:

  • IEEE
13条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-07 11:54

    If by "storing" you mean "holding in memory", the real question is: what are you going to do with them?

    I suspect that before these coordinates do anything interesting, they will have been funnelled as radians through the functions in math.h. Unless you plan on implementing quite a few transcendental functions that operate on Deg/Min/Secs packed into a bit field.

    So why not keep things simple and just store them in IEEE-754 degrees or radians at the precision of your requirements?

提交回复
热议问题