0

I tried to make a number system converter in which I got successful, but when it came to larger numbers then we have some boundaries, so how I can deal with largest numbers in c++, I tried to make a division function which divides number into parts and then then with parts I tried to do calculations but it has some mistakes, is there anyway to handle with largest Numbers easily?

  • It depends on what you consider "easy". – mkrieger1 May 28 '22 at 20:51
  • use an existing bin number library like https://gmplib.org/ (which has c++ bindings) – Goswin von Brederlow May 28 '22 at 20:57
  • Considering how lot of work is put into those GMP, MPFR, MPIR etc. libraries over years there are no way to do it easily. So the answer is "no", did you ask for that answer or implied some other question? – Öö Tiib May 28 '22 at 21:30
  • You need to make a distinction between how a value is represented (e.g. in an `int`, in a `BigInt` class if you have implemented one) and how that value is formatted (for example, when written to a file). A variable `x` may be formatted as decimal (say, as `10`) or as octal (output as `12`) or as hex (`A`) or even as binary (`1010`). Changing how it is formatted on output (the number system) does not change its value. An `unsigned` with value `10` and a `unsigned` with value `0xA` will always compare equal. – Peter May 29 '22 at 00:55

0 Answers0