Changeset 5544465 for src/libcfa/rational
- Timestamp:
- May 1, 2017, 6:27:38 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 5783e94
- Parents:
- ad1a8dd (diff), 2055098 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/libcfa/rational ¶
rad1a8dd r5544465 12 12 // Created On : Wed Apr 6 17:56:25 2016 13 13 // Last Modified By : Peter A. Buhr 14 // Last Modified On : Wed May 4 14:11:45 201615 // Update Count : 1614 // Last Modified On : Mon May 1 08:25:06 2017 15 // Update Count : 33 16 16 // 17 17 18 #ifndef RATIONAL_H 18 19 #define RATIONAL_H … … 21 22 22 23 // implementation 24 typedef long int RationalImpl; 23 25 struct Rational { 24 long intnumerator, denominator; // invariant: denominator > 026 RationalImpl numerator, denominator; // invariant: denominator > 0 25 27 }; // Rational 26 28 … … 31 33 // constructors 32 34 void ?{}( Rational * r ); 33 void ?{}( Rational * r, long intn );34 void ?{}( Rational * r, long int n, long intd );35 void ?{}( Rational * r, RationalImpl n ); 36 void ?{}( Rational * r, RationalImpl n, RationalImpl d ); 35 37 36 // getter/setter for numerator/denominator 37 long int numerator( Rational r ); 38 long int numerator( Rational r, long int n ); 39 long int denominator( Rational r ); 40 long int denominator( Rational r, long int d ); 38 // getter for numerator/denominator 39 RationalImpl numerator( Rational r ); 40 RationalImpl denominator( Rational r ); 41 [ RationalImpl, RationalImpl ] ?=?( * [ RationalImpl, RationalImpl ] dest, Rational src ); 42 // setter for numerator/denominator 43 RationalImpl numerator( Rational r, RationalImpl n ); 44 RationalImpl denominator( Rational r, RationalImpl d ); 41 45 42 46 // comparison … … 57 61 // conversion 58 62 double widen( Rational r ); 59 Rational narrow( double f, long intmd );63 Rational narrow( double f, RationalImpl md ); 60 64 61 65 // I/O
Note: See TracChangeset
for help on using the changeset viewer.