Questions tagged [overflowexception]

The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow.

78 questions
2
votes
2 answers

Determine if integer overflow is over or under bounds

Using C#, I have a few custom classes where I need to be able to detect integer overflows and return a default minimum or maximum value depending on if the overflow was due to the result being over the maximum value or under the minimum value. I…
Mike Johnson
  • 686
  • 5
  • 13
2
votes
4 answers

How can I stop OverflowException being thrown on integer division?

I am getting OverflowException's thrown at me when I don't want them (or so I think). I am performing some odd calculations where I expect the values to overflow, discarding overflowed bits. It seems I can't get this to work properly though.…
Statement
  • 3,888
  • 3
  • 36
  • 45
2
votes
0 answers

SqlDecimal issues in SQLCLR project

I'm having some unexpected results when working with SqlDecimals. In the end it seems to boil down to scale issues when dividing 2 SqlDecimals. c# example code looks like this : [Microsoft.SqlServer.Server.SqlFunction] [return: SqlFacet(Precision =…
deroby
  • 5,902
  • 2
  • 19
  • 33
1
vote
2 answers

CSharp: Failed to read LARGE .npy file. Exception is "NumSharp.dll Arithmetic operation resulted in an overflow."

I am trying to read a large .npy file in CSharp. In order to do that i am trying to use the NumSharp nuget. The file is 7GB jagged float array (float[][]). It has ~1 million vectors, each vector is a 960 dimension. Note: To be more specific the data…
Samer Aamar
  • 1,298
  • 1
  • 15
  • 23
1
vote
2 answers

getting OverflowError in python

I need to express and use the following equation in Python code. However, I am getting an OverflowError when I substitute X = 340.15 in: Y = [e^(-989)] * (X^171) I did a quick search on Google but was unable to find out how to get the equation…
john li
  • 13
  • 2
1
vote
1 answer

How to calculate and write a very, very large number to a file in python?

This may seem like a duplicate question, and maybe it is, but I've checked many other sources and none of the solutions seem to work. The number I'm trying to calculate is 999,999^999,999, and it's pointlessly large, but I've been trying to get it…
1
vote
0 answers

java.lang.StackOverflowError: null JsonWriter.writeDeferredName but not using Json?

I know the title isn't the best, but the error is not clear at all to me. The error I have is this: 019-04-15 14:28:45.270 ERROR 12644 --- [nio-9090-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet]…
Usr
  • 2,628
  • 10
  • 51
  • 91
1
vote
1 answer

uwp NeighbourFilesQuery sometimes gives System.OverflowException

I use File​Activated​Event​Args args to do the file association in my video player app. So I when user double clicks a video file it opens and plays the file in my app, also it gets all the neighbouring files, so I can add them to playlist as well.…
Muhammad Touseef
  • 4,357
  • 4
  • 31
  • 75
1
vote
1 answer

IntPtr cast to int causing OverflowException, why not caught by static code analysis?

I'm trying to find out if this scenario that caused an OverflowException could possibly be something that could be caught by static code analysis. //IntPtr position = ... position = (IntPtr) ((int) position + stride); The above code employs…
Kyle V.
  • 4,752
  • 9
  • 47
  • 81
1
vote
0 answers

Converting a huge XPS document page to an image file

I have a preposterously large page (tens of thousands of pixels high and across, with tens of thousands of nodes and links) on an XPS document that I am attempting to convert to an image. The XPS document contains only one page. On researching how…
Interminable
  • 1,338
  • 3
  • 21
  • 52
1
vote
1 answer

More than 32 links in LinkLabel?

I'm currently making an app in C# which make use of LinkLabels. I have a function that add a new link for each element in a certain array. However, it happens that the array have more than 32 links, and when that happens, I receive an…
Binyuan Sun
  • 146
  • 1
  • 9
1
vote
2 answers

bitwise complement of a character in C# vs C overflowexception

I have following code in C which will generate keys based on input serial number. unsigned int32 passkey(unsigned int32 snumber) { char snstring[11]; unsigned int32 pwd; int i = 0; itoa(snumber,10,snstring); do{ …
1
vote
2 answers

Why does this cause an ArithmeticException in C# when SQLPlus is all ok

I have a view connecting 4 tables CREATE VIEW BookCopyInfo AS SELECT bc.BookCopyID, b.BookTitle, m.FirstName || ' ' || m.LastName AS BorrowedBy, l.expectedReturnDate, (SYSDATE - l.expectedReturnDate) AS NoOfDaysLate FROM Book b, Member m,…
Ranhiru Jude Cooray
  • 19,542
  • 20
  • 83
  • 128
1
vote
1 answer

Why bitwise AND operator of big ULong number with constant causes OverflowException?

This code compiles successfully, but causes System.OverflowException in Visual Studio 2013 during execution: Sub Main() Dim a As ULong = 14345389830683080345D Dim c As ULong = 1 Dim x As ULong = a And 1 '<-- cause…
1
vote
2 answers

Cannot cast int32 to int16. Int16 type value is too large or too small

I want to cast an Int32 value to Int16 value. Data lost when casting is not a problem to me. But a System.OverflowException says the Int16 type value is too large or too small. Dim num As Int32 = &HFFFFFFF Dim num2 As Int16 =…
Yen NQ
  • 749
  • 7
  • 12