#header-inner {background-position: right !important; width: 100% !important;}

10/16/12

Object Oriented Arbitrary Precision Arithmetics

Let's transform binary (written as list of 0's and 1's) number into form: n1*km + n2*km-1 + ... + ni*km-(i-1) [i'll call it sum of partial multiplications] where k,m,n are integer numbers (or even an 'unlimited-length' integer: bigint, or a list of digits), and i is an integer of unlimited length.

Let's define arithmetic operations on such number form, and we can have base-k arbitrary precision arithmetics.

Object Oriented paradigm can be used to define partial multiplication class, and sum of them too (arbitrary precision number, or shortly: Number).

Such Number can be used to define PreciseNumber.

PreciseNumber is similar to Number, except that we can use Numbers or PreciseNumbers instead of integers for k,m,n. It allows for much better precision, number's magnitude, and memory use.

3 comments:

  1. See also: How to precisely count using computers.

    ReplyDelete
  2. See also: base-k arbitrary precision arithmetics implementation : http://intelligent-devices.blogspot.com/2013/09/base-k-arithmetics-implementation.html

    ReplyDelete
  3. updating link: http://dragonfly-algorithm.blogspot.com/2013/09/base-k-arithmetics-implementation.html

    ReplyDelete