mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Do proper rounding in interpolated pressure calculations
We do all the pressures in mbar, which has plenty of precision for interpolated pressures - even when we then do our discrete integration over many samples. However, when we calculate those interpolated pressure points, we should make sure that we round the result correctly, otherwise the consistent rounding errors (from truncating the FP value into our integer mbar values) will result in a final pressure that is noticeably off in ugly ways (ie "end pressure set by hand to 750 mbar, but shown as 748"). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
bb421a416d
commit
a643e740dc
1 changed files with 1 additions and 1 deletions
|
@ -1001,7 +1001,7 @@ static void fill_missing_tank_pressures(struct dive *dive, struct plot_info *pi,
|
|||
double cur_pt = (entry->sec - (entry-1)->sec) *
|
||||
(1 + (entry->depth + (entry-1)->depth) / 20000.0);
|
||||
INTERPOLATED_PRESSURE(entry) =
|
||||
cur_pr[entry->cylinderindex] + cur_pt * magic;
|
||||
cur_pr[entry->cylinderindex] + cur_pt * magic + 0.5;
|
||||
cur_pr[entry->cylinderindex] = INTERPOLATED_PRESSURE(entry);
|
||||
} else
|
||||
INTERPOLATED_PRESSURE(entry) = cur_pr[entry->cylinderindex];
|
||||
|
|
Loading…
Add table
Reference in a new issue