简体   繁体   English

java中数组中的无穷大

[英]Infinity in Array in java

I tired printing Array and the end I got Infinity at last few values.我累了打印 Array,最后我在最后几个值上得到了 Infinity。 What does Infinity means in Java. Infinity 在 Java 中是什么意思。 I am coding java in android studio.我正在 android studio 中编写 java。

The array is as follows aList [132.74362, 142.6408, 143.6408, 131.62733, 132.62733, 127.61245, 128.61246, 124.76465, 125.76465, Infinity, Infinity, Infinity, Infinity ]数组如下aList [132.74362, 142.6408, 143.6408, 131.62733, 132.62733, 127.61245, 128.61246, 124.76465 ,Infinity6,125 ]

What does Infinity mean?无穷大是什么意思?

Did you divide by zero?你除以零了吗?

When you divide by zero ...当你除以零...

In case of double/float division, the output is Infinity.在双/浮点除法的情况下,输出为无穷大。 The basic reason behind it is that it implements the floating point arithmetic algorithm, which specifies special values like “Not a number” OR “infinity” for “divided by zero cases” as per IEEE 754 standards.其背后的基本原因是它实现了浮点算术算法,该算法根据 IEEE 754 标准为“除以零的情况”指定了“非数字”或“无穷大”等特殊值。

In case of integer division, it throws ArithmeticException.在整数除法的情况下,它抛出 ArithmeticException。

This, will print "Infinity"这将打印“Infinity”

    double p = 1; 
    System.out.println(p/0); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM