mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix double to int truncation in C++ code
Wfloat-conversion enabled for C++ part of the code Fix warnings raised by the flag using lrint Original issue reported on the mailing list: The ascent/descent rates are sometimes not what is expected. E.g. setting the ascent rate to 10m/min results in an actual ascent rate of 9m/min. This is due to truncating the ascent rate preference, then effectively rounding up the time to reach each stop to 2s intervals. The result being that setting the ascent rate to 10m/min results in 20s to ascend 3m (9m/min), when it should be exactly 18s. Reported-by: John Smith <noseygit@hotmail.com> Reported-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
This commit is contained in:
parent
d83449f3b5
commit
597539ce39
25 changed files with 73 additions and 72 deletions
|
@ -156,8 +156,8 @@ void LocationInformationWidget::acceptChanges()
|
|||
if (!ui.diveSiteCoordinates->text().isEmpty()) {
|
||||
double lat, lon;
|
||||
parseGpsText(ui.diveSiteCoordinates->text(), &lat, &lon);
|
||||
currentDs->latitude.udeg = lat * 1000000.0;
|
||||
currentDs->longitude.udeg = lon * 1000000.0;
|
||||
currentDs->latitude.udeg = (int)(lat * 1000000.0);
|
||||
currentDs->longitude.udeg = (int)(lon * 1000000.0);
|
||||
}
|
||||
if (dive_site_is_empty(currentDs)) {
|
||||
LocationInformationModel::instance()->removeRow(get_divesite_idx(currentDs));
|
||||
|
@ -232,8 +232,8 @@ void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString
|
|||
if (!same_string(qPrintable(text), coords)) {
|
||||
double latitude, longitude;
|
||||
if (parseGpsText(text, &latitude, &longitude)) {
|
||||
displayed_dive_site.latitude.udeg = latitude * 1000000;
|
||||
displayed_dive_site.longitude.udeg = longitude * 1000000;
|
||||
displayed_dive_site.latitude.udeg = (int)(latitude * 1000000);
|
||||
displayed_dive_site.longitude.udeg = (int)(longitude * 1000000);
|
||||
markChangedWidget(ui.diveSiteCoordinates);
|
||||
emit coordinatesChanged();
|
||||
ui.geoCodeButton->setEnabled(latitude != 0 && longitude != 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue