Autsch... Thanks jcl crazy

Sorry but nobody has teached me computer math. I've taught myself what I know about programming, and sometimes I just miss things.

NEW MINIMAL EXAMPLE
Code
function run() {
		
	int i;
	var my_array[10];
	
	my_array[0] = 1000.0111;
	my_array[1] = 2000.0022;
	my_array[2] = 3000.0003;	
	
	watch("test0 = ",(1000.0111 - my_array[0]) == 0.0);
	watch("test1 = ",(2000.0022 - my_array[1]) == 0.0);
	watch("test2 = ",(3000.0003 - my_array[2]) == 0.0);
	
	for(i=0;i<4;i++) printf("\nmy_array[%i] %f",i,my_array[i]);
	
	quit();
	
}
Quote
file-append-array2 compiling...........
test0 = 1
test1 = 1
test2 = 1
my_array[0] 1000.011108
my_array[1] 2000.002197
my_array[2] 3000.000244
my_array[3] 0.000000
Quit
test0,1,2 are TRUE. I would think, that my printing is wrong - but what is wrong?

If i round 3000.000244 to 4 digits, it is 3000.0002 and not 3000.0003, why the initial zero (0) of my_array[3] stays unchanged and the 3000.0003 changes to 3000.000244?

Even if I ask a simple or stupid question, it would be nice if someone answers ...

Thanks for your help...

Last edited by laz; 08/15/19 14:44.