com.mot.iden.math
Class Float

java.lang.Object
  extended bycom.mot.iden.math.Float

public class Float
extends java.lang.Object

Class to provide the following arithmetic operations: Addition, Subtraction, Multiplication, Division, Power, and Square root.


Field Summary
static int DEFAULT_PRECISION
          Default precision in number of decimal places
static int MAX_PRECISION
          Maximum precision in number of decimal places
static int NO_PRECISION
          No precision set yet for this Float object.
 
Constructor Summary
Float(java.lang.String f)
          Allocates a new floating-point object from the specified String argument.
 
Method Summary
static Float add(Float operand1, Float operand2)
          Deprecated.  
static java.lang.String add(java.lang.String operand1, java.lang.String operand2)
          Deprecated.  
static Float divide(Float operand1, Float operand2)
          Deprecated.  
static java.lang.String divide(java.lang.String operand1, java.lang.String operand2)
          Deprecated.  
static int getPrecision()
          Gets the current global precision of the floating-point operations.
static int getPrecision(Float thisFloat)
          Gets the current precision of the specified Float.
static Float multiply(Float operand1, Float operand2)
          Deprecated.  
static java.lang.String multiply(java.lang.String operand1, java.lang.String operand2)
          Deprecated.  
static Float pow(Float operand, int exponent)
          Deprecated.  
static java.lang.String pow(java.lang.String operand, int exponent)
          Deprecated.  
static void setPrecision(int digits)
          Sets the number of decimal places used when rendering results of floating-point operation as Strings.
static void setPrecision(int digits, Float thisFloat)
          Sets the number of decimal places used when rendering this Float as String.
static Float sqrt(Float operand)
          Deprecated.  
static java.lang.String sqrt(java.lang.String operand)
          Deprecated.  
static Float subtract(Float operand1, Float operand2)
          Deprecated.  
static java.lang.String subtract(java.lang.String operand1, java.lang.String operand2)
          Deprecated.  
 java.lang.String toString()
          Renders this Float object as a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_PRECISION

public static final int MAX_PRECISION
Maximum precision in number of decimal places

See Also:
Constant Field Values

DEFAULT_PRECISION

public static final int DEFAULT_PRECISION
Default precision in number of decimal places

See Also:
Constant Field Values

NO_PRECISION

public static int NO_PRECISION
No precision set yet for this Float object. Instead use gbl_precision.

Constructor Detail

Float

public Float(java.lang.String f)
      throws java.lang.IllegalArgumentException,
             java.lang.NumberFormatException
Allocates a new floating-point object from the specified String argument.

The argument is converted to a signed decimal floating point number. The characters in the string must all be ASCII digits 0 to 9 ('\u0030' to '\u0039') or a period '.' ('\u0056'), except that the first character which may be an ASCII minus sign '-' ('\u002d') to indicate a negative value.

An exception of type NumberFormatException is thrown if any of the following situations occurs:

An exception of type IllegalArgumentException is thrown if the argument is null.

Throws:
java.lang.NumberFormatException - if the strings do not contain parsable floating point numbers.
java.lang.IllegalArgumentException - if the argument is null
Method Detail

add

public static final java.lang.String add(java.lang.String operand1,
                                         java.lang.String operand2)
                                  throws java.lang.NumberFormatException
Deprecated.  

Returns the floating-point addition of the two specified arguments as a new String object. Both arguments are converted to signed decimal floating point numbers before the calculation is performed. The characters in the string must all ASCII digits 0 to 9 ('\u0030' to '\u0039') or a period '.' ('\u0056'), except that the first character may be an ASCII minus sign '-' ('\u002d') to indicate a negative value.

An exception of type NumberFormatException is thrown if any of the following situations occurs:

Parameters:
operand1 - A String containing a floating-point number.
operand2 - A String containing a floating-point number.
Returns:
the addition of the two arguments as a new string object.
Throws:
java.lang.NumberFormatException - if the strings do not contain parsable floating point numbers.
See Also:
Math.add(Float,Float)

add

public static final Float add(Float operand1,
                              Float operand2)
Deprecated.  

Returns the floating-point addition of the two specified Float arguments as a new Float object.

Parameters:
operand1 - A Float containing a floating-point number.
operand2 - A Float containing a floating-point number.
Returns:
the addition of the two arguments as a new Float object.
Throws:
java.lang.IllegalArgumentException - if any operand is null
See Also:
Math.add(Float,Float)

