上へ CompactLong CompactPrecision CompactFFT
| |
プログラミング仕様 |
CompactPrecision |
最終更新日:2007/02/12 新規 |
●概要
CompactLongによる演算クラス。共有メソッドなのでNew は不要。
●設定、数学定数
○初期化
- Shared Sub SetUpCompact()
明示的に初期設定する場合に用いる。FFTテーブル、数学定数が準備される。用いなくても、必要に応じて自動的に初期化される。
○数学定数
以下の定数がプロパティとして参照できる。4095桁まで正しい。
- Shared ReadOnly Property PI() As CompactLong
π
- Shared ReadOnly Property dPI() As CompactLong 2π
- Shared ReadOnly Property hPI() As CompactLong
π/2
- Shared ReadOnly Property qPI() As CompactLong
π/4
- Shared ReadOnly Property E() As CompactLong
e
- Shared ReadOnly Property Ln10() As CompactLong Ln10
●演算メソッド
○丸め、関係演算
- Shared Function Round(ByRef A As CompactLong) As CompactLong
4001桁目で四捨五入し、4000桁の値を返す。
- Shared Function Comp(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactRelation
- Shared Function Comp(ByRef A As CompactLong, ByVal B As Long) As
CompactRelation
- Shared Function CompAbs(ByRef A As CompactLong, ByRef B As CompactLong)
As CompactRelation
符号付または絶対値で比較する。以下の結果が返る。
Public Enum CompactRelation
LessThan
Equal
GraterThan
NA (比較不能)
End Enum
○四則演算
- Shared Function Add(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactLong
- Shared Function Add(ByRef A As CompactLong, ByVal B As Long) As
CompactLong
- Shared Function Subt(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactLong
- Shared Function Subt(ByRef A As CompactLong, ByVal B As Long) As
CompactLong
- Shared Function Mul(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactLong
- Shared Function Mul(ByRef A As CompactLong, ByVal B As Long) As
CompactLong
自動的に最適な乗算方法で乗算。
- Shared Function LMul(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactLong
- Shared Function LMul(ByRef A As CompactLong, ByVal B As Long) As
CompactLong
従来方法による乗算。
- Shared Function FMul(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactLong
FFT乗算。
- Shared Function Div(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactLong
- Shared Function Div(ByRef A As CompactLong, ByVal B As Long) As
CompactLong
自動的に最適な方法で除算。
- Shared Function LDiv(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactLong
- Shared Function LDiv(ByRef A As CompactLong, ByVal B As Long) As
CompactLong
従来方法による除算。
- Shared Function RDiv(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactLong
逆数法による除算。逆数は多段初期値法でニュートン漸化式で算出している。
- Shared Function Modulo(ByRef A As CompactLong, ByRef B As CompactLong,
ByRef Quitient As CompactLong) As CompactLong
Quitient = A \ B (整数商) となり、A Mod B (剰余)を返す。
●数学関数
公称精度の4000桁までは保証する努力をしている。
○階乗
- Shared Function Factorial(ByVal A As Integer) As CompactLong
- Shared Function FactorialDouble(ByVal A As Integer) As CompactLong
二重階乗 A!! を返す。
○逆数
- Shared Function ReciproBasic(ByRef A As CompactLong) As CompactLong
単一初期値によるニュートン法で求めたもの。
- Shared Function Recipro(ByRef A As CompactLong) As CompactLong
多段初期値によるニュートン法で求めたもの。
○平方根/立方根
- Shared Function Sqrt(ByRef A As CompactLong) As CompactLong
- Shared Function Cbrt(ByRef A As CompactLong) As CompactLong
○指数関数
- Shared Function Exp(ByRef A As CompactLong) As CompactLong
eAを返す。Aは任意の実数。
- Shared Function IPower(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactLong
- Shared Function IPower(ByRef A As CompactLong, ByVal B As Long) As
CompactLong
整数冪乗 ABを返す。Aは任意の実数。Bは整数または整数部が採用される。
- Shared Function Power(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactLong
実数冪乗 ABを返す。A、Bは任意の実数。
○対数関数
- Shared Function Ln(ByRef A As CompactLong) As CompactLong
自然対数。A > 0。
- Shared Function Log(ByRef A As CompactLong) As CompactLong
常用対数。A > 0。
- Shared Function Log(ByRef A As CompactLong, ByRef B As CompactLong) As
CompactLong
任意対数。logAB を返す。A > 1。B > 0。
○角度変換
- Shared Function Radian(ByRef A As CompactLong) As
CompactLong 度→ラジアン
- Shared Function Radian(ByVal A As Long) As
CompactLong 度→ラジアン
- Shared Function Degree(ByRef A As CompactLong) As
CompactLong ラジアン→度
○三角関数
- Shared Function Sin(ByRef A As CompactLong) As CompactLong
- Shared Function Cos(ByRef A As CompactLong) As CompactLong
- Shared Function Tan(ByRef A As CompactLong) As CompactLong
Aはラジアン。
○逆三角関数
- Shared Function ASin(ByRef A As CompactLong) As CompactLong
- Shared Function ACos(ByRef A As CompactLong) As CompactLong
- Shared Function ATan(ByRef A As CompactLong) As CompactLong
○双曲線関数
- Shared Function Sinh(ByRef A As CompactLong) As CompactLong
- Shared Function Cosh(ByRef A As CompactLong) As CompactLong
- Shared Function Tanh(ByRef A As CompactLong) As CompactLong
○逆双曲線関数
- Shared Function ASinh(ByRef A As CompactLong) As CompactLong
- Shared Function ACosh(ByRef A As CompactLong) As CompactLong
- Shared Function ATanh(ByRef A As CompactLong) As CompactLong
○数学定数生成
数学原始定数を4096桁精度で生成する。一般には使用しなく、内部で使用される。
- Shared Sub CreateE()
- Shared Sub CreatePIMatin()
- Shared Sub CreateLn10()
|