Results 1 to 4 of 4

Thread: Long is faster yet it's 4 bytes and integer is 2 bytes, and other data type questions

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207

    Post

    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.

  2. #2
    Lively Member
    Join Date
    Jul 1999
    Posts
    99

    Post

    byte, integer and Long data types will not return the decimal part of a number. it rounds the number to the nearest whole number.

  3. #3
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386

    Post

    Use the \ as devide-thingie (whatever that's called in English...)

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

  4. #4
    Hyperactive Member
    Join Date
    Jan 2000
    Location
    Gloucestershire, England
    Posts
    301

    Post

    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).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width