Array values reliably become zero when they shouldn't

I am trying to some fairly simple statistical calculations on some data that is being fed to the rabbit board via serial port C. The program is supposed to read in the data from a pressure sensor and calculate running averages, standard deviations, and min/max. All data is to be stored in an 8 x 6 array of floats called dataset and the number of data points is stored in a 8 member, 1 dimensional array of unsigned longs called datanumber.

The problem comes in when I try to do the actual statistical calculations.

In the code below, when dataset[statrect_chan ][0] is displayed for the first time, the correct value is shown. The same is true for dataset[statrect_chan][1].

However, when I try to store these values in some float variables, namely statrect_temptot, and statrect_tempavg, the value that gets stored and subsequently displayed is zero in both of them.

The same thing was happening when I was just using the arrays themselves to find the average. What gives? How can the values stored in the array just go to zero?

textout is just a display function, you could replace it with serBputs and there’d be no change to the output.

I’m using Dynamic C Dist 8.10 and a BL1800.

	   sprintf(statrect_outstr, "Ch%d: %.2f 
", statrect_chan + 1, dataset[statrect_chan ][0]);
	   dataset[statrect_chan][1] = dataset[statrect_chan][1] + dataset[statrect_chan][0];

	   sprintf(statrect_outstr, "Ch%d total: %.2f 
", statrect_chan + 1, dataset[statrect_chan][1]);

	   statrect_tempn = ++datanumber[statrect_chan];
      sprintf(statrect_outstr, "statrect_tempn: %.2f 
", statrect_tempn);

      statrect_temptot = dataset[statrect_chan][1];
      sprintf(statrect_outstr, "statrect_temptot: %.2f 
", statrect_temptot);

      statrect_tempavg = statrect_temptot/statrect_tempn;
      sprintf(statrect_outstr, "statrect_avg: %.2f 
", statrect_tempavg);