Rational

Arbitrary-precision rational numbers, represented as a ratio of two Integer values. A rational number may be constructed using the % operator.
Ratio of two integers
Rational classes
Symbolic rationals, corresponds to Haskell's Rational type
This module introduces Rat kind and all necessary functional.
Read a rational number. This function accepts an optional leading sign character, followed by at least one decimal digit. The syntax similar to that accepted by the read function, with the exception that a trailing '.' or 'e' not followed by a number is not consumed. Examples:
rational "3"     == Right (3.0, "")
rational "3.1"   == Right (3.1, "")
rational "3e4"   == Right (30000.0, "")
rational "3.1e4" == Right (31000.0, "")
rational ".3"    == Left "input does not start with a digit"
rational "e3"    == Left "input does not start with a digit"
Examples of differences from read:
rational "3.foo" == Right (3.0, ".foo")
rational "3e"    == Right (3.0, "e")
Read a rational number. This function accepts an optional leading sign character, followed by at least one decimal digit. The syntax similar to that accepted by the read function, with the exception that a trailing '.' or 'e' not followed by a number is not consumed. Examples (with behaviour identical to read):
rational "3"     == Right (3.0, "")
rational "3.1"   == Right (3.1, "")
rational "3e4"   == Right (30000.0, "")
rational "3.1e4" == Right (31000.0, "")
rational ".3"    == Left "input does not start with a digit"
rational "e3"    == Left "input does not start with a digit"
Examples of differences from read:
rational "3.foo" == Right (3.0, ".foo")
rational "3e"    == Right (3.0, "e")
Parse a rational number. The syntax accepted by this parser is the same as for double. Note: this parser is not safe for use with inputs from untrusted sources. An input with a suitably large exponent such as "1e1000000000" will cause a huge Integer to be allocated, resulting in what is effectively a denial-of-service attack. In most cases, it is better to use double or scientific instead.
The document (rational r) shows the literal rational r using text.
The document (rational r) shows the literal rational r using text.
Undefined Rational value for use with type binding operators.
The document rational r is equivalent to text (show r).
Parse a rational number. The syntax accepted by this parser is the same as for double. Note: this parser is not safe for use with inputs from untrusted sources. An input with a suitably large exponent such as "1e1000000000" will cause a huge Integer to be allocated, resulting in what is effectively a denial-of-service attack. In most cases, it is better to use double or scientific instead.
The document (rational r) shows the literal rational r using text.
Create a rational number with numerator and denominator