Hi folks,

I am working with the attiny and the float library uses about 1/3 of the program space.

I just need to display a decimal value (a result of a division) on a LCD. Any thoughts?

Regards

Hi folks,

I am working with the attiny and the float library uses about 1/3 of the program space.

I just need to display a decimal value (a result of a division) on a LCD. Any thoughts?

Regards

Think fixed point and use ints and longs.

If the division is A/B where A and B are integers, the integer part of the result is just A/B. If you want to display two decimal places, multiply the remainder of the division by 100 and divide by B again. ((A%B)*100)/B. The only thing you need to be careful of is that there might be a leading zero in the fraction, e.g. the full answer might be 23.05. For a different number of decimal places just adjust the multiplication by 100 to, for example, 10 for one decimal place.

Pete