PDA

Click to See Complete Forum and Search --> : Long is faster yet it's 4 bytes and integer is 2 bytes, and other data type questions


MicahCarrick
Jan 18th, 2000, 11:44 AM
I read in the MSDN library that a long data type should be used whenever possible because it is the processors native data type and therfore more efficient. Why is this if it's 4 bytes and the integer is 2 bytes?

Also, it sayed you should only use decimal when absolutely neccessary when dealing with math so that the math co-proccessor is utilized less. What data type can I use that when divided by an indivisable value won't return a decimal value? I usually use the round() functiln.

Any help would be great thanks.

Tonio169
Jan 18th, 2000, 12:10 PM
byte, integer and Long data types will not return the decimal part of a number. it rounds the number to the nearest whole number.

Crazy D
Jan 18th, 2000, 03:03 PM
Use the \ as devide-thingie (whatever that's called in English...)

5 / 2 = 2,5
5 \ 2 = 2

Rick H
Jan 18th, 2000, 03:25 PM
Longs are 32bit wide (2^32) = +/- 2147483648 as the processor and memory are internally 32bit it is quicker to use this type.

A integer is 16bit (2^16) = +/- 32768.

A byte is 8 bits (though I guess you knew that!)

[This message has been edited by Rick H (edited 01-19-2000).]