Changeset dafbde8 for libcfa/src/rational.cfa
 Timestamp:
 Jan 20, 2021, 4:49:40 PM (9 months ago)
 Branches:
 armeh, jacob/cs343translation, master, newastuniqueexpr
 Children:
 454f478
 Parents:
 92bfda0 (diff), fd54fef (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

libcfa/src/rational.cfa
r92bfda0 rdafbde8 18 18 #include "stdlib.hfa" 19 19 20 forall( otypeRationalImpl  arithmetic( RationalImpl ) ) {20 forall( RationalImpl  arithmetic( RationalImpl ) ) { 21 21 // helper routines 22 22 … … 159 159 // I/O 160 160 161 forall( dtype istype istream( istype )  { istype & ??( istype &, RationalImpl & ); } )161 forall( istype &  istream( istype )  { istype & ??( istype &, RationalImpl & ); } ) 162 162 istype & ??( istype & is, Rational(RationalImpl) & r ) { 163 163 is  r.numerator  r.denominator; … … 168 168 } // ?? 169 169 170 forall( dtype ostype ostream( ostype )  { ostype & ??( ostype &, RationalImpl ); } ) {170 forall( ostype &  ostream( ostype )  { ostype & ??( ostype &, RationalImpl ); } ) { 171 171 ostype & ??( ostype & os, Rational(RationalImpl) r ) { 172 172 return os  r.numerator  '/'  r.denominator; … … 179 179 } // distribution 180 180 181 forall( otypeRationalImpl  arithmetic( RationalImpl )  { RationalImpl ?\?( RationalImpl, unsigned long ); } )181 forall( RationalImpl  arithmetic( RationalImpl )  { RationalImpl ?\?( RationalImpl, unsigned long ); } ) 182 182 Rational(RationalImpl) ?\?( Rational(RationalImpl) x, long int y ) { 183 183 if ( y < 0 ) { … … 190 190 // conversion 191 191 192 forall( otypeRationalImpl  arithmetic( RationalImpl )  { double convert( RationalImpl ); } )192 forall( RationalImpl  arithmetic( RationalImpl )  { double convert( RationalImpl ); } ) 193 193 double widen( Rational(RationalImpl) r ) { 194 194 return convert( r.numerator ) / convert( r.denominator ); 195 195 } // widen 196 196 197 forall( otypeRationalImpl  arithmetic( RationalImpl )  { double convert( RationalImpl ); RationalImpl convert( double ); } )197 forall( RationalImpl  arithmetic( RationalImpl )  { double convert( RationalImpl ); RationalImpl convert( double ); } ) 198 198 Rational(RationalImpl) narrow( double f, RationalImpl md ) { 199 199 // http://www.ics.uci.edu/~eppstein/numth/frap.c
Note: See TracChangeset
for help on using the changeset viewer.