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

📄 hugecalc.h

📁 这是一个功能极其强大的软件包
💻 H
📖 第 1 页 / 共 2 页
字号:
	HUGECALC_API friend const SINT32 Div( const UINT32 u32Dividend, const CHugeInt &divisor, SINT32 * const pRemainder = NULL );
	HUGECALC_API friend const SINT32 Div( const SINT32 s32Dividend, const CHugeInt &divisor, SINT32 * const pRemainder = NULL );

	// /
	HUGECALC_API friend const SINT32 operator /( const UINT32 u32Num, const CHugeInt &right );
	HUGECALC_API friend const SINT32 operator /( const SINT32 s32Num, const CHugeInt &right );

	HUGECALC_API friend const CHugeInt operator /( const CHugeInt &left, const UINT32 u32Num );
	HUGECALC_API friend const CHugeInt operator /( const CHugeInt &left, const SINT32 s32Num );

	HUGECALC_API friend const CHugeInt operator /( const CHugeInt &left, const CHugeInt &right );

	// %
	HUGECALC_API friend const SINT32 operator %( const UINT32 u32Num, const CHugeInt &right );
	HUGECALC_API friend const SINT32 operator %( const SINT32 s32Num, const CHugeInt &right );

	HUGECALC_API friend const SINT32 operator %( const CHugeInt &left, const UINT32 u32Num );
	HUGECALC_API friend const SINT32 operator %( const CHugeInt &left, const SINT32 s32Num );

	HUGECALC_API friend const CHugeInt operator %( const CHugeInt &left, const CHugeInt &right );

	HUGECALC_API friend const UINT32 PowMod( const UINT32 u32Base, const UINT32 r, const UINT32 u32Mod );

	HUGECALC_API friend const UINT32 Gcd( const UINT32 u32Num1, const UINT32 u32Num2 );
	HUGECALC_API friend const UINT32 Gcd( const SINT32 s32Num, const UINT32 u32Num );
	HUGECALC_API friend const UINT32 Gcd( const UINT32 u32Num, const SINT32 s32Num );
	HUGECALC_API friend const UINT32 Gcd( const SINT32 s32Num1, const SINT32 s32Num2 );