subtract

public static final java.lang.String subtract(java.lang.String operand1,
                                              java.lang.String operand2)
                                       throws java.lang.NumberFormatException
Deprecated.  

Returns the floating-point subtraction of the two specified arguments as a new String object. Both arguments are converted to signed decimal floating point numbers before the calculation is performed. The characters in the string must all ASCII digits 0 to 9 ('\u0030' to '\u0039') or a period '.' ('\u0056'), except that the first character may be an ASCII minus sign '-' ('\u002d') to indicate a negative value.

An exception of type NumberFormatException is thrown if any of the following situations occurs:

Parameters:
operand1 - A String containing a floating-point number.
operand2 - A String containing the floating-point number to be subtracted from operand1.
Returns:
the subtraction of operand2 from operand1 as a new string object.
Throws:
java.lang.NumberFormatException - if the strings do not contain parsable floating point numbers.
See Also:
Math.subtract(Float,Float)

subtract

public static final Float subtract(Float operand1,
                                   Float operand2)
Deprecated.  

Returns the floating-point subtraction of the two specified Float arguments as a new Float object.

Parameters:
operand1 - A Float containing a floating-point number.
operand2 - A Float containing a floating-point number.
Returns:
the subtraction of the two arguments as a new Float object.
Throws:
java.lang.IllegalArgumentException - if any operand is null
See Also:
Math.subtract(Float,Float)

multiply

public static final java.lang.String multiply(java.lang.String operand1,
                                              java.lang.String operand2)
                                       throws java.lang.NumberFormatException
Deprecated.  

Returns the floating-point multiplication of the two specified arguments as a new String object. Both arguments are converted to signed decimal floating point numbers before the calculation is performed. The characters in the string must all ASCII digits 0 to 9 ('\u0030' to '\u0039') or a period '.' ('\u0056'), except that the first character may be an ASCII minus sign '-' ('\u002d') to indicate a negative value.

An exception of type NumberFormatException is thrown if any of the following situations occurs:

Parameters:
operand1 - A String containing a floating-point number.
operand2 - A String containing a floating-point number.
Returns:
the multiplication of the two operands as a new string object.
Throws:
java.lang.NumberFormatException - if the strings do not contain parsable floating point numbers.
See Also:
Math.multiply(Float,Float)

multiply

public static final Float multiply(Float operand1,
                                   Float operand2)
Deprecated.  

Returns the floating-point multiplication of the two specified Float arguments as a new Float object.

Parameters:
operand1 - A Float containing a floating-point number.
operand2 - A Float containing a floating-point number.
Returns:
the multiplication of the two arguments as a new Float object.
Throws:
java.lang.IllegalArgumentException - if any operand is null
See Also:
Math.multiply(Float,Float)

divide

public static final java.lang.String divide(java.lang.String operand1,
                                            java.lang.String operand2)
                                     throws java.lang.NumberFormatException,
                                            java.lang.ArithmeticException
Deprecated.  

Returns the floating-point division of the two specified arguments as a new String object. Both arguments are converted to signed decimal floating point numbers before the calculation is performed. The characters in the string must all ASCII digits 0 to 9 ('\u0030' to '\u0039') or a period '.' ('\u0056'), except that the first character may be an ASCII minus sign '-' ('\u002d') to indicate a negative value.

An exception of type NumberFormatException is thrown if any of the following situations occurs:

An exception of type ArithmeticException is thrown if operand2 is zero.

Parameters:
operand1 - A String containing the dividend as a floating-point number.
operand2 - A String containing the divisor as a floating-point number.
Returns:
the division of operand1 by operand2 as a new string object.
Throws:
java.lang.NumberFormatException - if the strings do not contain parsable floating point numbers.
java.lang.ArithmeticException - if the second argument represents zero.
See Also:
Math.divide(Float,Float)

divide

public static final Float divide(Float operand1,
                                 Float operand2)
                          throws java.lang.ArithmeticException
Deprecated.  

Returns the floating-point division of the two specified Float arguments as a new Float object.

Parameters:
operand1 - A Float containing a floating-point number.
operand2 - A Float containing a floating-point number.
Returns:
the division of the two arguments as a new Float object.
Throws:
java.lang.IllegalArgumentException - if any operand is null
java.lang.ArithmeticException
See Also:
Math.divide(Float,Float)

