Questions tagged [underflow]

An arithmetic underflow is a condition in a computer program where the result of a calculation is a number of smaller absolute value than the computer can actually represent in memory.

In computing, buffer underrun or buffer underflow is a state occurring when a buffer used to communicate between two devices or processes is fed with data at a lower speed than the data is being read from it. This requires the program or device reading from the buffer to pause its processing while the buffer refills.

From Wikipedia

148 questions
6
votes
2 answers

Calculating log-sum-exp function in c++

Are there any functions in the c++ standard library that calculate the log of the sum of exponentials? If not, how should I go about writing my own? Do you have any suggestions not mentioned in this wiki article? I am concerned specifically with the…
Taylor
  • 1,797
  • 4
  • 26
  • 51
6
votes
1 answer

C# ulong overflow / underflow somehow allowed

I'm a little confused about the behavior of the ulong type. I understand it to be a 64-bit integer used for positive numbers (max value 18,446,744,073,709,551,615). I just started using it because I need really big positive numbers, but there's some…
SleekPanther
  • 358
  • 3
  • 13
6
votes
0 answers

Qt QAudioOutput buffer underflow when playing from file

I have implemented a simple Qt program based on the example in the QAudioOutput documentation here. The program plays raw audio from a file using QAudioOutput when I press a button. The audio plays fine but I receive Got a buffer underflow! at the…
Pobbel
  • 159
  • 1
  • 9
6
votes
2 answers

Understanding signed vs unsigned comparison

Can somebody tell me why the if condition is false? #include using namespace std; int main(int argc, char *argv[]) { int a; unsigned int ua; a = -1; ua = a; cout << "ua: " << ua << endl; if (ua != -1) …
harryPoker
  • 85
  • 6
6
votes
2 answers

Canvas restore() causing underflow exception in very rare cases

Through ACRA, I have received a small number of reports from an alpha build of software that show that an exception is occurring during a specific call to Canvas.restore(). The exception is java.lang.IllegalStateException: Underflow in restore. I am…
Trevor
  • 10,903
  • 5
  • 61
  • 84
6
votes
2 answers

How to handle floating-point underflow?

I'm trying to understand C++ numerical properties. Thus, I am interested by the underflow phenomenon. Can anyone give me an example of an underflow and how to handle it?
WildThing
  • 665
  • 2
  • 9
  • 17
5
votes
2 answers

How can an underflow lead to an overflow?

I'm reading the Intel Manual (Intel® 64 and IA-32 Architectures Software Developer Manuals *2016) and am curious if I understand this one excerpt correctly about the need for an Underflow Exception: The ability to detect and handle underflow is…
Robert Houghton
  • 1,202
  • 16
  • 28
5
votes
1 answer

Avoid underflow using exp and minimum positive float128 in numpy

I am trying to calculate the following ratio: w(i) / (sum(w(j)) where w are updated using an exponential decreasing function, i.e. w(i) = w(i) * exp(-k), k being a positive parameter. All the numbers are non-negative. This ratio is then used to a…
5
votes
1 answer

Underflow in Forward Algorithm for HMMs

I'm implementing the forward algorithm for HMMs to calculate the probability of a given HMM emitting a given observation sequence. I'd like my algorithm to be robust to underflow. I can't work in log-space because the forward algorithm requires…
akobre01
  • 777
  • 1
  • 10
  • 22
5
votes
6 answers

Forms of constants for high performance addition and multiplication for double

I need to efficiently add or multiply some constants to a result of type double in a loop to prevent underflow. For example, if we have int, multiplying with a power of 2 will be fast as the compiler will use bit shift. Is there a form of constants…
ggg
  • 1,857
  • 2
  • 21
  • 33
4
votes
4 answers

Underflow error in floating point arithmetic in C

I am new to C, and my task is to create a function f(x) = sqrt[(x^2)+1]-1 that can handle very large numbers and very small numbers. I am submitting my script on an online interface that checks my answers. For very large numbers I simplify the…
lcleary
  • 65
  • 6
4
votes
3 answers

Overflow and Underflow in Java Float and Double Data Types

I have created the following code to test Float and Double Java numeric data types for underflow and overflow: // Float Overflow & Underflow float floatTest = Float.MAX_VALUE; floatTest++; out.println("Float Overflow: " + Float.MAX_VALUE + " + 1 = "…
jjj
  • 2,594
  • 7
  • 36
  • 57
4
votes
1 answer

Why does complex floating-point division underflow weirdly with NumPy?

Consider this code: import numpy numpy.seterr(under='warn') x1 = 1 + 1j / (1 << 533) x2 = 1 - 1j / (1 << 533) y1 = x1 * 1.1 y2 = x2 * 1.1 z1 = x1 / 1.1 z2 = x2 / 1.1 print(numpy.divide(1, x1)) # 1-3.55641399918e-161j #…
user541686
  • 205,094
  • 128
  • 528
  • 886
4
votes
2 answers

How to avoid underflow when multiplying real numbers?

I would like to know if there is a proper way to multiply or square float (or double) numbers together without having underflow error when I compile my Fortran code like gfortran -ffpe-trap=invalid,zero,overflow,underflow ... I know that the…
R. N
  • 707
  • 11
  • 31
4
votes
2 answers

How can I prevent/detect an underflow in a Postgresql calculation that uses EXP()

I am receiving a value out of range: underflow error from pgsql, in a query that uses the EXP(x) function. What values of x trigger this? How do I prevent or detect it?
pc1oad1etter
  • 8,549
  • 10
  • 49
  • 64
1
2
3
9 10