mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-03 15:43:09 +00:00
Prevent overflow in minimum gas calculation
For the "crazy" long and deep dives in "TestPlan" an overflow happened here. Rearranged the calculation to have more margin. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
220d25588f
commit
ce420d7720
1 changed files with 2 additions and 2 deletions
|
@ -899,9 +899,9 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
|
||||||
&& dive->dc.divemode == OC && decoMode() != RECREATIONAL) {
|
&& dive->dc.divemode == OC && decoMode() != RECREATIONAL) {
|
||||||
/* Calculate minimum gas volume. */
|
/* Calculate minimum gas volume. */
|
||||||
volume_t mingasv;
|
volume_t mingasv;
|
||||||
mingasv.mliter = lrint(prefs.problemsolvingtime * prefs.bottomsac * prefs.sacfactor / 100.0
|
mingasv.mliter = lrint(prefs.sacfactor / 100.0 * prefs.problemsolvingtime * prefs.bottomsac
|
||||||
* depth_to_bar(lastbottomdp->depth.mm, dive)
|
* depth_to_bar(lastbottomdp->depth.mm, dive)
|
||||||
+ cyl->deco_gas_used.mliter * prefs.sacfactor / 100.0);
|
+ prefs.sacfactor / 100.0 * cyl->deco_gas_used.mliter);
|
||||||
/* Calculate minimum gas pressure for cyclinder. */
|
/* Calculate minimum gas pressure for cyclinder. */
|
||||||
pressure_t mingasp;
|
pressure_t mingasp;
|
||||||
mingasp.mbar = lrint(isothermal_pressure(&cyl->gasmix, 1.0,
|
mingasp.mbar = lrint(isothermal_pressure(&cyl->gasmix, 1.0,
|
||||||
|
|
Loading…
Reference in a new issue