source: git/factory/int_rat.h @ 6dd289

spielwiese
Last change on this file since 6dd289 was 6dd289, checked in by Jens Schmidt <schmidt@…>, 26 years ago
* int_rat.cc, int_int.cc, int_rat.h, int_int.h, int_poly.h (isZero, isOne): methods removed. Declarations adapted. * int_poly.cc, int_pp.cc, int_rat.cc (neg): doc fixes git-svn-id: file:///usr/local/Singular/svn/trunk@2240 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.2 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id: int_rat.h,v 1.6 1998-06-26 16:16:08 schmidt Exp $ */
3
4#ifndef INCL_INT_RAT_H
5#define INCL_INT_RAT_H
6
7#include <config.h>
8
9#ifndef NOSTREAMIO
10#include <iostream.h>
11#endif /* NOSTREAMIO */
12
13#include "cf_gmp.h"
14
15#include "assert.h"
16
17#include "canonicalform.h"
18#include "int_cf.h"
19#include "imm.h"
20
21class InternalRational : public InternalCF
22{
23private:
24    MP_INT _num;
25    MP_INT _den;
26    static int initialized;
27    static MP_INT & MPQNUM( const InternalCF * const c );
28    static MP_INT & MPQDEN( const InternalCF * const c );
29    static void normalize( const MP_INT &, const MP_INT &, MP_INT &, MP_INT & );
30public:
31    InternalRational();
32    InternalRational( const InternalCF& )
33    {
34        ASSERT( 0, "ups there is something wrong in your code" );
35    }
36    InternalRational( const int i );
37    InternalRational( const int n, const int d );
38    InternalRational( const char * str );
39    InternalRational( const MP_INT & );
40    InternalRational( const MP_INT &, const MP_INT & );
41    ~InternalRational();
42    InternalCF* deepCopyObject() const;
43    const char * const classname() const { return "InternalRational"; }
44#ifndef NOSTREAMIO
45    void print( ostream&, char* );
46#endif /* NOSTREAMIO */
47    InternalCF* genZero();
48    InternalCF* genOne();
49
50    bool is_imm() const;
51    int levelcoeff() const { return RationalDomain; }
52
53    InternalCF* num();
54    InternalCF* den();
55
56    InternalCF* neg();
57
58    int comparesame( InternalCF* );
59
60    InternalCF* addsame( InternalCF* );
61    InternalCF* subsame( InternalCF* );
62    InternalCF* mulsame( InternalCF* );
63    InternalCF* dividesame( InternalCF* );
64    InternalCF* modulosame( InternalCF* );
65    InternalCF* divsame( InternalCF* );
66    InternalCF* modsame( InternalCF* );
67    void divremsame( InternalCF*, InternalCF*&, InternalCF*& );
68    bool divremsamet( InternalCF*, InternalCF*&, InternalCF*& );
69
70    int comparecoeff( InternalCF* );
71
72    InternalCF* addcoeff( InternalCF* );
73    InternalCF* subcoeff( InternalCF*, bool );
74    InternalCF* mulcoeff( InternalCF* );
75    InternalCF* dividecoeff( InternalCF*, bool );
76    InternalCF* modulocoeff( InternalCF*, bool );
77    InternalCF* divcoeff( InternalCF*, bool );
78    InternalCF* modcoeff( InternalCF*, bool );
79    void divremcoeff( InternalCF*, InternalCF*&, InternalCF*&, bool );
80    bool divremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool );
81
82    InternalCF * bgcdsame ( const InternalCF * const ) const;
83    InternalCF * bgcdcoeff ( const InternalCF * const );
84
85    InternalCF * bextgcdsame ( InternalCF *, CanonicalForm &, CanonicalForm & );
86    InternalCF * bextgcdcoeff ( InternalCF *, CanonicalForm &, CanonicalForm & );
87
88    int intval() const;
89
90    int sign() const;
91
92    InternalCF * normalize_myself();
93
94    friend class InternalInteger;
95#ifdef SINGULAR
96    friend MP_INT gmp_numerator ( const CanonicalForm & f );
97    friend MP_INT gmp_denominator ( const CanonicalForm & f );
98#endif /* SINGULAR */
99    friend CanonicalForm make_cf ( const MP_INT & n, const MP_INT & d );
100};
101
102inline MP_INT & InternalRational::MPQNUM( const InternalCF * const c )
103{
104    return (((InternalRational*)c)->_num);
105}
106
107inline MP_INT & InternalRational::MPQDEN( const InternalCF * const c )
108{
109    return (((InternalRational*)c)->_den);
110}
111
112#endif /* ! INCL_INT_RAT_H */
Note: See TracBrowser for help on using the repository browser.