ERangeError is an integer math exception. It occurs when
An integer expression value exceeds the bounds of the specified integer type to which it is assigned.Source code attempts to access an item in an array using an index value that is not within the defined array.
ERangeError is raised only if range checking is turned on. To turn on range checking, include the $R+ directive in project source code, or select Project|Options, choose the Compiler tab, and check the Range-checking option in the dialog box.