Find the answer to your Linux question:
Results 1 to 2 of 2
Hello all, Basically, I am on a Linux system. I have written code to use a key of DOUBLE. I was trying to represent a large number - so - ...
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Posts
    33

    Suggestions to represent a BIG number

    Hello all,

    Basically, I am on a Linux system.

    I have written code to use a key of DOUBLE. I was trying to represent a large number - so -
    I thought I would do it as :

    <date>.<incremental-number>

    So, it would be:

    20100710.000001,
    20100710.000002, etc.

    and then to reset the <incremental-number> back to 0 at the end of the day.

    So,

    It works well with the Oracle DB.
    It works well with the Linux OS.

    but then, I started using a SOAP product defined here:
    gSOAP: SOAP C++ Web Services

    and then it all went to pot

    When using setting up the client (using this SOAP functionality), a number that is:

    20100710.000234 just comes out as 20100710.000000

    Now I am trying to redo the system using a NEW key - never mind that it took over a year to
    develop.

    But, before doing so, I just need to make sure that the data type representation will work.

    Any ideas on the best way to represent a large key?

    TIA

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    It sounds to me like you actually have two keys: a date and an incremental ID. Therefore, you're better off using two separate pieces of data here.

    For the date part, there is already a datatype for this called time_t. It gives the number of seconds since January 1, 1970 00:00 UTC. You can parse a time_t into year, month, day, etc. by using the function gmtime() (see "man gmtime" for more information).

    For the incremental number, assuming you start at 0 and increase, you can try an unsigned long int. You may also be able to use an unsigned long long int. It is unlikely that in a single day you will surpass the storage of an unsigned long int (0 - 2^32). If you may exceed even these numbers, you can try something like libgmp:
    The GNU MP Bignum Library
    DISTRO=Arch
    Registered Linux User #388732

Posting Permissions

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