|
-
Apr 20th, 2004, 11:22 AM
#1
Thread Starter
Frenzied Member
Float Size
Maybe I am tired or something. But I cant figure out how to do this easily. If I have a float how can I tell its whole number size or places.
Example:
9 = 1 place
93 = 2 places
934 = 3 places
9349 = 4 places
93490 = 5 places
and so on.
I figure I could convert it to a string then get the length, but that seems like to much work. Anyone got a better idea?
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Apr 20th, 2004, 03:29 PM
#2
Thread Starter
Frenzied Member
Well I got this, unless someone has something better;
Code:
float f = 1235.00;
float t = f;
int i = 0;
while(t >= 1)
{
t = t / 10;
i++;
}
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Apr 21st, 2004, 01:44 AM
#3
Don't know if taking the log to base 10 is better.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
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
|