|
RationalFromDoubleWithMaxDenominator Method
|
Converts a floating-point decimal to a rational number.
Namespace:
Accord.Math
Assembly:
Accord (in Accord.dll) Version: 3.8.0
Syntax public static Rational FromDoubleWithMaxDenominator(
double value,
int maxDenominator,
double tolerance = 1E-06
)
Public Shared Function FromDoubleWithMaxDenominator (
value As Double,
maxDenominator As Integer,
Optional tolerance As Double = 1E-06
) As Rational
Request Example
View SourceParameters
- value
- Type: SystemDouble
A floating-point number to convert to a rational number. - maxDenominator
- Type: SystemInt32
The maximum value that the denominator can have. - tolerance (Optional)
- Type: SystemDouble
The desired maximum error between the result and the input value. This is only used as an alternative end condition;
the actual error may be greater because of the limitation on the denominator value.
Return Value
Type:
RationalA rational number.
See Also