changeset 264:d9593e0f1eea

Safer rounding (bug bb29)
author JeanDo
date Tue, 12 Apr 2011 00:36:23 +0200
parents 27c9bb14b008
children ab8ce7de2b46
files code_part1/OSTC_code_c_part2/p2_deco.c code_part1/OSTC_code_c_part2/p2_deco.o
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Mon Apr 11 11:47:00 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Tue Apr 12 00:36:23 2011 +0200
@@ -699,10 +699,10 @@
         if( sim_lead_tissue_limit > pres_surface )
         {
             // Deepest stop, in meter (rounded up with a margin of 0.5m)
-            overlay unsigned char first_stop = 3 * (short)(0.99 + (sim_lead_tissue_limit - pres_surface) / 0.29955);
+            overlay unsigned char first_stop = 3 * (short)(1.1667 + (sim_lead_tissue_limit - pres_surface) / 0.29955);
             assert( first_stop < 128 );
 
-#ifdef __DEBUG || defined(CROSS_COMPILE)
+#if defined(__DEBUG) || defined(CROSS_COMPILE)
             {
                 // Extra testing code to make sure the first_stop formula
                 // and rounding provides correct depth:
Binary file code_part1/OSTC_code_c_part2/p2_deco.o has changed