Patent ID: 7269718

Claim:
A method in a processor in a data processing system for performing arithmetic operations on data, the method comprising: responsive to a request for an arithmetic operation on data in a memory location, determining whether the arithmetic operation requires the data to have a required data type; responsive to the arithmetic operation requiring the required data type, identifying a data type for the data to form an identified data type, wherein the data type for the data is specified in metadata that is associated with the data and wherein the metadata is generated by a compiler that identifies the data type in the metadata; determining whether the arithmetic operation can be performed as a legal operation based on the identified data type and the required data type, wherein the metadata generated by the compiler specifies which arithmetic operations are legal on the types of data; responsive to an inability to perform the arithmetic operation as the legal operation, determining whether data can be cast to change the identified data type to the required data type, wherein the metadata generated by the compiler specifies rules for changing the identified data type to the required data type; responsive to determining that the data can be cast to change the identified data type to the required data type, casting the data to the required data type; and performing the arithmetic operation on the modified data, wherein the processor performs the arithmetic operations with casting of the data.