mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix potential double/float to int rounding errors
Not using lrint(f) when converting double/float to int creates rounding errors. This error was detected by TestParse::testParseDM4 failure on Windows. It was creating rounding inconsistencies on Linux too, see change in TestDiveDM4.xml. Enable -Wfloat-conversion for gcc version greater than 4.9.0 Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
This commit is contained in:
parent
406e4287eb
commit
2b06a0b223
20 changed files with 109 additions and 100 deletions
|
@ -129,8 +129,8 @@ static void uemis_add_string(const char *buffer, char **text, const char *delimi
|
|||
static void uemis_get_weight(char *buffer, weightsystem_t *weight, int diveid)
|
||||
{
|
||||
weight->weight.grams = uemis_get_weight_unit(diveid) ?
|
||||
lbs_to_grams(ascii_strtod(buffer, NULL)) :
|
||||
ascii_strtod(buffer, NULL) * 1000;
|
||||
lbs_to_grams(ascii_strtod(buffer, NULL)) :
|
||||
lrint(ascii_strtod(buffer, NULL) * 1000);
|
||||
weight->description = strdup(translate("gettextFromC", "unknown"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue