Sure, and that value is a double. Therefore, it has, by definition, a fractional part.
That you do not see the fractional part means that whatever code is showing you the value is doing so in a way other than what you want. But, we can't see that code.
float averageTemp; // create a float to hold running average
for (int i = 1; i < 1000; i++) // start at 1 so we dont divide by 0
  averageTemp += ((Temp - averageTemp)/(float)i); // get next sample, calculate running average
This code doesn't do anything useful.
The declaration of averageTemp will cause it to be initialized with a random value which makes the for loop start its "running average" with a random value.
The for loop uses the same value of Temp every time so it is not generating a running average.
The first thing that you need to do is get rid of the int() part. The, you may or may not actually be able to do what you want. Again, we can't help because we have no idea what class the vfd object is an instance of.
float averageTemp; // create a float to hold running average
for (int i = 1; i < 1000; i++) // start at 1 so we dont divide by 0
  averageTemp += ((Temp - averageTemp)/(float)i); // get next sample, calculate running average
This code doesn't do anything useful.
The declaration of averageTemp will cause it to be initialized with a random value which makes the for loop start its "running average" with a random value.
The for loop uses the same value of Temp every time so it is not generating a running average.
Pete
If the Ncr4X20Vfd class derives from Print, then adding a 2nd argument to the vfd.print() call will allow you to specify the number of decimal places.
vfd.print(Thermister(analogRead(1)), 1);
should show one decimal place.
The Client class does derive, at least indirectly, from the Print class, so the optional 2nd argument CAN be used to limit (or increase) the number of decimal places.
float averageTemp; // create a float to hold running average
for (int i = 1; i < 1000; i++) // start at 1 so we dont divide by 0
  averageTemp += ((Temp - averageTemp)/(float)i); // get next sample, calculate running average
This code doesn't do anything useful.
The declaration of averageTemp will cause it to be initialized with a random value which makes the for loop start its "running average" with a random value.
The for loop uses the same value of Temp every time so it is not generating a running average.
Pete
How about this,
I just split it back into two classes so "Temp" would change on every evaluation.
/*
Thermistor Function, Read thermistor and return a value in deg. F /
double Thermister(int RawADC) {
double Temp;
Temp = log(((10240000/RawADC) - 10000));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp )) Temp );
Temp = Temp - 273.15; // Convert Kelvin to Celcius
Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
return Temp;
}
/*
avrage temp sensor reading
*/
float AvrageTemp(int analog_pin){
float averageTemp; // create a float to hold running average
for (int i = 1; i < 1000; i++) // start at 1 so we dont divide by 0
averageTemp += ((Thermister(analog_pin) - averageTemp)/(float)i); // get next sample, calculate running average
return averageTemp; // return average temperature reading
}
el_supremo:
You still need to do this so that the initial value of averageTemp isn't random.
float averageTemp = 0; // create a float to hold running average
But I don't understand what that for loop does. If you want the average of a thousand consecutive readings then that loop doesn't do it.
My understanding was if it was not defined it would be 0.
I got the code from another sketch, my understanding was it was to be averaging the result over a thousand readings.
What is wrong with it? / the proper way would be?
convert a float value to a nul-terminated array of characters with one digit to the right of the decimal point?
At this time I have no idea what a "nul-terminated array of characters" is exactly...
My original request was just to get my value from the Thermister() function to show one digit after the decimal point. This was accomplished with a proper print statement.
And in doing that the incorrect code was mentioned regarding the averaging of the sensor reading. So the thread has kinda split....
We can try to find out what it does by seeing what it actually calculates after the first few times round the loop.
float AvrageTemp(int analog_pin){
float averageTemp = 0; // create a float to hold running average
for (int i = 1; i < 1000; i++) // start at 1 so we dont divide by 0
averageTemp += ((Thermister(analog_pin) - averageTemp)/(float)i); // get next sample, calculate running average
return averageTemp; // return average temperature reading
}
To make this briefer for me to type I'll refer to the avergeTemp calculated when at step i as just avgi (e.g. avg1, avg2 etc) and the sequence of Thermistor readings as T1, T2, etc.
In my version, avg0 is initialized to zero.
Therefore the result of avg1 = (T1 - avg0)/1 = T1. This one is correct. The average of one reading is just that reading.
Step 2: avg2 = (T2 - avg1)/2 = (T2 - T1)/2. This is clearly wrong. The average of the two values should be (T2 + T1)/2
Step 3: avg3 = (T3 - avg2)/3 = (T3 - (T2 - T1)/2)/3 = ( 2T3 - T2 + T1)/6. Nope.
Step 4: avg4 = (T4 - avg3)/4 = (T4 - (2T3 - T2 + T1)/6) / 4 = (6T4 - 2T2 + T2 - T1)/24. It's getting worse.
If you assume that all the readings are identical and equal a value T, then at any step of the loop it should produce the value T as the average but after step four, if each Ti = T, then the result of the fourth step is T/6. Not even close to the average.
So, what is wrong with it is that it doesn't compute an average - "running" or otherwise.
There's also one other minor booboo in the code. The for loop only goes round 999 times - not 1000
/ the proper way would be?
If it is supposed to produce the average of one thousand consecutive readings then it could be done like this:
float AvrageTemp(int analog_pin){
 // Holds the average
 float averageTemp = 0;
 // Calculate the average of one thousand consecutive readings of the thermistor
 for (int i = 0; i < 1000; i++) {
  averageTemp += Thermister(analog_pin)/1000.;
 }
 // return average temperature reading
 return averageTemp;
}