I got an odd error which I cannot explain and cannot seem to reproduce.
The following statement
lst[0] = num
produced this error
OverflowError: unsigned short is greater than maximum
The number was around 65536 so it makes sense that it would overflow a
short, but why is it trying to force it into a short integer?
-Chad 5 5909
Chad Haynes <ha*****@rockefeller.edu> writes: I got an odd error which I cannot explain and cannot seem to reproduce. The following statement
lst[0] = num
produced this error
OverflowError: unsigned short is greater than maximum
The number was around 65536 so it makes sense that it would overflow a short, but why is it trying to force it into a short integer?
Is lst an array.array('h') or something (numarray...)?
Cheers,
mwh
--
An encyclopedia is about being as accurate as it can, not being
evenly misinformed. -- Coby Beck, comp.lang.lisp
Michael Hudson wrote: Chad Haynes <ha*****@rockefeller.edu> writes:
I got an odd error which I cannot explain and cannot seem to reproduce. The following statement
lst[0] = num
produced this error
OverflowError: unsigned short is greater than maximum
The number was around 65536 so it makes sense that it would overflow a short, but why is it trying to force it into a short integer?
Is lst an array.array('h') or something (numarray...)?
Nope, its just a regular list Cheers, mwh
Chad Haynes <ha*****@rockefeller.edu> writes: Michael Hudson wrote:
Chad Haynes <ha*****@rockefeller.edu> writes:
I got an odd error which I cannot explain and cannot seem to reproduce. The following statement
lst[0] = num
produced this error
OverflowError: unsigned short is greater than maximum
The number was around 65536 so it makes sense that it would overflow a short, but why is it trying to force it into a short integer? Is lst an array.array('h') or something (numarray...)?
Nope, its just a regular list
Code, please.
Cheers,
mwh
--
The snakes are optional, as are the electrodes, the molten lead
and the ritual buggering by syphilitic warthogs.
-- Tanuki the Raccoon-dog, asr
On Thu, Feb 05, 2004 at 10:58:28AM -0500, Chad Haynes wrote: I got an odd error which I cannot explain and cannot seem to reproduce. The following statement
lst[0] = num
produced this error
OverflowError: unsigned short is greater than maximum
The number was around 65536 so it makes sense that it would overflow a short, but why is it trying to force it into a short integer? import array a = array.array('h', [0]) a[0] = 10000000
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: signed short integer is greater than maximum
Jp
"Chad Haynes" <ha*****@rockefeller.edu> wrote in message
news:_L********************@news.rockefeller.edu.. . Michael Hudson wrote:
Chad Haynes <ha*****@rockefeller.edu> writes: lst[0] = num
produced this error
OverflowError: unsigned short is greater than maximum
The number was around 65536 so it makes sense that it would overflow a short, but why is it trying to force it into a short integer?
Is lst an array.array('h') or something (numarray...)?
Nope, its just a regular list
Suggestion: open interactive window, type in minimal lines of code needed
to reproduce error, then cut and post entire window, including header that
identifies your particular binary. Also mention the source of binary (who
compiled, you or someone else).
TJR This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John Black |
last post by:
Hi,
If I have many integer calculation in my code, what's the best way to
detect integer overflow?
unsigned int i1 = 0xFFFFFF00, i2 = 0xFFFF;
then in statement unsigned int i3 = i1 + i2;...
|
by: REH |
last post by:
If the is_modulo field of the numeric_limits class is true for signed
integer types, can I assume that overflow for such types is defined
behavior? If so, is the behavior the same regardless of...
|
by: Ashutosh Iddya |
last post by:
Hi ,
I am performing an integer count of a particular operation in my program.
After a sufficiently large value an overflow occurs. At the moment I have
gone around the problem by declaring it...
|
by: junky_fellow |
last post by:
Is there any way by which the overflow during addition of two integers
may
be detected ?
eg.
suppose we have three unsigned integers, a ,b, c.
we are doing a check like
if ((a +b) > c)
do...
|
by: Chris Botha |
last post by:
Hi, I have an UInt32 and want to stick the value into an Integer and get an
Overflow exception, BUT using C# the same value can be casted into an int
and the value is as expected. The Hex value is...
|
by: Robert Seacord |
last post by:
The CERT/CC has released a beta version of a secure integer library for
the C Programming Language. The library is available for download from
the CERT/CC Secure Coding Initiative web page at:...
|
by: Freaker85 |
last post by:
Hello,
I am new at programming in C and I am searching a manner to parse a
string into an integer.
I know how to do it in Java, but that doesn't work in C ;o)
I searched the internet but I...
|
by: thomas.mertes |
last post by:
Is it possible to use some C or compiler extension to catch
integer overflow?
The situation is as follows:
I use C as target language for compiled Seed7 programs.
For integer computions the C...
|
by: Chris Becke |
last post by:
I *know* my CPU has opcodes that can do this - when adding (or subtracting) there is a carry flag that can be invoked to make the result essentially 1 bit longer than the data size used in...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |