Hello.
I am writing a program that can do processes on huge numbers with floating point.
but I have a problem.I can't write divide function (I am overloading '/').
I don't know it's algorithm.
Can anybody help me?
Thanks :)
#include <vector>
#include <sstream>
class decimal_t
{
std::vector<int> before;
std::vector<int> after;
public:
decimal_t(double d)
{
// convert double into a list of ints before and after the decimal point.
}
decimal_t operator+(const decomal_t& rhs)
{
decimal_t d;
// add rhs to this object
return d;
}
decimal_t operator/(const decomal_t& rhs)
{
decimal_t d;
// divide this object by rhs
return d;
}
};
No.
I don't do that. I show numbers like " a.bc... * 10^n " .
abc... is an array of unsigned characters and n is an integer.
this is too easier and occupys less memory.
If you want to know more I will tell you :)