sqrt

public static final java.lang.String sqrt(java.lang.String operand)
                                   throws java.lang.NumberFormatException,
                                          java.lang.ArithmeticException
Deprecated.  

Returns the floating-point square-root of the specified argument as a new String object. The argument is converted to signed decimal floating point number before the calculation is performed. The characters in the string must all ASCII digits 0 to 9 ('\u0030' to '\u0039') or a period '.' ('\u0056'), except that the first character may be an ASCII minus sign '-' ('\u002d') to indicate a negative value.

An exception of type NumberFormatException is thrown if any of the following situations occurs:

Parameters:
operand - the String containing a floating-point number.
Returns:
the square-root of the operand as a new string object.
Throws:
java.lang.NumberFormatException - if the string does not contain parsable floating point number.
java.lang.ArithmeticException - if the argument represents a negative number.
See Also:
Math.sqrt(Float)

sqrt

public static final Float sqrt(Float operand)
                        throws java.lang.ArithmeticException
Deprecated.  

Returns the floating-point square root of the specified Float argument as a new Float object.

Parameters:
operand - A Float containing a floating-point number.
Returns:
the square root of the argument as a new Float object.
Throws:
java.lang.ArithmeticException - if the argument represents a negative number.
java.lang.IllegalArgumentException - if operand is null
See Also:
Math.sqrt(Float)

pow

public static final java.lang.String pow(java.lang.String operand,
                                         int exponent)
                                  throws java.lang.NumberFormatException,
                                         java.lang.ArithmeticException
Deprecated.  

Returns the floating-point power to exp of the specified argument as a new String object. The argument is converted to signed decimal floating point number before the calculation is performed. The characters in the string must all ASCII digits 0 to 9 ('\u0030' to '\u0039') or a period '.' ('\u0056'), except that the first character may be an ASCII minus sign '-' ('\u002d') to indicate a negative value.

An exception of type NumberFormatException is thrown if any of the following situations occurs:

Parameters:
operand - the String containing a floating-point number.
exponent - the int containing a positive integer.
Returns:
the operand to the power of exponent as a new string object.
Throws:
java.lang.NumberFormatException - if the string does not contain parsable floating point number.
java.lang.ArithmeticException - if the exponent represents a negative number.
See Also:
Math.pow(Float,int)

pow

public static final Float pow(Float operand,
                              int exponent)
                       throws java.lang.ArithmeticException
Deprecated.  

Returns the floating-point of the specified Float argument to the power of the specified exponent as a new Float object.

Parameters:
operand - A Float containing a floating-point number.
exponent - the int containing a positive integer.
Returns:
the argument to the power of exponent as a new Float object.
Throws:
java.lang.ArithmeticException - if the exponent represents a negative number.
java.lang.IllegalArgumentException - if operand is null
See Also:
Math.pow(Float,int)

setPrecision

public static void setPrecision(int digits)
                         throws java.lang.IllegalArgumentException
Sets the number of decimal places used when rendering results of floating-point operation as Strings.

An exception of type IllegalArgumentException is thrown if any of the following situations occurs:

Parameters:
digits - the number of decimal places to be used when composing the results.
Throws:
java.lang.IllegalArgumentException - if digits is outside the range of valid precision values [0; MAX_PRECISION]

setPrecision

public static void setPrecision(int digits,
                                Float thisFloat)
                         throws java.lang.IllegalArgumentException
Sets the number of decimal places used when rendering this Float as String.

If no precision has been set for this Float, the default global precision is used. An exception of type IllegalArgumentException is thrown if any of the following situations occurs:

Parameters:
digits - the number of decimal places to be used when composing the String.
thisFloat - the Float to which the new precision value will be applied.
Throws:
java.lang.IllegalArgumentException - if digits is outside the range of valid precision values [0; MAX_PRECISION] or thisFloat is null

getPrecision

public static int getPrecision()
Gets the current global precision of the floating-point operations.


getPrecision

public static int getPrecision(Float thisFloat)
                        throws java.lang.IllegalArgumentException
Gets the current precision of the specified Float. If the precision of this Float object hasn't been explicitly set, it returns the global precision.

Parameters:
thisFloat - the Float from which the precision value will be gotten.
Throws:
java.lang.IllegalArgumentException - if thisFloat is null

toString

public java.lang.String toString()
Renders this Float object as a String