Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math.dfp
Class DfpDec

    java.lang.Object
      org.apache.commons.math.dfp.Dfp
          org.apache.commons.math.dfp.DfpDec

All Implemented Interfaces:
  FieldElement<Dfp>

    public class DfpDec

extends Dfp

Subclass of `Dfp` which hides the radix-10000 artifacts of the superclass. This should give outward appearances of being a decimal number with DIGITS*4-3 decimal digits. This class can be subclassed to appear to be an arbitrary number of decimal digits less than DIGITS*4-3.

Since:
  2.2
Version:
  $Revision: 1003892 $ $Date: 2010-10-02 23:28:56 +0200 (sam. 02 oct. 2010) $

Field Summary

Fields inherited from class org.apache.commons.math.dfp.Dfp
`ERR_SCALE, exp, FINITE, INFINITE, mant, MAX_EXP, MIN_EXP, nans, QNAN, RADIX, sign, SNAN`

Constructor Summary
`` | `DfpDec(Dfp d)` Copy constructor.
`protected` | `DfpDec(DfpField factory)` Makes an instance with a value of zero.
`protected` | `DfpDec(DfpField factory, byte x)` Create an instance from a byte value.
`protected` | `DfpDec(DfpField factory, byte sign, byte nans)` Creates an instance with a non-finite value.
`protected` | `DfpDec(DfpField factory, double x)` Create an instance from a double value.
`protected` | `DfpDec(DfpField factory, int x)` Create an instance from an int value.
`protected` | `DfpDec(DfpField factory, long x)` Create an instance from a long value.
`protected` | `DfpDec(DfpField factory, String s)` Create an instance from a String representation.

Method Summary
`protected int` | `getDecimalDigits()` Get the number of decimal digits this class is going to represent.
`Dfp` | `newInstance()` Create an instance with a value of 0.
`Dfp` | `newInstance(byte x)` Create an instance from a byte value.
`Dfp` | `newInstance(byte sign, byte nans)` Creates an instance with a non-finite value.
`Dfp` | `newInstance(Dfp d)` Create an instance by copying an existing one.
`Dfp` | `newInstance(double x)` Create an instance from a double value.
`Dfp` | `newInstance(int x)` Create an instance from an int value.
`Dfp` | `newInstance(long x)` Create an instance from a long value.
`Dfp` | `newInstance(String s)` Create an instance from a String representation.
`Dfp` | `nextAfter(Dfp x)` Returns the next number greater than this one in the direction of x.
`protected int` | `round(int in)` Round this given the next digit n using the current rounding mode.

Methods inherited from class org.apache.commons.math.dfp.Dfp
`add, align, ceil, classify, complement, copysign, dfp2sci, dfp2string, divide, divide, dotrap, equals, floor, getField, getOne, getRadixDigits, getTwo, getZero, greaterThan, hashCode, intValue, isInfinite, isNaN, lessThan, log10, log10K, multiply, multiply, negate, power10, power10K, remainder, rint, shiftLeft, shiftRight, sqrt, subtract, toDouble, toSplitDouble, toString, trap, trunc, unequal`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DfpDec

    protected DfpDec(DfpField factory)

  Makes an instance with a value of zero.

  Parameters:
    `factory` - factory linked to this instance

### DfpDec

    protected DfpDec(DfpField factory,
                     byte x)

  Create an instance from a byte value.

  Parameters:
    `factory` - factory linked to this instance
    `x` - value to convert to an instance

### DfpDec

    protected DfpDec(DfpField factory,
                     int x)

  Create an instance from an int value.

  Parameters:
    `factory` - factory linked to this instance
    `x` - value to convert to an instance

### DfpDec

    protected DfpDec(DfpField factory,
                     long x)

  Create an instance from a long value.

  Parameters:
    `factory` - factory linked to this instance
    `x` - value to convert to an instance

### DfpDec

    protected DfpDec(DfpField factory,
                     double x)

  Create an instance from a double value.

  Parameters:
    `factory` - factory linked to this instance
    `x` - value to convert to an instance

### DfpDec

    public DfpDec(Dfp d)

  Copy constructor.

  Parameters:
    `d` - instance to copy

### DfpDec

    protected DfpDec(DfpField factory,
                     String s)

  Create an instance from a String representation.

  Parameters:
    `factory` - factory linked to this instance
    `s` - string representation of the instance

### DfpDec

    protected DfpDec(DfpField factory,
                     byte sign,
                     byte nans)

  Creates an instance with a non-finite value.

  Parameters:
    `factory` - factory linked to this instance
    `sign` - sign of the Dfp to create
    `nans` - code of the value, must be one of `Dfp.INFINITE`, `Dfp.SNAN`, `Dfp.QNAN`

Method Detail

### newInstance

    public Dfp newInstance()

  Create an instance with a value of 0. Use this internally in preference to constructors to facilitate subclasses

  Overrides:
    `newInstance` in class `Dfp`
  Returns:
    a new instance with a value of 0

### newInstance

    public Dfp newInstance(byte x)

  Create an instance from a byte value.

  Overrides:
    `newInstance` in class `Dfp`
  Parameters:
    `x` - value to convert to an instance
  Returns:
    a new instance with value x

### newInstance

    public Dfp newInstance(int x)

  Create an instance from an int value.

  Overrides:
    `newInstance` in class `Dfp`
  Parameters:
    `x` - value to convert to an instance
  Returns:
    a new instance with value x

### newInstance

    public Dfp newInstance(long x)

  Create an instance from a long value.

  Overrides:
    `newInstance` in class `Dfp`
  Parameters:
    `x` - value to convert to an instance
  Returns:
    a new instance with value x

### newInstance

    public Dfp newInstance(double x)

  Create an instance from a double value.

  Overrides:
    `newInstance` in class `Dfp`
  Parameters:
    `x` - value to convert to an instance
  Returns:
    a new instance with value x

### newInstance

    public Dfp newInstance(Dfp d)

  Create an instance by copying an existing one. Use this internally in preference to constructors to facilitate subclasses.

  Overrides:
    `newInstance` in class `Dfp`
  Parameters:
    `d` - instance to copy
  Returns:
    a new instance with the same value as d

### newInstance

    public Dfp newInstance(String s)

  Create an instance from a String representation. Use this internally in preference to constructors to facilitate subclasses.

  Overrides:
    `newInstance` in class `Dfp`
  Parameters:
    `s` - string representation of the instance
  Returns:
    a new instance parsed from specified string

### newInstance

    public Dfp newInstance(byte sign,
                           byte nans)

  Creates an instance with a non-finite value.

  Overrides:
    `newInstance` in class `Dfp`
  Parameters:
    `sign` - sign of the Dfp to create
    `nans` - code of the value, must be one of `Dfp.INFINITE`, `Dfp.SNAN`, `Dfp.QNAN`
  Returns:
    a new instance with a non-finite value

### getDecimalDigits

    protected int getDecimalDigits()

  Get the number of decimal digits this class is going to represent. Default implementation returns `Dfp.getRadixDigits()`*4-3. Subclasses can override this to return something less.

  Returns:
    number of decimal digits this class is going to represent

### round

    protected int round(int in)

  Round this given the next digit n using the current rounding mode.

  Overrides:
    `round` in class `Dfp`
  Parameters:
    `in` - ???
  Returns:
    the IEEE flag if an exception occurred

### nextAfter

    public Dfp nextAfter(Dfp x)

  Returns the next number greater than this one in the direction of x. If this==x then simply returns this.

  Overrides:
    `nextAfter` in class `Dfp`
  Parameters:
    `x` - direction where to look at
  Returns:
    closest number next to instance in the direction of x

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.