flt2i32 — signed fractional number conversion into appropriate form for comparison operators.


i32 flt2i32(u32 value);

Returns signed fractional value converted to the form applicable for comparison operators (for example: converts fractional -20.5 into integer -5248). Later the obtained figure is possible to be used in comparison with data received from sensors.

List of parameters:


Unsigned fractional (fractional part is separated by a dot) Only literal.

Return values:

Returns signed integer. Type of return value u32.


<import-script id="512" TS="512:32" name="Test for flt2i32 function">
	i32 ms = flt2i32(-1.52);
	u8 strForMess[70]; 

	if([TS] > ms) 
		sprintf(strForMess, "%c%d > %d", 1, [TS], ms);
		if([TS] == ms) 
			sprintf(strForMess, "%c%d = %d", 1, [TS], ms);
			sprintf(strForMess, "%c%d less %d", 1, [TS], ms);

	setStatus(2023:32, &strForMess);


The result of performing the example in the interface:

The message where the values of temperature sensor are compared with the value -1.52 is displayed in the interface every two seconds.


Only literal (figure not a variable) can be the parameter lvalue.