Patent ID: 8370822

Claim:
A computer-implemented method for compiling source code into object code, comprising: identifying, from the source code, a math function invocation; determining a selection criterion of the math function invocation based on a compiler-specific data type of an 1-value of the math function invocation, the selection criterion specifying that an accuracy requirement of the math function invocation, as measured in number of bits specified in the compiler-specific data type, is less than an accuracy of the math function being invoked, wherein the math function is stored in a math library; determining, based on the selection criterion, that one or more instructions from a compiler library are configured to perform a mathematical calculation corresponding to the math function less accurately than the math function, wherein an accuracy of the mathematical calculation satisfies the accuracy requirement specified by the selection criterion; and in response to the determining, replacing the math function invocation with the one or more instructions, including storing the one or more instructions inline in the object code, wherein, upon execution of the object code, the one or more instructions are executed in place of invoking the math function from the math library.