We help IT Professionals succeed at work.

Divide-by-Zero is NOT ERROR?

volking
volking asked
on
On my PC ...in VB.net ... the below does NOT return an error??????
        Try
            Dim x As Single = 0
            x = (1 / 0)
        Catch ex As Exception
            Dim s As String = ex.ToString()
        End Try

Open in new window

Comment
Watch Question

.NET gives you the correct answer for divide by zero: "Infinity".
FYI, if you attempt 0/0, you will get NaN (Not a Number) - NaN and Infinity are constants available in the .NET numeric types.

Author

Commented:
I looked it up.
Weird ... but OK, you're right.