Just directly mainpulate the maintissa of the float.
In base 10 floaing point, a fraction is represented by a/10 + b/100 + c/1000 + d/1000 .... + z/10^n where a,b,c,d...z are numbers 0-9 and n is the number of decimal places in the fraction
Likewise In IEEE-754 32 bit floating point format (what AB PLCs use) the fractional part of the number is represented in the same way, except it is in base 2. The fractional part is a/2 + b/4 + c/8 + d/16 ....+ z/2^n where a, b, c, d,...z are binary numbers, 0 or 1, and n is the number of binary decimal places.
So, all we have to do is figure out where the fractional part of the number begins in the 32 bit float and clear all the bits in the fraction. And as luck would have it, the IEEE-754 floating point format tells us where the fraction part begins for any particular value - since it is binary we simply extract the exponent and keep that many bits of the mantissa and clear all the rest.
Here is a program that does just that.
(It helps to have an understanding of the
IEEE-754 format to follow this program)
Its not the one-liner you were hoping for, but it's a nice general application that truncates any float - and it does it in 4 rungs.
EDIT: This program truncates, it does not round. If you want rounding then add 0.50 to the float before truncating it.
Thus 16.5001 would become 17.001 which truncates to 17 and 35.4 would become 35.9 which truncates to 35.