+ Reply to Thread
Results 1 to 3 of 3

Thread: Difference between double and float [english]

  1. #1

    Difference between double and float [english]

    Difference between double and float


    [28.11.2010 02:29:19] Hallaghan [Third Eye] каза: it's the precision
    [28.11.2010 02:29:21] Hallaghan [Third Eye] каза: as in here
    [28.11.2010 02:29:24] Hallaghan [Third Eye] каза: 1,8731
    [28.11.2010 02:29:32] Hallaghan [Third Eye] каза: see the number of decimal places?
    [28.11.2010 02:29:36] Bloo каза: yeh?
    [28.11.2010 02:29:43] Hallaghan [Third Eye] каза: double allows more places and they become more precise
    [28.11.2010 02:29:53] Hallaghan [Third Eye] каза: float has a limit of decimal places
    [28.11.2010 02:30:10] Hallaghan [Third Eye] каза: and when it applies redundancy, it usually doesn't do it right
    [28.11.2010 02:30:17] Hallaghan [Third Eye] каза: for casual numbers, it's okay
    [28.11.2010 02:30:29] Hallaghan [Third Eye] каза: but applications which manage money, we always use doubles
    [28.11.2010 02:30:31] Bloo каза: aaah so this is why when i calculate hiiigh numbers
    [28.11.2010 02:30:41] Bloo каза: like 686854254*254245= 5.e-14 or smth like that
    [28.11.2010 02:30:50] Hallaghan [Third Eye] каза: you can't fit a big decimal number into a float
    [28.11.2010 02:31:00] Bloo каза: so only double
    [28.11.2010 02:31:02] Bloo каза: k ty
    [28.11.2010 02:31:04] Hallaghan [Third Eye] каза: that's the same with the use of int32 and int64
    [28.11.2010 02:31:31] Hallaghan [Third Eye] каза: they only differ in how much memory they can allocate
    [28.11.2010 02:31:45] Hallaghan [Third Eye] каза: int64 lets you allocate a much bigger range of integers
    Crazy forum admin
    PS: sorry for adverts, but bills ain't gonna pay themselves

  2. #2

    Decimal vs Double vs Float

    The Decimal, Double, and Float variable types are different in the way that they store the values. Precision is the main difference where float is a single precision (32 bit) floating point data type, double is a double precision (64 bit) floating point data type and decimal is a 128-bit floating point data type.

    Float - 32 bit (7 digits)

    Double - 64 bit (15-16 digits)

    Decimal - 128 bit (28-29 significant digits)

    More about......Decimal vs Double vs Float

    Lynda

  3. #3
    The default choice for a floating-point type should be double. This is also the type that you get with floating-point literals without a suffix or (in C) standard functions that operate on floating point numbers (e.g. exp, sin, etc.).

    float should only be used if you need to operate on a lot of floating-point numbers (think in the order of thousands or more) and analysis of the algorithm has shown that the reduced range and accuracy don't pose a problem.

    long double can be used if you need more range or accuracy than double, and if it provides this on your target platform.
    In summary, float and long double should be reserved for use by the specialists, with double for "every-day" use.

+ Reply to Thread

Similar Threads

  1. Replies: 0
    Last Post: 09-08-2011, 01:21 AM

Posting Permissions

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