overflowexception

How can I stop OverflowException being thrown on integer division?

Hello World! 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. Basically this is one pair of i and j which happens as I iterate over huge sets (i...

Oracle number to C# decimal

Hi! I know there are several threads and posts regarding this issue in the internet and I've read them (not every article, I have to admit) but none of them did fully satisfy me. My situation: I'm using ODP.net (dll version 2.111.6.0) to access the Oracle DB (version 10 + 11) and a DataReader to retrieve the data (.NET 3.5, C#). Using...

C# - What could cause overflow checking here?

I am accustomed to C# not performing overflow checks, as the language spec states (§7.5.12): For non-constant expressions (expressions that are evaluated at run-time) that are not enclosed by any checked or unchecked operators or statements, the default overflow checking context is unchecked unless external factors (such as compiler ...

VB.NET CInt(Long) behaving differently in 32- and 64-bit environments

Hello everybody, this is my first message here. Today I had a problem converting a Long (Int64) to an Integer (Int32). The problem is that my code was always working in 32-bit environments, but when I try THE SAME executable in a 64-bit computer it crashes with a System.OverflowException exception. I've prepared this test code in VS20...

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, Lending l, BookCopy bc WHERE b.BookID = bc.BookID AND l.MemberID = m.MemberID AND l.BookCopy...

Rationale behind OverflowException thrown with negative array size?

After writing code that can be boiled down to the following: var size=-1; var arr=new byte[size]; I was surprised that it threw an OverflowException. The docs for OverflowException state: The exception that is thrown when an arithmetic, casting, or conversion operation in a checked context results in an overflow. I couldn't see ...