I (I am sure everyone else also) have always seen comparisons of some value to 999 or 9999 …. etc.
for e.g.:
in CSS
z-index: 9999
or some times
str.length < 99999
I wonder if there is some fact behind it or its a trend.
2
Code readability.
While the number 99999
isn’t very meaningful for the computer, it is meaningful for people. It says “some really, really high value which should be larger than any other”. However, in many situations, this is usually bad style because
- it is often not the largest number possible and in some edge-cases the program might encounter a larger one during normal operation and
- many programming languages offer special constructs for the largest possible numbers. C has the
INT_MAX
macro inlimits.h
, Java hasInteger.MAX_VALUE
.
Even when such features are not available, a good programmer would look up the largest possible value supported by their environment and use that as a syntactical value for “really, really large”, but many are too lazy and just hammer the “9” key on their keyboard.