public:
	// constructor
	CHugeInt( VOID );
	CHugeInt( const SINT32 &s32Num );
	CHugeInt( const UINT32 &u32Num );
	CHugeInt( const UINT64 &u64Num );
	CHugeInt( LPCTSTR lpNum );
	CHugeInt( const U32_VECTOR &v32Num, const UINT32 u32Carry = 16, const BOOL bPositive = TRUE );
	CHugeInt( const CHugeInt &right );

	// destructor
	/*virtual*/ ~CHugeInt( );

	// reload operator ->
	CHugeInt * const operator ->( VOID );

	// static functions
	static const BOOL GetLicense( VOID );
	static const SIZE_T GetCount( VOID );

	// It usefull when multithread.
	static const BOOL IsTerminated( VOID );
	static VOID SetTerminate( const BOOL bTerminate = TRUE );

	// before calculate, pls call bEnableTimer as TRUE, and after finishing call as FALSE
	static VOID EnableTimer( const BOOL bEnableTimer = TRUE );
	static const UINT32 GetTimer( const BOOL bEnableTimer = FALSE );
	static LPCTSTR ShowTimer( const BOOL bEnableTimer = FALSE );
	static VOID ResetTimer( VOID );

	// get property
	const BOOL operator !( VOID ) const;
	const BOOL IsAbsOne( VOID ) const;
	const BOOL IsOdd( VOID ) const;
	const SIGN GetSign( VOID ) const;

	const CHugeInt Abs( VOID ) const;
	CHugeInt &Invert( VOID );
	const CHugeInt operator -( VOID ) const;

	// reload operators
	CHugeInt &operator =( const SINT32 &s32Num );
	CHugeInt &operator =( const UINT32 &u32Num );
	CHugeInt &operator =( const UINT64 &u64Num );
	CHugeInt &operator =( LPCTSTR lpNum );
	CHugeInt &operator =( const CHugeInt &right );

	CHugeInt &FromCarry( const U32_VECTOR &v32Num, const UINT32 u32Carry = 16, const BOOL bPositive = TRUE );

	CHugeInt &operator +=( const UINT32 u32Num );
	CHugeInt &operator +=( const SINT32 s32Num );
	CHugeInt &operator +=( const CHugeInt &right );

	CHugeInt &operator ++( VOID );
	const CHugeInt operator ++( const INT );

	CHugeInt &operator -=( const UINT32 u32Num );
	CHugeInt &operator -=( const SINT32 s32Num );
	CHugeInt &operator -=( const CHugeInt &right );

	CHugeInt &operator --( VOID );
	const CHugeInt operator --( const INT );

	CHugeInt &operator *=( const UINT32 u32Num );
	CHugeInt &operator *=( const SINT32 s32Num );
	CHugeInt &operator *=( const CHugeInt &right );

	CHugeInt &operator /=( const UINT32 u32Num );
	CHugeInt &operator /=( const SINT32 s32Num );
	CHugeInt &operator /=( const CHugeInt &right );

	CHugeInt &operator %=( const UINT32 u32Num );
	CHugeInt &operator %=( const SINT32 s32Num );
	CHugeInt &operator %=( const CHugeInt &right );

	// notice: base on decimal system !!
	CHugeInt &operator <<=( const UINT32 u32LShift );
	const CHugeInt operator <<( const UINT32 u32LShift ) const;

	// notice: base on decimal system !!
	CHugeInt &operator >>=( const UINT32 u32RShift );
	const CHugeInt operator >>( const UINT32 u32RShift ) const;

	// notice: power, not XOR !!
	CHugeInt &operator ^=( const UINT32 r );
	const CHugeInt operator ^( const UINT32 r ) const;

	// Multiplication, return product
	CHugeInt &Mul( const UINT32 u32Multiplicand, const CHugeInt &multiplier );
	CHugeInt &Mul( const SINT32 s32Multiplicand, const CHugeInt &multiplier );

	CHugeInt &Mul( const CHugeInt &multiplicand, const UINT32 u32Multiplier );
	CHugeInt &Mul( const CHugeInt &multiplicand, const SINT32 s32Multiplier );

	CHugeInt &Mul( const CHugeInt &multiplicand, const CHugeInt &multiplier );

	// Division, return quotient
	CHugeInt &Div( const CHugeInt &dividend, const UINT32 u32Divisor, SINT32 * const pRemainder = NULL );
	CHugeInt &Div( const CHugeInt &dividend, const SINT32 s32Divisor, SINT32 * const pRemainder = NULL );

	CHugeInt &Div( const CHugeInt &dividend, const CHugeInt &divisor, CHugeInt * const pRemainder = NULL );

	// Extraction
	CHugeInt &Root( const CHugeInt &radicand, const UINT32 r, CHugeInt * const pRemainder = NULL, BOOL * const pIsReal = NULL );

	CHugeInt &PowMod( const UINT32 u32Base, const UINT32 r, const CHugeInt &hugeMod );
	CHugeInt &PowMod( const SINT32 s32Base, const UINT32 r, const CHugeInt &hugeMod );
	CHugeInt &PowMod( const CHugeInt &hugeBase, const UINT32 r, const CHugeInt &hugeMod );

	CHugeInt &Fibonacci( const UINT32 n );
	CHugeInt &Factorial( const UINT32 n, const BOOL bDouble = FALSE );
	CHugeInt &Permutation( const UINT32 n, const UINT32 r );
	CHugeInt &Combination( const UINT32 n, const UINT32 r );

	// Greatest Common Divisor
	CHugeInt &Gcd( const UINT32 u32Num, const CHugeInt &right );
	CHugeInt &Gcd( const SINT32 s32Num, const CHugeInt &right );
	CHugeInt &Gcd( const CHugeInt &left, const UINT32 u32Num );
	CHugeInt &Gcd( const CHugeInt &left, const SINT32 s32Num );

	CHugeInt &Gcd( const CHugeInt &left, const CHugeInt &right );
	CHugeInt &Gcd( const CHUGEINT_VECTOR &vHugeInt );

	// Lowest Common Multiple
	CHugeInt &Lcm( const UINT32 u32Num1, const UINT32 u32Num2 );
	CHugeInt &Lcm( const SINT32 s32Num, const UINT32 u32Num );
	CHugeInt &Lcm( const UINT32 u32Num, const SINT32 s32Num );
	CHugeInt &Lcm( const SINT32 s32Num1, const SINT32 s32Num2 );

	CHugeInt &Lcm( const UINT32 u32Num, const CHugeInt &right );
	CHugeInt &Lcm( const SINT32 s32Num, const CHugeInt &right );
	CHugeInt &Lcm( const CHugeInt &left, const UINT32 u32Num );
	CHugeInt &Lcm( const CHugeInt &left, const SINT32 s32Num );

	CHugeInt &Lcm( const CHugeInt &left, const CHugeInt &right );
	CHugeInt &Lcm( const CHUGEINT_VECTOR &vHugeInt );

	CHugeInt &Product( const CHUGEINT_VECTOR &vHugeInt );
	// if r==0, then call function: Product( vHugeInt );
	CHugeInt &SumsOfLikePowers( const CHUGEINT_VECTOR &vHugeInt, const UINT32 r = 1 );

	// Output
	const SIZE_T GetDigitals( VOID ) const;
	const SIZE_T GetShowBufferSize( const BYTE byFormat = FS_DEFAULT ) const;
	LPCTSTR Show( const BYTE byFormat = FS_DEFAULT ) const;
	VOID FreeShowBuffer( VOID ) const;

	// This function can convert the huge integer to another carry system.
	// If u32Carry in the range [2, 36], then show string ( inculde '0'-'9' & 'A'-'Z' ),
	// otherwise, return NULL.
	U32_VECTOR &ToCarry( U32_VECTOR &v32Num, SINT32 * const pSign = NULL, const UINT32 u32Carry = 16, LPCTSTR * const pShow = NULL, const BYTE byFormat = FS_DEFAULT ) const;
	LPCTSTR ToCarry( const UINT32 u32Carry = 16, const UINT32 u32BandLength = 4, const BYTE byFormat = FS_DEFAULT, UINT32 * const pDigitals = NULL ) const;

private:
	CHugeInt( const InternalClass & );
	CHugeInt &operator =( const InternalClass & );

	InternalClass * const m_pInternalClass;
};

#endif // !defined(AFX_HUGECALC_H__5B7DCBAC_6D89_4C55_B51F_D96B5E741B51__INCLUDED_)

⌨️ 快捷键说明

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