GiNaCRA  0.6.4
RealAlgebraicNumberNR.h
Go to the documentation of this file.
00001 /*
00002  * GiNaCRA - GiNaC Real Algebra package
00003  * Copyright (C) 2010-2012  Ulrich Loup, Joachim Redies, Sebastian Junges
00004  *
00005  * This file is part of GiNaCRA.
00006  *
00007  * GiNaCRA is free software: you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation, either version 3 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * GiNaCRA is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with GiNaCRA.  If not, see <http://www.gnu.org/licenses/>.
00019  *
00020  */
00021 
00022 
00023 #ifndef GINACRA_NUMERICREPRESENTATION_H
00024 #define GINACRA_NUMERICREPRESENTATION_H
00025 
00026 #include <ginac/ginac.h>
00027 
00028 #include "RealAlgebraicNumber.h"
00029 #include "RationalUnivariatePolynomial.h"
00030 
00031 namespace GiNaCRA
00032 {
00041     class RealAlgebraicNumberNR:
00042         public RealAlgebraicNumber,
00043         public numeric
00044     {
00045         public:
00046 
00048             // Con- and destructors //
00050 
00056             RealAlgebraicNumberNR( const numeric& n, bool isRoot = true );
00057 
00062             RealAlgebraicNumberNR( const RealAlgebraicNumberNR& n );
00063 
00067             RealAlgebraicNumberPtr clone() const
00068             {
00069                 return RealAlgebraicNumberPtr( new RealAlgebraicNumberNR( *this ));
00070             }
00071 
00073             // Operations //
00075 
00080             GiNaC::sign sgn() const;
00081 
00087             GiNaC::sign sgn( const RationalUnivariatePolynomial& p ) const;
00088 
00093             const numeric approximateValue() const
00094             {
00095                 return GiNaC::ex_to<numeric>( *this );
00096             }
00097 
00098         protected:
00099 
00101             // Methods from basic //
00103 
00104             void do_print( const print_context& c, unsigned level = 0 ) const;
00105 
00106     };
00107 
00108     typedef std::tr1::shared_ptr<RealAlgebraicNumberNR> RealAlgebraicNumberNRPtr;
00109 
00110 }
00111 
00112 #endif