An enemy unit is considered to be within range when it is 'close enough' — that is, the distance between the measuring cord and the body of the enemy unit (not the unit's weapon) is less than 5 mm. Even a single millimetre further is regarded as being out of range.
'Close enough' does not apply to the damage radius of Battery unit attacks.