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
3 answers

Why is there a difference between CGRectInfinite and a CGRect with all members set to INFINITY?

When working with (contentless) SpriteKit nodes I bumped into an infinite rectangle NSLog(@"%@", NSStringFromCGRect([node calculateAccumulatedFrame])); which outputted {{inf, inf}, {inf, inf}} I thought to check for this with CGRectIsInfinite,…
Pieter
  • 17,435
  • 8
  • 50
  • 89
0
votes
1 answer

Mixture modeling - troublee with infinite values from exp() and log()

I'm writing a function for Gaussian mixture models with spherical covariance structures--ie $\Sigma_k = \sigma_k^2 I$. This particular function is similar to the mclust package with identifier VII. http://en.wikipedia.org/wiki/Mixture_model Anyways,…
alexwhitworth
  • 4,839
  • 5
  • 32
  • 59
0
votes
2 answers

How to implement a summation from 1 to infinite in python

I'd like to calculate an infinite sum Like this: Sum from k=1 to infinite of (0.9^k) * r + k+1 //or any other My first idea was something like this: def infiniteCalc(r): result = r for k in range(10000000): result += 0.9**k + r + k…
Sadık
  • 4,249
  • 7
  • 53
  • 89
0
votes
1 answer

Issues with Infinite Double Slope in Java

I am working on a computational geometry projects which contains classes for Point, Line, Triangle, etc. I store lines as a yint and a slope, however this is giving me issues with vertical lines, as shown in the issue below. I have to maintain the…
nanogru
  • 23
  • 2
  • 10
0
votes
3 answers

C++ factorial program give infinity for any number greater than 2

So it's 5:00 A.M. where I am and I am confused and frustrated as hell. I've created a program like this before but can't understand what is going on. I've created a very simple factorial program and have double checked the logic, but every time I…
Qwurticus
  • 877
  • 1
  • 10
  • 18
0
votes
1 answer

Why is "long" interpretation of kCFPositiveInfinity different on various iDevices?

I have been tinkering with NSNumber for a little while when searching for infinity value and I have come across one interesting fact. When I do this: long infinity = [((NSNumber *)kCFNumberPositiveInfinity) longValue]; 32bit simulator interprets it…
Michal
  • 15,429
  • 10
  • 73
  • 104
0
votes
1 answer

How to error handle values stored as infinity (-1)?

I am trying to validate a form which returns the result (stored in a double) as -1.#IND (which I have been informed is infinity minus one?) How can I trap this error? -- Background info: The form captures data about a real world object (with 100s of…
JohnnyBizzle
  • 971
  • 3
  • 17
  • 31
0
votes
2 answers

Is f(n) in Ω(g(n)), Θ(g(n)) or O(g(n))?

Given two functions in PHP, say function f($n) { return $n; } function g($n) { return pow($n, (2/3)); } How to check if a function f(n) is in Ω(g(n)), Θ(g(n)) or O(g(n)) in PHP? What I tried so far: $n = INF; $A = f($n) / g($n); if ($A…
0
votes
1 answer

Computing limits in PHP

I want to compute n^(2/3) as n approaches infinity in PHP. What I tried: $n = "INF"; echo pow($n, (2/3)); Desired result: INF Actual result: 0 Any suggestions? How to compute limits in PHP? UPDATE: OK, first problem solved - I just needed to…
0
votes
3 answers

Incorrect string comparison

I have a problem i cannot figure out at all! in my program the user enters numbers to be sorted. i had to be able to sort infinity, negative infinity and the so called "Nullity" (these i defined early in the program) if the user wants to enter…
JabbaWook
  • 677
  • 1
  • 8
  • 25
0
votes
2 answers

why am i getting infinity for an answer

so, I've tried multiple different things, but I am still getting an answer of infinity when I run this for the last output, what do you think tht the problem is? The first output works fine, but the second and third do not. he exponent is supposed…
0
votes
3 answers

Cant rewrite variable after assigned as infinity Ansi C

I have double field ypos[] and in some cases instead of double is written into field -1.#INF00. I need to rewrite this values with 0.0, but i cant simply assign zero value, application falls everytime. Is there a way, how to solve this problem?
oliv3ra
  • 27
  • 1
  • 7
0
votes
0 answers

Optimizing from a function and a matrix containing -infinities. Using R, optim()

(If anyone has a suggestion for a better title, please let me know.) I am trying to write a backward induction optimization problem. (That might not be important, but if it helps, great.) I have a function that is a function of two variables, x…
wolfsatthedoor
  • 7,163
  • 18
  • 46
  • 90
0
votes
2 answers

Calculation Returning Infinite Value, Why?

I'm doing the culminating project for my intro java class and cannot figure out why I am getting an infinite value for the PercentageCap Calculation. Let me know if you see something in my code that I am missing or I need to look at. The program…
0
votes
1 answer

How is infinity implemented in javascript?

In javascript division by zero will result to a value called infinity( or -infinity). Also, any arithmetic operation on infinity with a real number will result to infinity. I would like to know how is infinity value, and the functions that operate…
programmingIsFun
  • 1,057
  • 2
  • 11
  • 20