Domain-to-range ratio

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).[1][2] For a function defined on a domain, , and a range, , the domain-to-range ratio is given as:It can be used to measure the risk of missing potential errors when testing the range of outputs alone.[3]

Example

Consider the function isEven() below, which checks the parity of an unsigned short number , any value between and , and yields a boolean value which corresponds to whether 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 can be any value from to , the function's domain has a cardinality of . The function yields , if is even, or , if is odd. This is expressed as the range , which has a cardinality of . Therefore, the domain-to-range ratio of isEven() is given by: Here, 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 in order from to , the program would have to perform 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.

See also

References


Retrieved from "https:https://www.search.com.vn/wiki/index.php?lang=en&q=Domain-to-range_ratio&oldid=1227011391"
🔥 Top keywords: Main PageSpecial:SearchPage 3Wikipedia:Featured picturesHouse of the DragonUEFA Euro 2024Bryson DeChambeauJuneteenthInside Out 2Eid al-AdhaCleopatraDeaths in 2024Merrily We Roll Along (musical)Jonathan GroffJude Bellingham.xxx77th Tony AwardsBridgertonGary PlauchéKylian MbappéDaniel RadcliffeUEFA European Championship2024 ICC Men's T20 World CupUnit 731The Boys (TV series)Rory McIlroyN'Golo KantéUEFA Euro 2020YouTubeRomelu LukakuOpinion polling for the 2024 United Kingdom general electionThe Boys season 4Romania national football teamNicola CoughlanStereophonic (play)Gene WilderErin DarkeAntoine GriezmannProject 2025