How can i can calaulate this in c? :
float x = 5;
float y = 4.999
float z = x-y; // 0.001000
Now i want z to be exactly 3 digits after the point, so that z will be = 0.001.
I don't need to print z, i just need to initialize it with 0.001.
How can i can calaulate this in c? :
float x = 5;
float y = 4.999
float z = x-y; // 0.001000
Now i want z to be exactly 3 digits after the point, so that z will be = 0.001.
I don't need to print z, i just need to initialize it with 0.001.
Use the integer datatype and transform all numbers to a multiply of 1000
int x = 5000
int y = 4999
int z = x-y // 1