How to represent -infinity in programming

前端 未结 6 1792
野趣味
野趣味 2021-01-17 01:18

How can I represent -infinity in C++, Java, etc.?

In my exercise, I need to initialize a variable with -infinity to show that it\'s a very

6条回答
  •  悲哀的现实
    2021-01-17 01:54

    If you want to represent the minimum value you can use, for example

    for integers

    int a = Integer.MIN_VALUE;
    

    and floats, doubles, etc take each object wrapper min value

提交回复
热议问题