Changeset 795 for trunk/rational/rational.d
- Timestamp:
- 08/28/10 23:24:19 (1 year ago)
- Files:
-
- trunk/rational/rational.d (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/rational/rational.d
r794 r795 123 123 * If you use an arbitrary precision type, it must have the relevant operators 124 124 * overloaded and have value semantics. 125 *126 * BUGS: Casting a Rational instantiated with a user-defined fixed-width127 * integer type to a floating point type currently doesn't work and may128 * hang your program in an infinite loop.129 125 * 130 126 * Examples: … … 540 536 } 541 537 538 /**Casts this to an integer by truncating the fractional part. Equivalent 539 * to $(D integerPart), and then casting it to type $(D I). 540 */ 541 I opCast(I)() if(isIntegerLike!I && is(typeof(cast(I) Int.init))) { 542 return cast(I) integerPart; 543 } 544 542 545 /**Returns the numerator.*/ 543 546 @property Int num() { … … 701 704 assert(intFract.integerPart == 1); 702 705 assert(intFract.fractionPart == rational(1, 4)); 706 assert(cast(long) intFract == 1); 703 707 704 708 // Test whether CTFE works for primitive types. Doesn't work yet.
