performance differences between \ and /

  • Thread starter Thread starter Smokey Grindle
  • Start date Start date
S

Smokey Grindle

I thought I read somewhere that the division symbols \ and / mean different
things in terms of what they do an performance. what exactly is the
difference? thanks!
 
Smokey said:
I thought I read somewhere that the division symbols \ and / mean
different things in terms of what they do an performance. what
exactly is the difference? thanks!

/ is for normal division, and returns a Double value which includes all
fractional parts of the result of the division.

\ is for integer division, and returns an Integer value which discards all
fractional parts of the result of the division (the return value is always
rounded towards zero).

I'm not aware of any noticeable performance difference between the two; \
may be very slightly faster as there is less floating point work to be done,
but in practical terms I doubt you'd ever notice a difference in general
use.

HTH,
 
Back
Top