I am writing a program in C.

Is there any way of determining the number of decimal places
in a float number (i.e. `0.123 = 3`, `0.123456 = 6` etc.)?

Other than converting the number to a string and using string
functions to pull the characters after the decimal place?

I have a function named computeFare()

```
float computeFare()
{
  totalFare =  (3.40 + basicFare) * (1 + surchargePercent);
  return totalFare; // **in this case totalFare = 34.567**
}

printf("Total fare is $%.2f\n", 
            computeFare());

```

Result : Total fare is $34.56

I did this and it returned 34.56...
I want it to be $34.57

Thanks,
Lawrence.