Click here to Skip to main content
15,921,959 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VBer new to VB.net - handles divide by zero? Pin
Christian Graus18-Aug-05 15:09
protectorChristian Graus18-Aug-05 15:09 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Dave Kreskowiak19-Aug-05 6:48
mveDave Kreskowiak19-Aug-05 6:48 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Christian Graus21-Aug-05 13:31
protectorChristian Graus21-Aug-05 13:31 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Dave Kreskowiak21-Aug-05 18:13
mveDave Kreskowiak21-Aug-05 18:13 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Christian Graus21-Aug-05 18:15
protectorChristian Graus21-Aug-05 18:15 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Dave Kreskowiak22-Aug-05 6:49
mveDave Kreskowiak22-Aug-05 6:49 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Christian Graus22-Aug-05 11:47
protectorChristian Graus22-Aug-05 11:47 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Dave Kreskowiak23-Aug-05 2:13
mveDave Kreskowiak23-Aug-05 2:13 
Christian Graus wrote:
The core issue then is the convert to a float64. I wonder if these conversions behind the scenes are a reason for the argument that VB.NET is slower than C# ?

It'll definitely contribute to the speed difference because of the conversion process and the 64-bit floating division. But I think the problem lies in the fact that the people who want to bash VB.NET so bad just write some ad-hoc test code for both languages, like in my post, don't realize that they're not comparing apples to apples. When the difference comes up, wow!, they just jump all over the language.


Christian Graus wrote:
Does this mean that C# can't divide using IEEE 754 rules ? Or is it just that VB.NET, being loosely typed, does conversions behind the scenes that C# does not.

No. C#, being based on the same Framework, using the same types and generating the same IL, uses the exact same math rules VB.NET does. C# just has a syntax advantage in the compiler where is will recognize the division situation, since it only has a single division operator, and generate the correct code automatically, (for example when dividing an int32 by an int32, assume the result required is an int32 and generate code for integer division), where VB.NET puts more of that decision process on the coder. The coder is responsible for explicitly telling VB.NET which type of division to use, integer (\) or floating-point (/).

I guess you could make a case for that being a simpler advantage for VB.NET, I don't know. In C#, if you wanted to force floating-point division on two int32's, you'd have to cast the operands to some floating-point type in the expression. IMHO, I'd say it might be slightly simpler to control in VB.NET, but more readable and comprehendable in C#.


RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Christian Graus23-Aug-05 13:23
protectorChristian Graus23-Aug-05 13:23 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
progload21-Aug-05 19:03
progload21-Aug-05 19:03 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Christian Graus21-Aug-05 19:16
protectorChristian Graus21-Aug-05 19:16 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
progload21-Aug-05 21:06
progload21-Aug-05 21:06 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Christian Graus22-Aug-05 11:43
protectorChristian Graus22-Aug-05 11:43 
AnswerRe: VBer new to VB.net - handles divide by zero? Pin
Daniel132418-Aug-05 16:15
Daniel132418-Aug-05 16:15 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Christian Graus18-Aug-05 17:09
protectorChristian Graus18-Aug-05 17:09 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Daniel132418-Aug-05 17:25
Daniel132418-Aug-05 17:25 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Christian Graus18-Aug-05 17:32
protectorChristian Graus18-Aug-05 17:32 
AnswerRe: VBer new to VB.net - handles divide by zero? Pin
progload18-Aug-05 19:38
progload18-Aug-05 19:38 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
DaveC42691319-Aug-05 3:27
DaveC42691319-Aug-05 3:27 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
progload19-Aug-05 3:50
progload19-Aug-05 3:50 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
DaveC42691319-Aug-05 4:24
DaveC42691319-Aug-05 4:24 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
progload19-Aug-05 4:53
progload19-Aug-05 4:53 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
DaveC42691319-Aug-05 5:20
DaveC42691319-Aug-05 5:20 
GeneralRe: VBer new to VB.net - handles divide by zero? Pin
Christian Graus21-Aug-05 19:19
protectorChristian Graus21-Aug-05 19:19 
AnswerRe: VBer new to VB.net - handles divide by zero? Pin
Thomas Stockwell19-Aug-05 8:32
professionalThomas Stockwell19-Aug-05 8:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.