I am trying to store coordinate points in a double variable. It is very simple. I have x and y coordinates. My double variable stores them like that x.y . When I tried to convert this value into separate coordinates, I had some troubles.
I have tried these codes but still get same error.
//First try
double temp=memory.pop();
int x=(int)temp;
int y=(int)((temp-(int)temp)*100);
//Second try
double temp=memory.pop();
int x=(int)temp;
int y=100.0f*temp-(((int)temp)*100.0f);
In temp variable, I have 5.14 double number. After calculations, x should be 5 and y should be 14. However, x become 5, y become 13.