Longitude-Latitude Distance Calculation Using Integer Arithmetic

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing distance calculation methods between two points using longitude and latitude are complicated and suffer from reduced accuracy when floating-point numbers are not available, failing to meet accuracy requirements.

Innovation Solution

A method and apparatus that utilize integer data in the calculation process by combining the haversine formula and CORDIC algorithm to determine a distance, adjusting accuracy based on platform capabilities and requirements, using formulas such as \( a = \frac{dlat^2 \cdot 2^{19} + \cos(lat_1) \cdot \cos(lat_2) \cdot dlon^2 \) and \( distance = 2 \cdot a \cdot 2^{19} \cdot 60 \cdot 60 \cdot 1000 \cdot \pi \cdot r \cdot 100000 \, cm \) to ensure accuracy and efficiency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If traditional distance calculation methods are used, then calculation accuracy can be maintained with floating-point numbers, but calculation complexity increases and floating-point operations are required which are not available on all platforms

Engineering Contradiction:
Improvedistance calculation accuracyVSAvoidalgorithm complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent transforms the distance calculation from using floating-point trigonometric functions to using integer arithmetic with pre-computed lookup tables. The key parameter change is converting continuous floating-point latitude/longitude values into discrete integer indices for table lookup, thereby eliminating the need for complex floating-point operations while maintaining calculation accuracy.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The patent pre-computes and stores trigonometric values (sine, cosine, tangent) and distance coefficients in lookup tables before runtime. This preliminary action allows the actual distance calculation to simply retrieve pre-computed values through integer indexing, avoiding complex real-time calculations and reducing both computational complexity and execution time.

Inventive Principle:
Principle #10Preliminary action

2Measurement precision

If floating-point numbers are used for accurate distance calculation, then measurement precision is improved, but the method becomes incompatible with platforms that cannot use floating-point numbers

Engineering Contradiction:
Improvedistance calculation accuracyVSAvoidplatform compatibility
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

The patent replaces the floating-point arithmetic system with an integer arithmetic system. By substituting floating-point trigonometric calculations with integer-based lookup table operations, the solution achieves the same measurement precision while being compatible with platforms that lack floating-point hardware support, such as embedded systems and microcontrollers.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Solution Approach 2:

The patent introduces lookup tables as an intermediary between the input latitude/longitude values and the final distance calculation. These tables store pre-computed trigonometric relationships, allowing the system to achieve floating-point level accuracy through integer operations, thus bridging the gap between precision requirements and platform limitations.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Measurement precision

If complex trigonometric formulas are used for distance calculation, then accuracy is maintained, but calculation efficiency decreases

Engineering Contradiction:
Improvedistance calculation accuracyVSAvoidcalculation efficiency
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The patent pre-computes all trigonometric values and distance coefficients during system initialization or offline preparation, storing them in lookup tables. This preliminary action shifts the computational burden from runtime to setup time, enabling extremely fast distance calculations during actual use by simply retrieving pre-computed values through integer indexing operations.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent substitutes complex real-time trigonometric calculations with simple integer array indexing and basic arithmetic operations. This substitution replaces computationally intensive mathematical functions with lightweight memory access and integer operations, dramatically improving calculation efficiency while maintaining the same level of accuracy.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentEP4707734A1Method and apparatus for determining distance on basis of longitude and latitude
Publication Date: 2026.03.11 CRSC RESEARCH & DESIGN INSTITUTE GROUP CO LTD
  • EP4707734A1 patent drawingFigure 1~2
  • EP4707734A1 patent drawingFigure 3~4
  • EP4707734A1 patent drawing

AI summary

The present disclosure provides a method and apparatus for determining a distance according to longitude and latitude, a computer-readable storage medium, and an electronic device, and relates to the technical field of distance measurement and calculation. The method includes: obtaining longitude lon1 and latitude lat1 of a first position and longitude lon2 and latitude lat2 of a second position; determining a longitude difference dlon and a latitude difference dlat between the second position and the first position; determining a weight coefficient based on the latitude lat1 of the first position, the latitude lat2 of the second position, the longitude difference dlon, and the latitude difference dlat; and determining a distance between the first position and the second position based on the weight coefficient and an earth radius. The method improves calculation efficiency, and uses integer data in a calculation process on the premise of satisfying an accuracy requirement. This is applicable to the situation that many calculation platforms cannot use floating-point numbers.