My favorites | Sign in
Project Logo
                
Search
for
Updated May 24, 2008 by xianggenw
Labels: Featured, Phase-Design
Home  

Demand Analysis and Function Design

  • Support "+"(operator and sign operator) "-" "multiply" "/" "++" "--" ">" "<" ">=" "<=" "==" "!=" "bit operations" "power" "log" "sqrt" "%" etc operations;
  • All numbers are stored in class as char, which the dimension is 1000( const int LEN = 1000);
  • "+" "-" "multiply" "/" and "%"( I donot know whether mod is a operator ) are member functions( overloaded ).
  • function "power" "log" and "sqrt" are provied as undepended functions which take several class objects as their parameters. "power" "log" and "sqrt" are also member functions in class. The relationship between member "power" and non-member "power"(for example) is like this:
  •   namespace billjeff {
        class BigNumbers {
        public:
          void power( const BigNumbers& n ) { ... }
        }
        ...
        void power( BigNumbers& base, const BigNumber& pow ) {
          base.power(pow) ;
        }
      }
  • class ctr: Accept string/char based parameter for ctr, the default number base is 10, user can spicify the base by providing another parameter for ctr; provides default ctr to support array;
  • useful functions: class provides a function to convert the "big number" to string or char;

Memory Model

Decimal

Detailed Issues

and
  bool operator( BigReal&, BigInt& );
are candidate functions. All these operators are class specific fucntions, it means that BigInt and BigReal should have their own overloaded operators. It can use BigReal as all operators' parameter, but it is not good. For example, if we implement just one function
  template <class T, class V> 
    BigReal operator+( const T &a, const V &b );
when we do add operations for two BigInt objects, we have to convert the result back to BigInt! It makes no sence.

Class List

About Exception

Function List

Experience


Sign in to add a comment
Hosted by Google Code