changeset 524:6fa776a44768

BUGFIX spurious random NDL>0 during deco dive.
author JeanDo
date Fri, 09 Dec 2011 20:43:50 +0100
parents 48bbb1a81027
children f9a03808dfe2
files code_part1/OSTC_code_c_part2/p2_deco.c code_part1/OSTC_code_c_part2/p2_deco.o
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Fri Dec 09 20:43:46 2011 +0100
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Fri Dec 09 20:43:50 2011 +0100
@@ -1771,8 +1771,10 @@
             }
 
             //---- ELSE make a linear approx for the last minute
-            // Usefull to have a meneaingfull rounding of NDL
-            ndl += (unsigned char)(0.5f + (M0-t)/(dTN2+dTHe));
+            // Usefull to have a meaningfull rounding of NDL.
+            // But ONLY it positive (negativ casted to unsigned is bad).
+            if( M0 > t )
+                ndl += (unsigned char)(0.5f + (M0-t)/(dTN2+dTHe));
             break;
         }
 
Binary file code_part1/OSTC_code_c_part2/p2_deco.o has changed