Questions tagged [infinity]

Infinity is a specific floating point value that is always larger than any other floating point value. It may arise as a result of division by zero, arithmetic overflow and other exceptional operations. Infinity is different from the maximal still valid floating point value that the certain data type can hold. IEEE 754 floating point standard allows both positive and negative infinity values.

Infinity is a specific floating point value that is always larger than any other floating point value. It may arise as a result of division by zero, arithmetic overflow and other exceptional operations. IEEE 754 floating point standard allows both positive and negative infinity values.

Infinity is different from the maximal still valid floating point value that the certain data type can hold. This value is still smaller than the infinity.

Some programming languages allow to specify the infinity in the code explicitly. For instance, the Java code

    double [] values = ...
    double min = Double.POSITIVE_INFINITY;

    for (double x: values) 
      if (x < min) min = x;

can be used to obtain the minimal value in the array that only contains usual, valid floating point values.

475 questions
-3
votes
1 answer

A couple of complicated exponential operations in C return inf?

#include #include int main() { printf("Hello World! \n"); double a = 56; double b = pow(a,a); double c = pow(b,b); double d = pow(c,c); double e = pow(d,d); printf("%lf\n", e); return 0; } when i run…
An Ant
  • 184
  • 1
  • 10
-3
votes
1 answer

Do you know that ≥90% Python tutorials of the float() function is wrong?

Do you know that ≥90% Python tutorials of the float() function are wrong?
wyz23x2
  • 298
  • 4
  • 16
-3
votes
2 answers

Why does Math.log(0) return -Infinity in JavaScript?

When my Math.log value getting zero it is giving -Infinity value. Why it is giving negative Infinity value? Why only giving -Infinity rather giving +Infinity. Why only 0 value is giving this result. console.log(Math.log(0))
M.A.K. Ripon
  • 2,070
  • 3
  • 29
  • 47
-3
votes
2 answers

How to catch when a float = -1.#IO

I have a problem in my RobotC code where when a float reaches infinity it returns -1.#IO This is the value that is returned if a float reaches -Infinity. So the problem is float can only use numerical values. I cannot catch this value. If I put if…
skyline
  • 51
  • 9
-3
votes
1 answer

How to make a while loop till there is something to be readen c++

I know that you probably gona again vote me down, I really don't understand this but im really stuck at something and cant figure it out , there is no such information anywhere in the web , neither in my book for the course, so I have this…
-3
votes
2 answers

Why is Infinity a number?

In JavaScript, isNaN(Infinity) returns false, as if Infinity were a number; but several arithmetic operations on Infinity behave as if it were the mathematical infinity, which is not a number: So, why doesn't isNaN(Infinity) return true? Is it…
wcr4
  • 55
  • 8
-4
votes
1 answer

c++ do while infinity loop

When I try to use do while, my program below will fall into infinity loop if I input a character at second round. I don't know why, could you explain it to me? I ran it on Visual studio version 11.0.61219.00 update…
Neosteam
  • 51
  • 8
-5
votes
1 answer

how do i fix the illegal start of expression here

How do I fix the illegal start of expression here, i don't see anything wrong with it though static void divide(double a, double b){ double c = (number_a / number_b); String s; if (c == Double.POSITIVE_INFINITY ||…
anthony
  • 3
  • 3
-5
votes
2 answers

Getting 'Infinity' output instead of actual numbers

I am practicing some Java and one of the applications I am writing asks to output the world population in the next 75 years. I am using the population growth model. My issue is that my application outputs 'Infinity' in the column where the estimated…
Ko Ga
  • 856
  • 15
  • 25
-12
votes
1 answer

I want to make an infinity loop with two void functions in c++

I was wondering if there is a way to make an infinity loop the first function will call the second and the second will call the first and so on. Please make a code in C++. Thanks already.
1 2 3
31
32