DivideByZeroException Class
Collapse the table of content
Expand the table of content

DivideByZeroException Class

The exception that is thrown when there is an attempt to divide an integral or decimal value by zero.

For a list of all members of this type, see DivideByZeroException Members.


[Visual Basic]
Public Class DivideByZeroException
   Inherits ArithmeticException
public class DivideByZeroException : ArithmeticException
public __gc class DivideByZeroException : public
class DivideByZeroException extends ArithmeticException

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Dividing a floating-point value by zero will result in either positive infinity, negative infinity, or Not-a-Number (NaN) according to the rules of IEEE 754 arithmetic. Floating-point operations never throw an exception. For more information, see Single and Double.

The following Microsoft intermediate language (MSIL) instructions throw DivideByZeroException:

  • div
  • div.un
  • rem
  • rem.un

DivideByZeroException uses the HRESULT COR_E_DIVIDEBYZERO, which has the value 0x80020012.

For a list of initial property values for an instance of DivideByZeroException, see the DivideByZeroException constructors.


Namespace: System

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: Mscorlib (in Mscorlib.dll)

See Also

DivideByZeroException Members | System Namespace | Exception | Handling and Throwing Exceptions

© 2015 Microsoft