Thank you for the bugs report.
We have just released firmware version F91.1 which made some important improvement to the PLC's handling of client connection to the 3rd party Modbus TCP server. The reported issue with VAL(" -123.45") where a leading white space causes the negative sign to be ignored by the PLC is also fixed at the same time.
Please follow the upgrade path you received from us to upgrade the firmware.
As for the return type of VAL, Gary is right that the PLC will determine the returned type based on whether the string contains expression of floating point. If so it will return a floating point number and then it is assigned to the variable. If the variable is an integer variable and the converted data is floating point, then the floating point will be type cast into an integer (basically dropping the fractional portion after the decimal point) and assigned to the variable.
However, if the string contains no sign of floating point it will then try to convert it into an integer and depends on whether the variable assigned to receive the converted number is integer or floating point, it will be type cast into that particular format.
In order to maintain 100% backward compatibility to the integer-only i-TRiLOGI (version 6, for FMD and Nano-10 PLCs) integer data and floating point data are represented separately. Not all numeric values are automatically handled as floating point during computation. If you want only integer math, then make sure that the terms involved in a binary operation are all integers and the PLC will perform integer operations only.
E.g F# = 100/24 = 4 ' expression are all integers. So integer divide is used.
G# = 100/24.0 = 4.16667 ' there is floating point number (24.0) so floating point division is performed.