Reputation: 1177
I need to convert a latitude in ddmm.mmmmm (minutes in 4 decimal places) to ddmm.mmmmmm (minutes in 5 decimal places) format. Is there any good formula to convert this ?
Upvotes: 0
Views: 1563
Reputation: 61249
Sans other information I would recommend following mkk's advice.
If you want to convert "ddmm.mmmmm" (4 decimal places) to "ddmm.mmmmm" (5 decimal places), you should probably just add a zero to the end.
Other methods may appear to give a more satisfactory result by placing a non-zero value in the fifth decimal place. But they cannot add more information than was present in the original number. There is, however, the potential to lose information through loss of significance in mathematical calculations.
Upvotes: 0
Reputation: 1177
I got the answer
We need to follow these steps for this conversion 1. Convert value in ddmm.mmmm format to dd.ddddddd by using the following formula dd.ddddddd = dd + ( mm.mmmm / 60 )
convert back ddmm.mmmmm = concat(dd, (.dddddd * 60))
Example:
To convert 3323.8733 from ddmm.mmmm format
convert to degrees (dd.dddd) format 33 + (23.8733 / 60 ) = 33.397888333333334
convert back to ddmm.mmmmm format multiply decimal part by 60 i.e 0.397888333333334 * 60 => 23.87330000000004 append with degree 3323.87330000000004
As we need ddmm.mmmmm we can round of 5 decimal places i.e 3323.87330
Upvotes: 1