source: src/libcfa/rational @ 3d9b5da

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 3d9b5da was 3d9b5da, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

fix library includes from < to ", and generalize rational IO to use iostream from fstream

  • Property mode set to 100644
File size: 1.6 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// rational --
8//
9// Author           : Peter A. Buhr
10// Created On       : Wed Apr  6 17:56:25 2016
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Thu Apr  7 17:23:36 2016
13// Update Count     : 9
14//
15
16#include "iostream"
17
18struct Rational {
19        long int numerator, denominator;                                        // invariant: denominator > 0
20}; // Rational
21
22extern struct Rational 0;
23extern struct Rational 1;
24
25long int gcd( long int a, long int b );
26long int simplify( long int *n, long int *d );
27Rational rational();                                                                    // constructor
28Rational rational( long int n );                                                // constructor
29Rational rational( long int n, long int d );                    // constructor
30long int numerator( Rational r );
31long int numerator( Rational r, long int n );
32long int denominator( Rational r, long int d );
33int ?==?( Rational l, Rational r );
34int ?!=?( Rational l, Rational r );
35int ?<?( Rational l, Rational r );
36int ?<=?( Rational l, Rational r );
37int ?>?( Rational l, Rational r );
38int ?>=?( Rational l, Rational r );
39Rational -?( Rational r );
40Rational ?+?( Rational l, Rational r );
41Rational ?-?( Rational l, Rational r );
42Rational ?*?( Rational l, Rational r );
43Rational ?/?( Rational l, Rational r );
44double widen( Rational r );
45Rational narrow( double f, long int md );
46forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, Rational * );
47forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, Rational );
48
49// Local Variables: //
50// mode: c //
51// tab-width: 4 //
52// End: //
Note: See TracBrowser for help on using the repository browser.