Okay so basically, what I want to do, is convert the decimal part of number(678.5123) which is 0.5123 into a whole number(5123). However, if you run the code yourself, you'll see that it stops and it outputs 51229999999 etc. Basically, it's wrong, and I don't know why. Any insights as to where I screwed up and why would be very much appreciated.
#include <stdio.h>
#include <math.h>
int main()
{
int omg, numTimes = 10;
double thisIs, holderThis, number = 678.5123;
thisIs = number - floor(number);
printf("%lf\n", thisIs);
int x = (floor(thisIs) == thisIs);
while (x != 1)
{
x = (floor(thisIs) == thisIs);
thisIs *= 10;
printf("%lf %lf\n", thisIs, floor(thisIs);
}
while(number - floor(number) != 0)
number *= 10.00;
printf("%lf", thisIs);
return 0;
}