Changeset f5e37a4 for libcfa/src


Ignore:
Timestamp:
Nov 27, 2024, 6:12:44 PM (3 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
3e2e9b2, 81e768d
Parents:
71f3d45
Message:

small changes to rational

Location:
libcfa/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/rational.cfa

    r71f3d45 rf5e37a4  
    1010// Created On       : Wed Apr  6 17:54:28 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Nov 11 22:37:12 2024
    13 // Update Count     : 206
     12// Last Modified On : Wed Nov 27 18:06:43 2024
     13// Update Count     : 208
    1414//
    1515
     
    1919
    2020#pragma GCC visibility push(default)
     21
     22// Arithmetic, Relational
    2123
    2224forall( T | arithmetic( T ) ) {
     
    190192                return l = l / r;
    191193        } // ?/?
    192 
    193         // I/O
    194 
    195         forall( istype & | istream( istype ) | { istype & ?|?( istype &, T & ); } )
     194} // distribution
     195
     196// I/O
     197
     198forall( T ) {
     199        forall( istype & | istream( istype ) | { istype & ?|?( istype &, T & ); } | arithmetic( T ) )
    196200        istype & ?|?( istype & is, rational(T) & r ) {
    197201                is | r.numerator | r.denominator;
     
    201205                return is;
    202206        } // ?|?
    203 } // distribution
    204 
    205 forall( T ) {
     207
    206208        forall( ostype & | ostream( ostype ) | { ostype & ?|?( ostype &, T ); } ) {
    207209        ostype & ?|?( ostype & os, rational(T) r ) {
     
    212214} // distribution
    213215
     216// Exponentiation
     217
    214218forall( T | arithmetic( T ) | { T ?\?( T, unsigned long ); } ) {
    215219        rational(T) ?\?( rational(T) x, long int y ) {
     
    226230} // distribution
    227231
    228 // conversion
     232// Conversion
    229233
    230234forall( T | arithmetic( T ) | { double convert( T ); } )
  • libcfa/src/rational.hfa

    r71f3d45 rf5e37a4  
    1212// Created On       : Wed Apr  6 17:56:25 2016
    1313// Last Modified By : Peter A. Buhr
    14 // Last Modified On : Fri Nov  8 17:02:09 2024
    15 // Update Count     : 126
     14// Last Modified On : Wed Nov 27 18:11:07 2024
     15// Update Count     : 128
    1616//
    1717
     
    2121#include "math.trait.hfa"                                                               // arithmetic
    2222
    23 // implementation
     23// Implementation
    2424
    2525forall( T ) {
     
    2828        }; // rational
    2929}
     30
     31// Arithmetic, Relational
    3032
    3133forall( T | arithmetic( T ) ) {
     
    7375        rational(T) ?/?( rational(T) l, rational(T) r );
    7476        rational(T) ?/=?( rational(T) & l, rational(T) r );
    75 
    76         // I/O
    77         forall( istype & | istream( istype ) | { istype & ?|?( istype &, T & ); } )
    78         istype & ?|?( istype &, rational(T) & );
    7977} // distribution
    8078
     79// I/O
     80
    8181forall( T ) {
     82        forall( istype & | istream( istype ) | { istype & ?|?( istype &, T & ); } | arithmetic( T ) )
     83        istype & ?|?( istype &, rational(T) & );
     84
    8285        forall( ostype & | ostream( ostype ) | { ostype & ?|?( ostype &, T ); } ) {
    8386                ostype & ?|?( ostype &, rational(T) );
     
    8689} // distribution
    8790
     91// Exponentiation
     92
    8893forall( T | arithmetic( T ) | { T ?\?( T, unsigned long ); } ) {
    8994        rational(T) ?\?( rational(T) x, long int y );
     
    9196} // distribution
    9297
    93 // conversion
     98// Conversion
     99
    94100forall( T | arithmetic( T ) | { double convert( T ); } )
    95101double widen( rational(T) r );
Note: See TracChangeset for help on using the changeset viewer.