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

C++ Handle overflow/underflow when extracting string to scalars

when extracting data from string to scalars (char, short, int...), how could I easily know if the value I want to get exceeds the type limit? unsigned char function(void) { std::string str = "259"; std::ostringstream…
kirly
  • 101
  • 1
  • 2
  • 5
0
votes
2 answers

Stack by pointers in C working except at stack underflow

I implemented stack by using pointers. It is compiling and working but it doesn't underflow when the stack is empty. It gives me some garbage value. I think the problem is something in the create_stack function. I am not getting segfaults no matter…
Aseem Bansal
  • 6,722
  • 13
  • 46
  • 84
0
votes
1 answer

Overflow or underflow in the arithmetic operation when clearing large Table

I'm building large (>25,000 rows) Tables. I receive the dreaded Overflow or underflow error somewhere above 25,000 rows. I've tried to reset with psuedo Table = Nothing Table = New Table Table.Rows.Clear() Now, the reset line is referenced in the…
user1382306
0
votes
0 answers

FloatingPointError only shows up in a specific program

I have the same piece of code written in two programs. However I only get the error while running it one program. Here is the file that is works with: #!/usr/bin/env python #FileName: test.py import numpy as np import math mu = 0 sigma =…
still learning
  • 157
  • 2
  • 14
0
votes
1 answer

Overflow and Underflow BigIntegers in C#

I have the following piece of code which i'm trying to comprehend. The Big Integer class (custom, not the standard class) has the following members: private const int maxLength = 2000; private uint[] data = null; // stores bytes…
user720694
  • 2,035
  • 6
  • 35
  • 57
-1
votes
2 answers

What's the most efficient way to perform bounded addition?

Given an unsigned integer x and a signed integer dx, what's the most efficient way to perform x = x + dx while preventing over/underflow? I could do something like: unsigned int x; int dx; ... long int result = (long int)(x + dx); if (result < 0)…
Jeff L
  • 491
  • 5
  • 14
-1
votes
1 answer

Why is a negative size_t underflowing but subtracting it does not?

I have this simple program here which is returning 18446744073709551615: #include using namespace std; int main() { cout<<-(size_t)1; cout<<0-(size_t)1; return 0; } Additionally, I also have this program here which is…
StarckOverflar
  • 1,577
  • 2
  • 10
  • 13
-1
votes
1 answer

Unexpected underflow

//Data var M = 83 * (10 ^ (-5)); var R = 2077; var Th = 1087; var Tk = 372; var Tr = 667; var a = 90; var Vclc = 9.135 * (10 ^ (-6)); var Vcle = 7.733 * (10 ^ (-6)); var Vswe = 6.105 * (10 ^ (-5)); var Vswc = 6.294 * (10 ^ (-5)); var Vk…
GiaFil7
  • 141
  • 1
  • 3
  • 10
-2
votes
2 answers

Throwing an exception if, for example, int a = Integer.MIN_VALUE-1;

Do you know of any languages which would throw an Exception on Overflow or Underflow? Thanks
Alexandre Santos
  • 8,170
  • 10
  • 42
  • 64
-2
votes
1 answer

Subtracting two integers causes integer-underflow in device code

In my cuda device code I am doing a check where I subtracting the thread's id and the blockDim to see weather or not the data I might want to use is in range. But when this number goes bellow 0 it seems to wrap back around to be max…
Liiht
  • 49
  • 7
-2
votes
1 answer

Increment/Decrement byte (char) in c++ with over/under-flow

What is the best way to increment/decrement a byte in c++ while taking into consideration the overflow and underflow? For example, I have: char c = random byte; c += 0xB; In case c <= 0xF4, this will work well, but any value above that would cause…
Brave Heart
  • 517
  • 3
  • 16
-2
votes
1 answer

In Assembly, How do i get past the -128 to 127 range?

So I have this declaration in .bss answer resb 1 In answer, I store the results of the sum of 2 digit integers ranging from -99 to +99. When I try adding +99 and +99, the answer becomes negative. Any answer within the -128 to 127 range are…
ejandra
  • 336
  • 2
  • 4
  • 15
-4
votes
1 answer

How can I detect lost of precision due to rounding in both floating point addition and multiplication?

From Computer Systems: a Programmer's Perspective: With single-precision floating point the expression (3.14f+1e10f)-1e10f evaluates to 0.0: the value 3.14 is lost due to rounding. the expression (1e20f*1e20f)*1e-20f evaluates to +∞ , while…
Tim
  • 1
  • 141
  • 372
  • 590
1 2 3
9
10