mondrian.util
Class Format.FDBigInt

java.lang.Object
  extended by mondrian.util.Format.FDBigInt
Enclosing class:
Format

static class Format.FDBigInt
extends java.lang.Object

A really, really simple bigint package tailored to the needs of floating base conversion.


Field Summary
(package private)  int[] data
           
(package private)  int nWords
           
 
Constructor Summary
Format.FDBigInt(Format.FDBigInt other)
           
Format.FDBigInt(int v)
           
Format.FDBigInt(long v)
           
 
Method Summary
 Format.FDBigInt add(Format.FDBigInt other)
          Add one FDBigInt to another.
 int cmp(Format.FDBigInt other)
          Compare FDBigInt with another FDBigInt.
 long longValue()
           
 void lshiftMe(int c)
           
 Format.FDBigInt mult(Format.FDBigInt other)
          Multiply a FDBigInt by another FDBigInt.
 Format.FDBigInt mult(int iv)
          Multiply a FDBigInt by an int.
 int normalizeMe()
          normalize this number by shifting until the MSB of the number is at 0x08000000.
 int quoRemIteration(Format.FDBigInt S)
          Compute q = (int)(this / S) this = 10 * (this mod S) Return q.
static void setDebugging(boolean d)
           
 Format.FDBigInt sub(Format.FDBigInt other)
          Subtract one FDBigInt from another.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nWords

int nWords

data

int[] data
Constructor Detail

Format.FDBigInt

public Format.FDBigInt(int v)

Format.FDBigInt

public Format.FDBigInt(long v)

Format.FDBigInt

public Format.FDBigInt(Format.FDBigInt other)
Method Detail

setDebugging

public static void setDebugging(boolean d)

lshiftMe

public void lshiftMe(int c)
              throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

normalizeMe

public int normalizeMe()
                throws java.lang.IllegalArgumentException
normalize this number by shifting until the MSB of the number is at 0x08000000. This is in preparation for quoRemIteration, below. The idea is that, to make division easier, we want the divisor to be "normalized" -- usually this means shifting the MSB into the high words sign bit. But because we know that the quotient will be 0 < q < 10, we would like to arrange that the dividend not span up into another word of precision. (This needs to be explained more clearly!)

Throws:
java.lang.IllegalArgumentException

mult

public Format.FDBigInt mult(int iv)
Multiply a FDBigInt by an int. Result is a new FDBigInt.


mult

public Format.FDBigInt mult(Format.FDBigInt other)
Multiply a FDBigInt by another FDBigInt. Result is a new FDBigInt.


add

public Format.FDBigInt add(Format.FDBigInt other)
Add one FDBigInt to another. Return a FDBigInt


sub

public Format.FDBigInt sub(Format.FDBigInt other)
Subtract one FDBigInt from another. Return a FDBigInt Assert that the result is positive.


cmp

public int cmp(Format.FDBigInt other)
Compare FDBigInt with another FDBigInt. Return an integer >0: this > other 0: this == other <0: this < other


quoRemIteration

public int quoRemIteration(Format.FDBigInt S)
                    throws java.lang.IllegalArgumentException
Compute q = (int)(this / S) this = 10 * (this mod S) Return q. This is the iteration step of digit development for output. We assume that S has been normalized, as above, and that "this" has been lshift'ed accordingly. Also assume, of course, that the result, q, can be expressed as an integer, 0 <= q < 10.

Throws:
java.lang.IllegalArgumentException

longValue

public long longValue()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads