I want to cast a float into a smaller variable type that will store ##.##

I forgot how to program over the years.
I want to cast floats that this sensor outputs into a variable type that would store temperature as 99.99 and humidity as percent in the similar fashion. How do I accomplish this?

I want to smooth data and this seems to be a very memory efficient way to do this.

I want to cast floats that this sensor outputs into a variable type that would store temperature as 99.99 and humidity as percent in the similar fashion.

Cast them to a float. Oh, wait. What's the purpose? A float is the ONLY data type that can store a non-integral type.

You could convert to fixed point, but that seems to be overkill for this. Stick with floats.

VT91:
I want to smooth data and this seems to be a very memory efficient way to do this.

https://www.google.com/search?q=exponentially+weighted+moving+average

I believe robtillaart has published a library that includes an EWMA implmentation.

temperature as 99.99

Two Decimal place precision!!! and number bust be smaller than 327.67 (for int data type)
for larger numbers with or more decimal places use "long" data type to get max number saved 21,474,836.47

try multiplying by 100 moving the decimal point over!

//
float MyFloat = 99.99999
// to prep for saving
int StoreageInt = (int) MyFloat * 100;

//to retrieve the float:
float MySavedFloat = (float) StoreageInt * .01;

// MySavedFloat will == 99.99

you loose some of the precision but it stores as an integer

KeithRB:
You could convert to fixed point, but that seems to be overkill for this. Stick with floats.

I learned a new term that I googled. I may stick with floats if memory allows me to.