SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.number
Enum DoubleUtils.RoundingScheme

java.lang.Object
  extended by java.lang.Enum<DoubleUtils.RoundingScheme>
      extended by com.numericalmethod.suanshu.number.DoubleUtils.RoundingScheme
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<DoubleUtils.RoundingScheme>
Enclosing class:
DoubleUtils

public static enum DoubleUtils.RoundingScheme
extends java.lang.Enum<DoubleUtils.RoundingScheme>

the schemes available to round a number.


Enum Constant Summary
DEFAULT
          Use the scheme as in Math.round(float).
DOWN
          Always round down.
UP
          Always round up.
 
Method Summary
static DoubleUtils.RoundingScheme valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static DoubleUtils.RoundingScheme[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

DEFAULT

public static final DoubleUtils.RoundingScheme DEFAULT
Use the scheme as in Math.round(float). That is, returning the closest long to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting the result to type long.


UP

public static final DoubleUtils.RoundingScheme UP
Always round up. This is done by taking the ceiling of the value after subtracting a very tiny number.


DOWN

public static final DoubleUtils.RoundingScheme DOWN
Always round down. This is done by taking the floor of the value after adding a very tiny number.

Method Detail

values

public static DoubleUtils.RoundingScheme[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (DoubleUtils.RoundingScheme c : DoubleUtils.RoundingScheme.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static DoubleUtils.RoundingScheme valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.