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
4
votes
2 answers

Explain Change to GNU C++ filebuf::underflow() interacting with filebuf::seekoff()

My company's products run on a number of qualified Linux hardware/software configurations. Historically, the compiler used has been GNU C++. For purposes of this post, let's consider version 3.2.3 the baseline, as our software 'worked as expected'…
Don Wakefield
  • 8,693
  • 3
  • 36
  • 54
4
votes
1 answer

At what point should I worry about underflow in numpy values?

I am doing calculations with Python numpy. Here is a resulting numpy array: [ 5.15054786e-11 5.15251385e-11 5.15262922e-11 ..., 5.21100674e-11 5.21097550e-11 5.21088179e-11] Those are pretty tiny. At what point should I worry about…
ShanZhengYang
  • 16,511
  • 49
  • 132
  • 234
4
votes
1 answer

Graceful Underflow

I have been searching about this for so long, but i am not able to understand what this question means. Question: Write a program in any language to determine how your computer handles graceful underflow. I understand that a overflow condition is…
SeasonalShot
  • 2,357
  • 3
  • 31
  • 49
4
votes
3 answers

Subtract and detect underflow, most efficient way? (x86/64 with GCC)

I'm using GCC 4.8.1 to compile C code and I need to detect if underflow occurs in a subtraction on x86/64 architecture. Both are UNSIGNED. I know in assembly is very easy, but I'm wondering if I can do it in C code and have GCC optimize it in a way,…
kktsuri
  • 333
  • 2
  • 11
4
votes
4 answers

How to detect floating point underflow in C

I need help and sample code on how to detect floating point underflow in standard way with out using third party libraries and exceptions for both signed and unsigned. I googled and found that various authors are talking about "gradual underflow…
venkysmarty
  • 11,099
  • 25
  • 101
  • 184
4
votes
1 answer

Why does the NSDecimalNumber 10^-65 squared result in 10^126 instead of resulting in an Underflow Exception?

So here's the code: NSDecimalNumber *test=[[NSDecimalNumber alloc] initWithInt:65]; number3=[[NSDecimalNumber one] decimalNumberByDividingBy:[[[NSDecimalNumber alloc] initWithInt:10]…
4
votes
0 answers

Handling Underflow with HMM Forward-Algorithm

I'm trying to implement the Forward-Algorithm for a Hidden Markov Model (HMM) and I'm facing the underflow issue when filling the alpha table. I normalized the alpha values using the method described in section 6 here but now the resulting sum of…
4
votes
1 answer

Avoiding underflow for joint probabilities using NumPy

I face a problem of estimating a joint probability for independent variables in a simple setup. Currently I have an array of 100 random variables and I would like to obtain their joint probability without failing into the underflow problem. Any…
JustInTime
  • 2,716
  • 5
  • 22
  • 25
3
votes
5 answers

How do I evaluate this equation?

I think its pretty self explanatory from the code. Obviously I'm no evaluating the same thing over and over, its just example numbers to explain my problem. I'm guessing its over/underflow but I don't know how to deal with it. double d = (1 /…
Cheetah
  • 13,785
  • 31
  • 106
  • 190
3
votes
3 answers

Overflow/underflow in unsigned numbers

So, if you have a carry out of 1 on addition with unsigned numbers, you have overflowed, and if you have a carry out of 0 with subtraction, you have underflowed. Does this work in every case, though? If you do 5-0: 0101 -0000 = 0101 +(1111 +…
Risshuu
  • 101
  • 1
  • 3
  • 12
3
votes
2 answers

numbers near underflow limit display as `Inf.e-324` in tibble?

Per the docs, "on a typical R platform the smallest positive double is about 5e-324." Given a double vector with values above, near, and below this limit: library(tibble) small_vec <- c(4e-300, 4e-324, 4e-350) small_df <- data.frame(x =…
zephryl
  • 14,633
  • 3
  • 11
  • 30
3
votes
2 answers

c++ inconsistent unsigned to signed subtraction results only fails for one permutation

I realize that there is a rule by which numbers with a width smaller than int can be promoted to a wider type for the addition operation. But I cannot fully explain how only one permutation of the following print_unsafe_minus will fail. How is it…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
3
votes
1 answer

How to deal with the log of a sum of more than two super small probabilities

For some evil reason I need to calculate the log of the sum of 500 super small probabilities, each term computed by dmvnorm(X[,i], mean=rep(0,3), sigma=diag(3)) Sometimes the codes above return 0 due to underflow, but using logarithms will be…
Paw in Data
  • 1,262
  • 2
  • 14
  • 32
3
votes
1 answer

Under flow with floating point arithmetic checking

I'm programming a library with multiple instances of long mathematical formulas that sometimes underflow when using doubles. One example could be: (Exp(-a*a) - Exp(-b*b))*Exp(c)*Exp(d) And a,b,c,d also involve some computation of similar type. I…
Radost
  • 309
  • 3
  • 11
3
votes
0 answers

How can I avoid overflow/underflow when computing the euclidean norm of a vector?

I was trying to use log and then take the exp, but that makes only sense if I deal with products or divisions. One would usually define Euclidean_Norm <- function(x) sqrt(sum(x^2)) But I can't handle overflow/underflow. I was thinking to…
JimmyJim
  • 101
  • 1
  • 6
1 2
3
9 10