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
0
votes
1 answer

Why is infinity's floating point representation apparently 0^n?

I am trying to understand floating point representations. I do not understand the 'infinity' 'NaN' representations in floating point. I am looking at the table provided by TopCoder. Infinity is represented by an exponent of all 1s and a Mantissa of…
Yogi
  • 105
  • 1
  • 3
  • 9
0
votes
0 answers

mkl random number generator and FLT_MAX

I am using quasi random number generator from mkl Intel. I created my own wrappnig method to allow for definition of maximum and minimum bounds for rng. However, seems not to work when values for bounds aer FLT_MIN FLT_MAX. So that I wonder what is…
kiriloff
  • 25,609
  • 37
  • 148
  • 229
-1
votes
1 answer

how to represent integer infinity in python 3?

I have a variable with type annotation as int. I want to assign it an arbitrary large value as default. If it was a float, I could have used math.inf. However, what should I use if variable is integer? def calc(x: int = math.inf): ...
toing
  • 466
  • 1
  • 3
  • 19
-1
votes
1 answer

Why infinity to power 0 is implemented to be 1?

This is an undeterminate form in Math, but in Python and JavaScript it results in 1. Tested in Python: inf=float('inf') print(inf**0) JavaScript console.log(Math.pow(Infinity,0)) console.log(Infinity**0)
Avinash Thakur
  • 1,640
  • 7
  • 16
-1
votes
1 answer

Planck's function in Fortran 90

I have the following formula for a function in Fortran 90 used to find the spectral radiance at a given wavelength and temperature. I've expressed it as: intensity = (2.0d0*h*nu**(3.0d0))/c**(2.0d0) * 1d0 / (EXP((h*nu)/(k*T))-1d0) Where I take…
genjong
  • 115
  • 1
  • 15
-1
votes
2 answers

Explain: Min/Max array with infinity

I was looking into how to find the min and max value in an array (without using Math) and I came across this code in a forum: var array = [4, 2, 3, 4] var min = arrayMin(array); out.innerHTML = min; function arrayMin(arr) { var len =…
Meek
  • 87
  • 11
-1
votes
1 answer

Java calculation returning infinity

it's been a while since I last asked anything around here! I'm making an Android app, and so, having this problem when running this code.: Button calc = (Button) findViewById(R.id.btnCalculate); calc.setOnClickListener(new…
Luis
  • 123
  • 1
  • 3
  • 18
-1
votes
1 answer

Use class object as another type

It's difficult to explain. I've created a Infinity Class, Infinity< t > , for example Infinity < int >, and it contains a bool that says if the infinity is + or - and operators overloading, so you can do all of this: infinity + int, int - infinity,…
-1
votes
1 answer

How to implement negative infinity to positive infinity limit in MATLAB?

I need to find the limit of symsum(expression,variable,-Inf,Inf) It gives error. How I can solve.
viz
  • 15
  • 6
-2
votes
2 answers

JavaScript JSON.parse string bug - convert value to Infinity

Can anyone explain me this strange behavior in JSON.parse() function in Javascript? When calling it with string, it should raise an error. e.g JSON.parse("5ffc58ed1662010012d45b30"); result with: VM230:1 Uncaught SyntaxError: Unexpected token f in…
ET-CS
  • 6,334
  • 5
  • 43
  • 73
-2
votes
3 answers

Java Euler number result infinity

I try to use a recursive function to calculate the Euler number in Java. It's OK when I enter small numbers into this formula: But when I try to enter a bigger number like 1000 I get infinity. Why it's happening. How I can fix it. import…
-2
votes
2 answers

Can I use Infinity and -Infinity as an initial value for Max and Min variables?

I thought that it would be acceptable to initialize my Max value to -Infinity but this did not turn out to be the case in JavaScript. If Infinity is considered a number type why can't I use it in my comparisons? var windowStart =0, sum =0, max =…
Frederick Haug
  • 245
  • 2
  • 14
-2
votes
2 answers

How would you define infinity?

Expand your thoughts upon this: #define INFINITY ((1 << (8*sizeof (int) - 6)) - 4) Is expanded?
-2
votes
2 answers

Why does the program increase the value of the x and the y even after they are bigger, then they should be?

I'm making a program, that moves a dot, from the startx, starty to endx, endy. But it moves continuously, even after the x and the y are bigger than endx and endy. Here is the code: int x, y; x = startx; y = starty; …
-2
votes
2 answers

why i get infinity ? can it solved?

i have code like this, i try to get number from henon formula public class henon { public static void main(String[] args) { double a = 0.3; double b = 1.4; double k[] = new double[1026]; k[0] =…
user1209555
  • 47
  • 2
  • 5
1 2 3
31
32