Disable round decimals.

Hi everybody. I´m trying to make a counter with 2 decimals. I have used a float variable but there is a problem, when the number is bigger than 50000.00, it starts to round decimals and I can't write 50000.01 for example. I need to avoid this, could anybody help me please?
I have used lcd.print(totalizer, 2); so is not a lcd.print problem.

Thank you.

Read the how to use this forum-please read stickies and post your code.

Obasoa:
Hi everybody. I´m trying to make a counter with 2 decimals. I have used a float variable but there is a problem, when the number is bigger than 50000.00, it starts to round decimals and I can't write 50000.01 for example. I need to avoid this, could anybody help me please?
I have used lcd.print(totalizer, 2); so is not a lcd.print problem.

Thank you.

You have come across one of the limitations of the float datatype: it is not good for large precise numbers.

What are you trying to count, and in what way are you trying to count it?

Clearly, you are not just trying to count (as in 1, 2, 3, 4, ...), because if you were, then you would not need decimals, and therefore would not see this problem.

Multiply all values by 100 and use a “long int”. To display:

void PrintFixedPoint(long number)
{
  Serial.print(number/100);
  Serial.print('.'); // Decimal point
  int decimal = number % 100;
  if (decimal < 10)
    Serial.print('0');  // Add leading 0 on decimal part.
  Serial.print(decimal);
}