diff options
author | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-05-06 20:08:04 +0000 |
---|---|---|
committer | Christopher L. Conway <christopherleeconway@gmail.com> | 2010-05-06 20:08:04 +0000 |
commit | c52d38c2a134488c5212f21d963a1ae442206fc1 (patch) | |
tree | 3f97c1da41b1b16b7e85c77412831776c3312b37 /src/util | |
parent | a7e4f9c4af64e669db9df5cd13524b1ab3e47379 (diff) |
Adding tests for Rational::fromDecimal
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/rational.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/util/rational.h b/src/util/rational.h index f50b4e63e..428f4f12f 100644 --- a/src/util/rational.h +++ b/src/util/rational.h @@ -10,13 +10,7 @@ ** See the file COPYING in the top-level source directory for licensing ** information. ** - ** A multiprecision rational constant. - ** This stores the rational as a pair of multiprecision integers, - ** one for the numerator and one for the denominator. - ** The number is always stored so that the gcd of the numerator and denominator - ** is 1. (This is referred to as referred to as canonical form in GMP's - ** literature.) A consquence is that that the numerator and denominator may be - ** different than the values used to construct the Rational. + ** Multi-precision rational constants. **/ #include "cvc4_public.h" @@ -30,6 +24,21 @@ namespace CVC4 { +/** + ** A multi-precision rational constant. + ** This stores the rational as a pair of multi-precision integers, + ** one for the numerator and one for the denominator. + ** The number is always stored so that the gcd of the numerator and denominator + ** is 1. (This is referred to as referred to as canonical form in GMP's + ** literature.) A consequence is that that the numerator and denominator may be + ** different than the values used to construct the Rational. + ** + ** NOTE: The correct way to create a Rational from an int is to use one of the + ** int numerator/int denominator constructors with the denominator 1. Trying + ** to construct a Rational with a single int, e.g., Rational(0), will put you + ** in danger of invoking the char* constructor, from whence you will segfault. + **/ + class Rational { private: /** |