Home› Programming
Discussion
Back to discussions page
agiakos
Posts: 15 Apprentice
How to read only the integer part of a variable??? |
53 views
|
Answered | |
/ Most recent by agiakos
in Programming
|
3 comments |

in Programming
Hello comunity,
I made this procedure to read the X position in meters.
Variable3 = get_actual_tcp_pose()
Variable4 = Variable3[0]*1000 %to get an integer part%
After that I want to sent this value to a register and I am writing set_modbus_register(adress,Variable4) but variable4 is not an integer. How can I make it into an integer?
thank you in advance
I made this procedure to read the X position in meters.
Variable3 = get_actual_tcp_pose()
Variable4 = Variable3[0]*1000 %to get an integer part%
After that I want to sent this value to a register and I am writing set_modbus_register(adress,Variable4) but variable4 is not an integer. How can I make it into an integer?
thank you in advance
Best Answer
-
matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,267 Handy
HI,
just copied from the UR-Script Manual:
ceil(f )
floor(f ) Returns largest integer not greater than fReturns the smallest integer value that is not less than f
Rounds floating point number to the smallest integer no greater than f.
Parameters
f: floating point value
Return Value
rounded integer
Rounds floating point number to the largest integer no greater than f.
Parameters
f: floating point value
Return Value
rounded integer