org.das2.datum.RationalNumber

represent a rational number

RationalNumber( double d )

create a rationalNumber that is very close to d.

RationalNumber( org.das2.datum.Ratio n, org.das2.datum.Ratio exp )

create a rationalNumber with n * 10^exp

RationalNumber( org.das2.datum.Ratio n )

create a rationalNumber with n * 10^exp

RationalNumber( int n )

create a rationalNumber with n * 10^exp

RationalNumber( int n, int d )

create a new rational number with numerator n and denominator d. The result will be n/d*10^0


divide

divide( org.das2.datum.RationalNumber number ) → RationalNumber

divide by the number.

Parameters

number - a RationalNumber

Returns:

an org.das2.datum.RationalNumber

[search for examples] [view on GitHub] [view on old javadoc] [view source]


doubleValue

doubleValue( ) → double

return a close representation using double.

Returns:

a double

[search for examples] [view on GitHub] [view on old javadoc] [view source]


isOne

isOne( ) → boolean

return true if the number is 1.

Returns:

true if the number is 1.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


isZero

isZero( ) → boolean

return true if the number is 0.

Returns:

true if the number is 0.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


multiply

multiply( org.das2.datum.RationalNumber number ) → RationalNumber

multiply by the number

Parameters

number - a RationalNumber

Returns:

an org.das2.datum.RationalNumber

[search for examples] [view on GitHub] [view on old javadoc] [view source]


parse

parse( String s ) → RationalNumber

parse the string to get the RationalNumber. This simply calls Double.parseDouble, but a future implementation could do a better job of this.

Parameters

s - the string.

Returns:

the RationalNumber

[search for examples] [view on GitHub] [view on old javadoc] [view source]


pow

pow( org.das2.datum.Ratio r ) → RationalNumber

Parameters

r - a Ratio

Returns:

org.das2.datum.RationalNumber

[search for examples] [view on GitHub] [view on old javadoc] [view source]


sqrt

sqrt( ) → RationalNumber

returns the sqrt of the number, e.g. 4 * 10^

Returns:

an org.das2.datum.RationalNumber

[search for examples] [view on GitHub] [view on old javadoc] [view source]


toString

toString( ) → String

Returns:

java.lang.String

[search for examples] [view on GitHub] [view on old javadoc] [view source]