Thread: Adding largest floating point nos

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    2

    Adding largest floating point nos

    Hi
    Can any one tell me how can i add largest floating point nos in machine the result may largest no as possible in my machine
    thanks in advance
    Dhiraj

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    In order to use very huge floating point numbers or floating point numbers with a large number of digits after the comma you need to design your own datastructure and operations that will work on it.

    If you do a search on this board, you will find some other threads about this.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    2

    floating nos addition

    Hi can u give me one example

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    There are many ways to do this. One way is to use linked lists, where each node contains a digit.

    Code:
    typedef struct _digit_s digit_s;
    struct _digit_s
    {
        char digit;
        digit_s *next_digit;
    };
    You could define a special character to represent the comma.

    Code:
    #define COMMA -1
    Then you could do things just the same way you would do it on paper. Take care of the comma-position and the carry.

    A different approach is using strings to store a number.

  5. #5
    Registered User
    Join Date
    Aug 2001
    Location
    computers/ theatre, travelingstudentL>- Northern California NativeNorthern California3D&Tie-DyeStudent1>. Admirer of C Bangalore Net surfingTeacher >/ >0 nagpurteaching >1  >2
    Posts
    61
    Download a package called NTL and link in into your program. It has a class for large float operations with arbitrary precision.

    Second time I have recommended this in ten minutes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Floating Point Addition
    By ggraz in forum C Programming
    Replies: 10
    Last Post: 10-12-2008, 12:29 PM
  2. floating point function
    By Sal79 in forum C++ Programming
    Replies: 17
    Last Post: 04-17-2007, 06:49 PM
  3. Decimal places on Floating point number
    By manutdfan in forum C Programming
    Replies: 1
    Last Post: 10-29-2006, 12:56 PM
  4. How accurate is the following...
    By emeyer in forum C Programming
    Replies: 22
    Last Post: 12-07-2005, 12:07 PM
  5. checking for floating point number
    By ssharish2005 in forum C Programming
    Replies: 6
    Last Post: 10-18-2005, 08:14 PM