large numbers

This is a discussion on large numbers within the C++ Programming forums, part of the General Programming Boards category; I am sure this has been asked before but I was unable to find it. I am working on a ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    4

    large numbers

    I am sure this has been asked before but I was unable to find it. I am working on a math program and figured hey lets use c++ everything is great until I start programing for factorials. Well in short does anyone know of a library or package for dev C++ or .net that allows me to have integers greater then the oh so high long int. If not does anyone know how to get unsigned int 32 to work with the % fuction. But that still will only cover me for a bit I really could use a library that has all the functions that a long int would have just i need it to float.

    Thanks in advance,
    starripper

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    If you want really big numbers, use a library
    http://www.swox.com/gmp/

    BTW, there is no problem with % on any integer types.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    4
    Thanks for the link I will give this a shot. I think my % not working with unsigned has something to do with my compiler not letting me include system but not to sure.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    Unless you post your code, and appropriate error messages, sample values, results (expected or otherwise), it's hard to say what's going on.

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,299
    % is a built-in operator, just like +.
    Post your code.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Maybe you're using % on a floating point type, like this?
    Code:
    double x = 4, y = x % 3;
    If so, you can use the function fmod() instead.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to deal wth large numbers
    By bvgsrs in forum C++ Programming
    Replies: 2
    Last Post: 06-18-2007, 06:16 AM
  2. Handling Large Numbers
    By Xzyx987X in forum C Programming
    Replies: 2
    Last Post: 05-03-2004, 02:33 PM
  3. Using really big numbers!
    By Machewy in forum C++ Programming
    Replies: 11
    Last Post: 02-26-2004, 09:49 AM
  4. Help needed with VERY large numbers.
    By jwarner in forum C++ Programming
    Replies: 4
    Last Post: 01-18-2004, 11:01 AM
  5. A (complex) question on numbers
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 02-03-2002, 05:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21