comparison code_part1/OSTC_code_c_part2/p2_deco.c @ 524:6fa776a44768

BUGFIX spurious random NDL>0 during deco dive.
author JeanDo
date Fri, 09 Dec 2011 20:43:50 +0100
parents 48bbb1a81027
children 31db81de1d4f
comparison
equal deleted inserted replaced
523:48bbb1a81027 524:6fa776a44768
1769 period = 1; 1769 period = 1;
1770 continue; 1770 continue;
1771 } 1771 }
1772 1772
1773 //---- ELSE make a linear approx for the last minute 1773 //---- ELSE make a linear approx for the last minute
1774 // Usefull to have a meneaingfull rounding of NDL 1774 // Usefull to have a meaningfull rounding of NDL.
1775 ndl += (unsigned char)(0.5f + (M0-t)/(dTN2+dTHe)); 1775 // But ONLY it positive (negativ casted to unsigned is bad).
1776 if( M0 > t )
1777 ndl += (unsigned char)(0.5f + (M0-t)/(dTN2+dTHe));
1776 break; 1778 break;
1777 } 1779 }
1778 1780
1779 // Keep the shortest NDL found 1781 // Keep the shortest NDL found
1780 if( ndl < char_O_nullzeit ) 1782 if( ndl < char_O_nullzeit )