/usr/include/givaro/givrational.inl is in libgivaro-dev 3.7.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | // ==========================================================================
// $Source: /var/lib/cvs/Givaro/src/kernel/rational/givrational.inl,v $
// Copyright(c)'1994-2009 by The Givaro group
// This file is part of Givaro.
// Givaro is governed by the CeCILL-B license under French law
// and abiding by the rules of distribution of free software.
// see the COPYRIGHT file for more details.
// Authors: M. Samama
// $Id: givrational.inl,v 1.5 2011-02-02 16:23:56 bboyer Exp $
// ==========================================================================
// Description:
#ifndef __GIVARO_rational_INL
#define __GIVARO_rational_INL
namespace Givaro {
//-------------------------------------------------inline comparaison operators
inline int operator != (const Rational& a , const Rational& b)
{ return compare(a,b) != 0 ; }
inline int operator == (const Rational& a, const Rational& b)
{ return compare(a,b) == 0 ; }
inline int operator < (const Rational& a , const Rational& b)
{ return compare(a,b) == -1 ; }
inline int operator > (const Rational& a , const Rational& b)
{ return compare(a,b) == 1 ; }
inline int operator <= (const Rational& a, const Rational& b)
{ return compare(a,b) <= 0 ; }
inline int operator >= (const Rational& a, const Rational& b)
{ return compare(a,b) >= 0 ; }
//----------------------------------arithmetic inline operators
inline const Rational operator + (const Rational& r, const int i)
{ return r + Rational(i) ; }
inline const Rational operator - (const Rational& r, const int i)
{ return r - Rational(i) ; }
inline const Rational operator * (const Rational& r, const int i)
{ return r * Rational(i) ; }
inline const Rational operator / (const Rational &r, const int i)
{ return r / Rational(i) ; }
inline const Rational operator + (const int i, const Rational& r)
{ return Rational(i) + r; }
inline const Rational operator - (const int i, const Rational& r)
{ return Rational(i) - r; }
inline const Rational operator * (const int i, const Rational& r)
{ return Rational(i) * r; }
inline const Rational operator / (const int i, const Rational& r)
{ return Rational(i) / r ; }
inline Rational Rational::operator + () const
{ return *this ; }
//----------------------------------miscellaneous inline functions
inline int isInteger(const Rational& r)
{ return isOne(r.den) ; }
inline int isOne(const Rational& a)
{ return (isOne(a.num) && isOne(a.den)) ; }
inline int isZero(const Rational& a)
{ return isZero(a.num) ; }
inline int sign(const Rational& a)
{ return sign(a.num) ; }
inline unsigned long length(const Rational& a)
{ return length(a.num) + length(a.den) ; }
inline const Rational abs(const Rational &r)
{ return Rational(abs(r.num), r.den, 0); }
inline const Integer Rational::nume() const
{ return num ; }
inline const Integer Rational::deno() const
{ return den ; }
inline Rational Rational::reduce( const Rational& R) const
{ Rational tmp ; tmp = R ; tmp.reduce() ; return tmp ; }
//-------------------------------------------------inline >> & << operators
inline std::ostream& operator<< (std::ostream& o, const Rational& a)
{ return a.print(o); }
} // Givaro
#endif // __GIVARO_rational_INL
|