DEV Community

Discussion on: Math.min returns Infinity?

Collapse
 
wwbrannon profile image
William Brannon

It's very not intuitive but I think they're following the usual mathematical convention. The max of no elements is odd to think about, but the supremum of the empty set is just its least upper bound. Because everything is an upper (and lower) bound of nothing, the least such value is -Infinity. Similarly the greatest lower bound, or infimum, or min, of the empty set is +Infinity.

See also this StackExchange discussion.

Collapse
 
dance2die profile image
Sung M. Kim

Thank you, William.

As I was reading John's message, I ran into a concept called, monoid.
It seems like monoid stems from the "mathemtical convention" as you pointed out.

Collapse
 
mjvmroz profile image
Michael Mroz

monoid is the first of many steps down the road that leads to functional programming. Join us.

Thread Thread
 
dance2die profile image
Sung M. Kim

🙂🤝