1. DroidForums.net is currently undergoing a major software upgrade. If you are experiencing any problems logging in please: Contact Us

what is a float or long

Discussion in 'Android Hacks and Help' started by akasoldats, Oct 22, 2010.

  1. akasoldats
    Offline

    akasoldats New Member

    Joined:
    Nov 15, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    I've started reading a book about android development. In one of the exercises it asks the reader to declare either a float, long, string, integer, or a boolean. I know what the last three would be used for but dont exactly understand what the first two are. Could someone give me a definition on what they would be used for?
  2. Abe21599
    Online

    Abe21599 Super Moderator

    Joined:
    Dec 22, 2009
    Messages:
    6,345
    Likes Received:
    29
    Trophy Points:
    48
    Location:
    Ohio
  3. superkeest
    Offline

    superkeest New Member

    Joined:
    Jan 21, 2010
    Messages:
    67
    Likes Received:
    0
    Trophy Points:
    0
  4. patelhimesh
    Offline

    patelhimesh New Member

    Joined:
    Sep 29, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Float used for decimal
    Long used for large integer
  5. akasoldats
    Offline

    akasoldats New Member

    Joined:
    Nov 15, 2009
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    Lol sorry about the noob question, but thanks. Haha so thats what it feels like to be on the receiving end of LMGTFY.... not nearly as fun sending it.
  6. HarvesterX™
    Offline

    HarvesterX™ Member

    Joined:
    May 13, 2010
    Messages:
    537
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Virginia, USA
    When using decimals you are better off using double instead of float, especially if many calculations are going to be made and precision is of importance. Also I do believe that most processors are optimized to handle doubles with greater efficiency.

    An integer is always going to be the size of the processor's register...so 32bit cpus will have 32bit integers and so on.