Check my upper bound function giving wrong o/p