Why Does Ceil Return a Double?

ceil return a double? Returns the smallest (closest to negative infinity) double value that is not less than the argument and is equal to a mathematical integer. long b = (long)Math.

Does math Ceil return a double?

Math. ceil() returns the double value that is greater than or equal to the argument and is equal to the nearest mathematical integer.

Why do math ceilings have a double return?

It has to return double in order to be complete. Any math operation involving a NaN always returns NaN. Thus if you pass a NaN to ceiling() function one would not be able to return NaN, as there is no equivalent in Int.

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.