Hello,
In c++, is there a way to determine the number of decimal places that a variable of type "long double" has?
I'd prefer not to convert to a string to do this (if possible).
Thanks!
Printable View
Hello,
In c++, is there a way to determine the number of decimal places that a variable of type "long double" has?
I'd prefer not to convert to a string to do this (if possible).
Thanks!
maybe u could google for sizeoff(), im not sure since im not fully understanding ur request
He's asking for a floating point number such as 23.769, how to determine how many decimal places there are.
I don't know of a reliable way.
It has as many decimal places as you ask it to have when you print it out. How many of those are simply trailing 0s....that's another problem.
You could convert it to a string and simply remove the last zero's.