diff options
author | Jeremie Guichard <djebrest@gmail.com> | 2017-03-09 23:07:30 +0700 |
---|---|---|
committer | Jeremie Guichard <djebrest@gmail.com> | 2017-03-09 23:07:30 +0700 |
commit | 2b06a0b2234cf2779f80e87038011067be282bcb (patch) | |
tree | 7532b11736a5eaedb3ceddf3e85ee423948d47ce /core/save-html.c | |
parent | 406e4287eb96e10ddfd22163f0e863e353470c68 (diff) | |
download | subsurface-2b06a0b2234cf2779f80e87038011067be282bcb.tar.gz |
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>
Diffstat (limited to 'core/save-html.c')
-rw-r--r-- | core/save-html.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/save-html.c b/core/save-html.c index 4f811558a..66472fdfc 100644 --- a/core/save-html.c +++ b/core/save-html.c @@ -127,7 +127,7 @@ static void put_cylinder_HTML(struct membuffer *b, struct dive *dive) if (cylinder->type.size.mliter) { int volume = cylinder->type.size.mliter; if (prefs.units.volume == CUFT && cylinder->type.workingpressure.mbar) - volume *= bar_to_atm(cylinder->type.workingpressure.mbar / 1000.0); + volume = lrint(volume * bar_to_atm(cylinder->type.workingpressure.mbar / 1000.0)); put_HTML_volume_units(b, volume, "\"Size\":\"", " \", "); } else { write_attribute(b, "Size", "--", ", "); |