seperating a decimal
How would one seperate a decimal into 2 numbers, the left and right sides of the decimal?
float example = 131.14567
into...
int left = 131
float right = .14567
thanks.
Nemoticchigga
Junior Poster in Training
98 posts since Feb 2008
Reputation Points: 10
Solved Threads: 2
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
One option is something like:
float in = 131.14567f;
int left = (int)in;
float right = left - in;
Nick Evan
Not a Llama
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
Stop indulge in fantasies. See iamthwee's exhaustive answer...
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348