mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Use lrint() for all degrees_t related rounding
In certain places the '(int)' cast is used, while in other the llrint() or lrint() functions. Make the conversation from degrees in the 'double' form to the 'int' degrees_t consistent using lrint(). lrint() is the function which should give the best results, because it accepts a 'double' and results in a 'long' even if degrees_t is 'int'. If the truncation from 'long' to 'int' is discarding some of the precision then the next step would be to turn degrees_t into a 64bit signed integer type. Possible fix for #625. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
f5f2754b81
commit
56e755b711
5 changed files with 18 additions and 18 deletions
|
@ -201,8 +201,8 @@ void MapWidgetHelper::copyToClipboardCoordinates(QGeoCoordinate coord, bool form
|
|||
bool savep = prefs.coordinates_traditional;
|
||||
prefs.coordinates_traditional = formatTraditional;
|
||||
|
||||
const int lat = llrint(1000000.0 * coord.latitude());
|
||||
const int lon = llrint(1000000.0 * coord.longitude());
|
||||
const int lat = lrint(1000000.0 * coord.latitude());
|
||||
const int lon = lrint(1000000.0 * coord.longitude());
|
||||
const char *coordinates = printGPSCoords(lat, lon);
|
||||
QApplication::clipboard()->setText(QString(coordinates), QClipboard::Clipboard);
|
||||
|
||||
|
@ -215,8 +215,8 @@ void MapWidgetHelper::updateCurrentDiveSiteCoordinates(quint32 uuid, QGeoCoordin
|
|||
MapLocation *loc = m_mapLocationModel->getMapLocationForUuid(uuid);
|
||||
if (loc)
|
||||
loc->setCoordinate(coord);
|
||||
displayed_dive_site.latitude.udeg = llrint(coord.latitude() * 1000000.0);
|
||||
displayed_dive_site.longitude.udeg = llrint(coord.longitude() * 1000000.0);
|
||||
displayed_dive_site.latitude.udeg = lrint(coord.latitude() * 1000000.0);
|
||||
displayed_dive_site.longitude.udeg = lrint(coord.longitude() * 1000000.0);
|
||||
emit coordinatesChanged();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue