42

I've seen the two terms use interchangeably. Definitions found online seem to vary as well.

From my understanding, a corner case is the extreme values of inputs. And edge cases are the extreme cases to handle when designing an algorithm. Is this correct?

Is there a standard definition?

0

3 Answers 3

30

These are often used interchangeably. If you're being careful about language, these have specific (engineering) meanings (courtesy of Wikipedia):

In engineering, a corner case (or pathological case) involves a problem or situation that occurs only outside of normal operating parameters—specifically one that manifests itself when multiple environmental variables or conditions are simultaneously at extreme levels, even though each parameter is within the specified range for that parameter.

An edge case is a problem or situation that occurs only at an extreme (maximum or minimum) operating parameter. For example, a stereo speaker might noticeably distort audio when played at its maximum rated volume, even in the absence of other extreme settings or conditions.

In programming, an edge case typically involves input values that require special handling in an algorithm behind a computer program. As a measure for validating the behavior of computer programs in such cases, unit tests are usually created; they are testing boundary conditions of an algorithm, function or method. A series of edge cases around each "boundary" can be used to give reasonable coverage and confidence using the assumption that if it behaves correctly at the edges, it should behave everywhere else.

For example, a function that divides two numbers might be tested using both very large and very small numbers. This assumes that if it works for both ends of the magnitude spectrum, it should work correctly in between.

0
20

According to Wikipedia:

Where an edge case involves pushing one variable to a minimum or maximum, putting users at the "edge" of the configuration space, a corner case involves doing so with multiple variables, which would put users at a "corner" of a multidimensional configuration space.

3

perhaps if you were detecting which quadrant of the Cartesian plane a point is on, an edge case could be x = 0 or y = 0. a corner case could be the origin x,y = 0,0. TBH i'm pretty sure most people use edge case and corner case interchangeably. If you really need to describe a certain situation precisely it's better to specify more details at the time so your audience will understand.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.