mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Gracefully handle infinite MND for oxygen
When breathing pure oxygen and considering it not narcotic, there is not maximal narcotic depth and the formula divides by zero. So better, handle this case separately. Fixes #3080 Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
78da1869ce
commit
10bedf02d0
2 changed files with 6 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
- core: Gracefully handle infinte MND for oxygen
|
||||||
- mobile: add location service warning as required by Google Play
|
- mobile: add location service warning as required by Google Play
|
||||||
- mobile: fix manually adding dives in the past [#2971]
|
- mobile: fix manually adding dives in the past [#2971]
|
||||||
|
|
||||||
|
|
|
@ -3253,7 +3253,11 @@ depth_t gas_mnd(struct gasmix mix, depth_t end, const struct dive *dive, int rou
|
||||||
int maxambient = prefs.o2narcotic ?
|
int maxambient = prefs.o2narcotic ?
|
||||||
(int)lrint(ppo2n2.mbar / (1 - get_he(mix) / 1000.0))
|
(int)lrint(ppo2n2.mbar / (1 - get_he(mix) / 1000.0))
|
||||||
:
|
:
|
||||||
(int)lrint(ppo2n2.mbar * N2_IN_AIR / get_n2(mix));
|
get_n2(mix) > 0 ?
|
||||||
|
(int)lrint(ppo2n2.mbar * N2_IN_AIR / get_n2(mix))
|
||||||
|
:
|
||||||
|
// Actually: Infinity
|
||||||
|
1000000;
|
||||||
rounded_depth.mm = (int)lrint(((double)mbar_to_depth(maxambient, dive)) / roundto) * roundto;
|
rounded_depth.mm = (int)lrint(((double)mbar_to_depth(maxambient, dive)) / roundto) * roundto;
|
||||||
return rounded_depth;
|
return rounded_depth;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue