- Timestamp:
- Nov 27, 2024, 6:12:44 PM (3 weeks ago)
- Branches:
- master
- Children:
- 3e2e9b2, 81e768d
- Parents:
- 71f3d45
- Location:
- libcfa/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/rational.cfa
r71f3d45 rf5e37a4 10 10 // Created On : Wed Apr 6 17:54:28 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Nov 11 22:37:12202413 // Update Count : 20 612 // Last Modified On : Wed Nov 27 18:06:43 2024 13 // Update Count : 208 14 14 // 15 15 … … 19 19 20 20 #pragma GCC visibility push(default) 21 22 // Arithmetic, Relational 21 23 22 24 forall( T | arithmetic( T ) ) { … … 190 192 return l = l / r; 191 193 } // ?/? 192 193 // I/O 194 195 forall( istype & | istream( istype ) | { istype & ?|?( istype &, T & ); } ) 194 } // distribution 195 196 // I/O 197 198 forall( T ) { 199 forall( istype & | istream( istype ) | { istype & ?|?( istype &, T & ); } | arithmetic( T ) ) 196 200 istype & ?|?( istype & is, rational(T) & r ) { 197 201 is | r.numerator | r.denominator; … … 201 205 return is; 202 206 } // ?|? 203 } // distribution 204 205 forall( T ) { 207 206 208 forall( ostype & | ostream( ostype ) | { ostype & ?|?( ostype &, T ); } ) { 207 209 ostype & ?|?( ostype & os, rational(T) r ) { … … 212 214 } // distribution 213 215 216 // Exponentiation 217 214 218 forall( T | arithmetic( T ) | { T ?\?( T, unsigned long ); } ) { 215 219 rational(T) ?\?( rational(T) x, long int y ) { … … 226 230 } // distribution 227 231 228 // conversion232 // Conversion 229 233 230 234 forall( T | arithmetic( T ) | { double convert( T ); } ) -
libcfa/src/rational.hfa
r71f3d45 rf5e37a4 12 12 // Created On : Wed Apr 6 17:56:25 2016 13 13 // Last Modified By : Peter A. Buhr 14 // Last Modified On : Fri Nov 8 17:02:09202415 // Update Count : 12 614 // Last Modified On : Wed Nov 27 18:11:07 2024 15 // Update Count : 128 16 16 // 17 17 … … 21 21 #include "math.trait.hfa" // arithmetic 22 22 23 // implementation23 // Implementation 24 24 25 25 forall( T ) { … … 28 28 }; // rational 29 29 } 30 31 // Arithmetic, Relational 30 32 31 33 forall( T | arithmetic( T ) ) { … … 73 75 rational(T) ?/?( rational(T) l, rational(T) r ); 74 76 rational(T) ?/=?( rational(T) & l, rational(T) r ); 75 76 // I/O77 forall( istype & | istream( istype ) | { istype & ?|?( istype &, T & ); } )78 istype & ?|?( istype &, rational(T) & );79 77 } // distribution 80 78 79 // I/O 80 81 81 forall( T ) { 82 forall( istype & | istream( istype ) | { istype & ?|?( istype &, T & ); } | arithmetic( T ) ) 83 istype & ?|?( istype &, rational(T) & ); 84 82 85 forall( ostype & | ostream( ostype ) | { ostype & ?|?( ostype &, T ); } ) { 83 86 ostype & ?|?( ostype &, rational(T) ); … … 86 89 } // distribution 87 90 91 // Exponentiation 92 88 93 forall( T | arithmetic( T ) | { T ?\?( T, unsigned long ); } ) { 89 94 rational(T) ?\?( rational(T) x, long int y ); … … 91 96 } // distribution 92 97 93 // conversion 98 // Conversion 99 94 100 forall( T | arithmetic( T ) | { double convert( T ); } ) 95 101 double widen( rational(T) r );
Note: See TracChangeset
for help on using the changeset viewer.