Search code examples
cdoubledigits

Given a double, need to find how many digits in total


I have a double which is not necessarily positive but usually. It can be 0.xxxx000 or X.xxxx00000 or XX.00000 or 0.xxx0xxx00000, where eventually there are all 0's to the right of the last number. I need to keep track of how many digits there are. I've been having trouble with this, any help? This is C.


Solution

  • Use sprintf to turn it into a string and do whatever counting/testing you need to do on the digits