The domain-to-range ratio (DRR) is a ratio which describes how the number of outputs corresponds to the number of inputs of a given logical function or software component. The domain-to-range ratio is a mathematical ratio of cardinality between the set of the function's possible inputs (the domain) and the set of possible outputs (the range). For a function defined on a domain, formula_1, and a range, formula_2, the domain-to-range ratio is given as:formula_3It can be used to measure the risk of missing potential errors when testing the range of outputs alone.
Example.
Consider the function codice_1 below, which checks the parity of an unsigned short number formula_4, any value between formula_5 and formula_6, and yields a boolean value which corresponds to whether formula_4 is even or odd. This solution takes advantage of the fact that integer division in programming typically rounds towards zero. 
bool isEven(unsigned short x) {
 return (x / 2) == ((x + 3)/2 - 1);
Because formula_4 can be any value from formula_5 to formula_10, the function's domain has a cardinality of formula_6. The function yields formula_5, if formula_4 is even, or formula_14, if formula_4 is odd. This is expressed as the range formula_16, which has a cardinality of formula_17. Therefore, the domain-to-range ratio of codice_1 is given by:formula_18Here, the domain-to-range ratio indicates that this function would require a comparatively large number of tests to find errors. If a test program attempts every possible value of formula_4 in order from formula_5 to formula_10, the program would have to perform formula_22 tests for each of the two possible outputs in order to find errors or edge cases. Because errors in functions with a high domain-to-range ratio are difficult to identify via manual testing or methods which reduce the number of tested inputs, such as orthogonal array testing or all-pairs testing, more computationally complex techniques may be used, such as fuzzing or static program analysis, to find errors.
References.
 ;templatestyles src="Reflist/styles.css" / ;