source: src/libcfa/rational @ 53ba273

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 53ba273 was 53ba273, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

switch from std=c99 to std=gnu99, update latex macros, refrat and extend user manual, update limits/iostream/fstream, add rational numbers

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[53ba273]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 : Wed Apr  6 21:51:42 2016
13// Update Count     : 8
14//
15
16#include <fstream>
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 );
46ifstream * ?|?( ifstream *is, Rational *r );
47ofstream * ?|?( ofstream *os, Rational r );
48
49// Local Variables: //
50// mode: c //
51// tab-width: 4 //
52// End: //
Note: See TracBrowser for help on using the repository browser.