|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mot.iden.math.Float
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 |
public static final int MAX_PRECISION
public static final int DEFAULT_PRECISION
public static int NO_PRECISION
Constructor Detail |
public Float(java.lang.String f) throws java.lang.IllegalArgumentException, java.lang.NumberFormatException
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.
java.lang.NumberFormatException
- if the strings do not contain
parsable floating point numbers.
java.lang.IllegalArgumentException
- if the argument is nullMethod Detail |
public static final java.lang.String add(java.lang.String operand1, java.lang.String operand2) throws java.lang.NumberFormatException
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:
operand1
- A String
containing a floating-point number.operand2
- A String
containing a floating-point number.
java.lang.NumberFormatException
- if the strings do not contain
parsable floating point numbers.Math.add(Float,Float)
public static final Float add(Float operand1, Float operand2)
operand1
- A Float
containing a floating-point number.operand2
- A Float
containing a floating-point number.
java.lang.IllegalArgumentException
- if any operand is nullMath.add(Float,Float)
public static final java.lang.String subtract(java.lang.String operand1, java.lang.String operand2) throws java.lang.NumberFormatException
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:
operand1
- A String
containing a floating-point number.operand2
- A String
containing the floating-point number
to be subtracted from operand1.
operand2
from operand1
as a new string object.
java.lang.NumberFormatException
- if the strings do not contain
parsable floating point numbers.Math.subtract(Float,Float)
public static final Float subtract(Float operand1, Float operand2)
operand1
- A Float
containing a floating-point number.operand2
- A Float
containing a floating-point number.
java.lang.IllegalArgumentException
- if any operand is nullMath.subtract(Float,Float)
public static final java.lang.String multiply(java.lang.String operand1, java.lang.String operand2) throws java.lang.NumberFormatException
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:
operand1
- A String
containing a floating-point number.operand2
- A String
containing a floating-point number.
java.lang.NumberFormatException
- if the strings do not contain
parsable floating point numbers.Math.multiply(Float,Float)
public static final Float multiply(Float operand1, Float operand2)
operand1
- A Float
containing a floating-point number.operand2
- A Float
containing a floating-point number.
java.lang.IllegalArgumentException
- if any operand is nullMath.multiply(Float,Float)
public static final java.lang.String divide(java.lang.String operand1, java.lang.String operand2) throws java.lang.NumberFormatException, java.lang.ArithmeticException
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:
operand1
- A String
containing the dividend as a floating-point
number.operand2
- A String
containing the divisor as a floating-point
number.
operand1
by operand2
as a new string
object.
java.lang.NumberFormatException
- if the strings do not contain parsable floating point
numbers.
java.lang.ArithmeticException
- if the second argument represents zero.Math.divide(Float,Float)
public static final Float divide(Float operand1, Float operand2) throws java.lang.ArithmeticException
operand1
- A Float
containing a floating-point number.operand2
- A Float
containing a floating-point number.
java.lang.IllegalArgumentException
- if any operand is null
java.lang.ArithmeticException
Math.divide(Float,Float)
public static final java.lang.String sqrt(java.lang.String operand) throws java.lang.NumberFormatException, java.lang.ArithmeticException
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:
operand
- the String
containing a floating-point number.
operand
as a new string object.
java.lang.NumberFormatException
- if the string does not contain
parsable floating point number.
java.lang.ArithmeticException
- if the argument represents a negative number.Math.sqrt(Float)
public static final Float sqrt(Float operand) throws java.lang.ArithmeticException
operand
- A Float
containing a floating-point number.
java.lang.ArithmeticException
- if the argument represents a negative number.
java.lang.IllegalArgumentException
- if operand is nullMath.sqrt(Float)
public static final java.lang.String pow(java.lang.String operand, int exponent) throws java.lang.NumberFormatException, java.lang.ArithmeticException
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:
operand
- the String
containing a floating-point number.exponent
- the int
containing a positive integer.
operand
to the power of exponent
as a
new string object.
java.lang.NumberFormatException
- if the string does not contain
parsable floating point number.
java.lang.ArithmeticException
- if the exponent
represents a negative
number.Math.pow(Float,int)
public static final Float pow(Float operand, int exponent) throws java.lang.ArithmeticException
operand
- A Float
containing a floating-point number.exponent
- the int
containing a positive integer.
java.lang.ArithmeticException
- if the exponent
represents a negative number.
java.lang.IllegalArgumentException
- if operand is nullMath.pow(Float,int)
public static void setPrecision(int digits) throws java.lang.IllegalArgumentException
An exception of type IllegalArgumentException is thrown if any of the following situations occurs:
digits
- the number of decimal places to be used when composing the
results.
java.lang.IllegalArgumentException
- if digits
is outside the
range of valid precision values [0; MAX_PRECISION]
public static void setPrecision(int digits, Float thisFloat) throws java.lang.IllegalArgumentException
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:
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.
java.lang.IllegalArgumentException
- if digits
is outside the range of
valid precision values [0; MAX_PRECISION]
or thisFloat is nullpublic static int getPrecision()
public static int getPrecision(Float thisFloat) throws java.lang.IllegalArgumentException
thisFloat
- the Float from which the precision value will be gotten.
java.lang.IllegalArgumentException
- if thisFloat is nullpublic java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |