#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    73
    Rep Power
    2

    "long long long" too long?


    I have a problem that "long long long" is too long for GCC .

    I can't use a 64-bit integer in codeblocks?

    how do I use a 64-bit integer in codeblocks...? Is it possible??
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,379
    Rep Power
    1871
    Yes, you can use a long long in code::blocks (with gcc), but if you're on windows, then you need to use the microsoft specific format for long longs.
    click me
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    73
    Rep Power
    2
    Originally Posted by salem
    Yes, you can use a long long in code::blocks (with gcc), but if you're on windows, then you need to use the microsoft specific format for long longs.
    click me
    I'm on windows 7 64 bit.
    And didn't quite understand what you said about microsoft specific format...looked into the page, couldn't understand it.

    I want to use numbers bigger than (+-)2 billion something which is possible with 32bits...

    and I am able to use "long long" already. I need "long long long" (3x "long").
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    There isn't any official type called long long long in C or C++. However there are some multiple precision libraries that let you compute to arbitrary precisions (subject to how much RAM you have in your computer). One such library is GNU MP Bignum library. See if that helps you out or google for "multiple precision library" to see other libraries (MPIR is another one).

    Whoops, just noticed you wanted a 64 bit integer. Try #include <stdint.h> and declare your type as u64_t or i64_t for unsigned int or int.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    73
    Rep Power
    2
    Originally Posted by Scorpions4ever
    There isn't any official type called long long long in C or C++. However there are some multiple precision libraries that let you compute to arbitrary precisions (subject to how much RAM you have in your computer). One such library is GNU MP Bignum library. See if that helps you out or google for "multiple precision library" to see other libraries (MPIR is another one).

    Whoops, just noticed you wanted a 64 bit integer. Try #include <stdint.h> and declare your type as u64_t or i64_t for unsigned int or int.
    int64_t doesnt work for 19 digit number...

    I tested it for all numbers from 20 to 10 digit. 10 digit worked(the number I entered was 1 billion something which is in range of 32bit numbers).

    And the triple long or "long long long", I found here :

    http://en.wikipedia.org/wiki/Integer_(computer_science)

    And codeblocks seems to recognize "long long long" but gives an error that : "long long long is too long for gcc blah blah..."
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    75
    Rep Power
    0
    try convert it into string ...

IMN logo majestic logo threadwatch logo seochat tools logo