-
January 29th, 2010, 11:39 AM
#1
Number of decimal places
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!
-
January 29th, 2010, 11:48 AM
#2
Re: Number of decimal places
maybe u could google for sizeoff(), im not sure since im not fully understanding ur request
-
January 29th, 2010, 11:58 AM
#3
Re: Number of decimal places
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.
-
January 29th, 2010, 12:02 PM
#4
Re: Number of decimal places
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.
-
January 29th, 2010, 12:05 PM
#5
Re: Number of decimal places
You could convert it to a string and simply remove the last zero's.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|