View Single Post
Old 07-06-2008, 07:23 PM   #4 (permalink)
ShotgunSnipist
Zune Guardian
 
ShotgunSnipist's Avatar
 
Join Date: May 2008
Location: Colorado
Posts: 738
Reputation: 73
Send a message via AIM to ShotgunSnipist
Default

Quote:
Originally Posted by SimReality View Post
Welcome to floating point inaccuracy. On any computer that works in binary you will always see this when doing floating point arithmetic. The only way to solve it is use integers . Something like:

int myVolume = 100;
MediaPlayer.Volume = myVolume / 100f;
string volume = "Volume: " + myVolume + "%";

Then you'll always see an even number displayed as a percentage of the volume. But basically when it comes to floating point math on a computer, you are never guaranteed for it to be exact. That's just how it is.
Thanks!
Worked awesome!

Quote:
Originally Posted by Tiptup300 View Post
And for the record .9 repeating == 1
If you did mean to put == (2 of them) there,
Yes I suppose that would work...
But that's a hell of a lot of code because it did it for every increment.
__________________
Invisible Text. =P
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



ShotgunSnipist is offline   Reply With Quote