Why is 0 divided by 0 throwing an overflow error in VBA?

前端 未结 2 608
萌比男神i
萌比男神i 2020-12-11 01:55

Why is 0/0 throwing Overflow error in VBA, while in .Net languages it is simply a Division by 0 error?


E.g., in C#

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-11 02:32

    https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/floating-point-division-operator

    Besides the obvious differences in implementation of languages and the way VBA handles division, MS Doc link above expands on the reasons for overflow exception , that if the operand data types are integer then it will throw Overflow exception (Last statement below)

    Alternatively there is \ division operator that checks the range for you and throws Division by zero exception

提交回复
热议问题