Patent ID: 6748587
Filing Date: 2004-06-08
Classification: G06F

Abstract:
A method for enabling access in the C programming language to the widest mode floating-point arithmetic supported by a processor, wherein the processor can transfer data between memory and its floating-point registers without loss of range or precision, the method comprising the steps of:(a) defining â€œ_fpregâ€  as a floating-point data type having a memory representation that has range and precision at least as great as said floating-point registers; (b) declaring selected operands to be of the floating-point data type, said selected operands specified in C source code on which floating-point arithmetic is to be performed, said selected operands including arguments and return values of inline assembly intrinsics used to embed floating-point instructions into the source code; (c) compiling the source code into corresponding object code; (d) executing the object code; (e) performing said floating-point arithmetic, said step (e) including the substep of transferring data between memory representations corresponding to said selected operands and said floating-point registers; and (f) converting data types according to type promotion rules when said floating-point arithmetic combines operands having different data types including _fpreg, the promotion rules including hierarchical rules regarding conversion between data types to create data type compatibility between a pair of source operands, the promotion rules including, in order of precedence: (1) if one source operand is of data type _fpreg, convert the other source operand to data type _fpreg; (2) if one source operand is of data type long double, convert the other source operand to data type long double; and (3) if one source operand is of data type double, convert the other source operand to data type double; and wherein rule (2) takes precedence over rule (1) if the memory representation of a long double data type has greater range and precision than said floating-point registers.