Changes in src/libcfa/rational [f621a148:bb82c03]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/rational
rf621a148 rbb82c03 12 12 // Created On : Wed Apr 6 17:56:25 2016 13 13 // Last Modified By : Peter A. Buhr 14 // Last Modified On : Mon May 1 08:25:06 201715 // Update Count : 3314 // Last Modified On : Wed May 4 14:11:45 2016 15 // Update Count : 16 16 16 // 17 18 17 #ifndef RATIONAL_H 19 18 #define RATIONAL_H … … 22 21 23 22 // implementation 24 typedef long int RationalImpl;25 23 struct Rational { 26 RationalImplnumerator, denominator; // invariant: denominator > 024 long int numerator, denominator; // invariant: denominator > 0 27 25 }; // Rational 28 26 … … 33 31 // constructors 34 32 void ?{}( Rational * r ); 35 void ?{}( Rational * r, RationalImpln );36 void ?{}( Rational * r, RationalImpl n, RationalImpld );33 void ?{}( Rational * r, long int n ); 34 void ?{}( Rational * r, long int n, long int d ); 37 35 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 ); 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 ); 45 41 46 42 // comparison … … 61 57 // conversion 62 58 double widen( Rational r ); 63 Rational narrow( double f, RationalImplmd );59 Rational narrow( double f, long int md ); 64 60 65 61 // I/O
Note: See TracChangeset
for help on using the changeset viewer.