Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Floating point exceptions?

Status
Not open for further replies.

FlyingFrog

Programmer
Jun 24, 2003
17
0
0
US
In .net floating point types don't throw exceptions.
Any one has any idea why it should be so?
Thanks
 
I'm guessing you mean this does not throw

Dim a, b, c as double (or single)
a = 1
b = 0
c = a/b 'in vb6 this would error

if so, in .net, the reason is because single and double have extra properties like MaxValue, PositiveInfinity, and more pertinently, NaN - not a number

To get one to throw, try this

dim a as single, b as double
b = double.maxvalue
a = b 'this should throw

Hope this helps

Mark [openup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top