⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flpoly.h

📁 miracl-大数运算库,大家使用有什么问题请多多提意见
💻 H
字号:
/*
 * C++ class to implement a polynomial type and to allow 
 * arithmetic on polynomials whose elements are float numbers
 *
 * WARNING: This class has been cobbled together for a specific use with
 * the MIRACL library. It is not complete, and may not work in other 
 * applications
 *
 * See Knuth The Art of Computer Programming Vol.2, Chapter 4.6 
 */

#ifndef FPOLY_H
#define FPOLY_H

#include "floating.h"

class fterm
{
public:
    Float an;
    int n;
    fterm *next;
};
  
class FPoly
{
    fterm *start;
public:
    FPoly() {start=NULL;}
    FPoly(const FPoly&);
    void clear();
    fterm* addterm(Float,int,fterm *pos=NULL);
    void multerm(Float,int);
    Float coeff(int) const;
    BOOL iszero() const;

    FPoly& operator=(const FPoly&);
    FPoly& operator+=(const FPoly&);
    FPoly& operator-=(const FPoly&);
    FPoly& operator*=(const Float&);
    FPoly& divxn(FPoly&,int);
    FPoly& mulxn(int);

    friend int degree(const FPoly&);
    friend FPoly twobytwo(const FPoly&,const FPoly&);
    friend FPoly pow2bypow2(const FPoly&,const FPoly&,int);
    friend FPoly powsof2(const FPoly&,int,const FPoly&,int);
    friend FPoly special(const FPoly&,const FPoly&);

    friend FPoly operator+(const FPoly&,const FPoly&);
    friend FPoly operator-(const FPoly&,const FPoly&);

    friend FPoly operator*(const FPoly&,const FPoly&);
    friend FPoly operator*(const FPoly&,const Float&);

    friend ostream& operator<<(ostream&,const FPoly&);
    ~FPoly();
};


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -