Mathクラス

提供:AB開発Wiki
Math クラスから転送)
ナビゲーションに移動検索に移動

Math クラスは、主な数学関数・定数を提供するクラスです。

クラスの機能

プロパティ

E

Static Function E() As Double

ネイピア数(自然対数の底)を返します。

PI

Static Function PI() As Double

円周率を返します。

メソッド

Abs

Static Function Abs(x As Double) As Double
Static Function Abs(x As Single) As Single
Static Function Abs(x As Char) As Char
Static Function Abs(x As Integer) As Integer
Static Function Abs(x As Long) As Long
Static Function Abs(x As Int64) As Int64

xの絶対値を返します。絶対値を表現できない値が与えられた場合の挙動は未定義です。

Sin

Static Function Sin(x As Double) As Double

xの正弦を返します。xはラジアン単位です。

Cos

Static Function Cos(x As Double) As Double

xの余弦を返します。xはラジアン単位です。

Tan

Static Function Tan(x As Double) As Double

xの正接を返します。xはラジアン単位です。

Sinh

Static Function Sinh(x As Double) As Double

xの双曲線正弦を返します。xはラジアン単位です。

Cosh

Static Function Cosh(x As Double) As Double

xの双曲線余弦を返します。xはラジアン単位です。

Tanh

Static Function Tanh(x As Double) As Double

xの双曲線正接を返します。xはラジアン単位です。

Asin

Static Function Asin(x As Double) As Double

xの逆正弦の主値をラジアン単位で返します。

Acos

Static Function Acos(x As Double) As Double

xの逆余弦の主値をラジアン単位で返します。

Atan

Static Function Atan(x As Double) As Double

xの逆正接の主値をラジアン単位で返します。

Atan2

Static Function Atan(y As Double, x As Double) As Double

y / xの逆正接の主値をラジアン単位で返します。引数の符号によって戻り値の符号が決まります。原点(0, 0)と(x, y)とがなす角度を求めると見ることができます。

Exp

Static Function Exp(x As Double) As Double

eのx乗を返します。

Log

Static Function Log(x As Double) As Double

xの自然対数を返します。

Log10

Static Function Log10(x As Double) As Double

xの常用対数を返します。

Pow

Static Function Pow(x As Double, y As Double) As Double

x ^ yを返します。

Sqrt

Static Function Sqrt(x As Double) As Double

実数の範囲で、xの平方根のうち正の数となるものを返します。

Ceiling

Static Function Ceiling(x As Double) As Double

xの小数点以下を切り上げた数を返します。注意:現在の実装では戻り値の型はLongです。

Floor

Static Function Floor(x As Double) As Double

xの小数点以下を切り捨てた数を返します。注意:現在の実装では戻り値の型はLongです。

Round

Static Function Round(x As Double) As Double
Static Function Round(x As Double, digits As Long) As Double
Static Function Round(x As Double, mode As MidpointRounding) As Double
Static Function Round(x As Double, digits As Long, mode As MidpointRounding) As Double

xの小数点以下digitsで指定された桁より下を丸めた数を返します。digitsが指定されていない場合は0と見做されます。xが中間値のときの扱いは、modeによって指定できます。省略するとMidpointRounding.ToEvenが指定されたものと見做されます。注意:現在xのみを引数に取るもの以外は実装されていません。参照: MidpointRounding列挙体

Truncate

Static Function Truncate(x As Double) As Double

xの整数部を返します。注意:現在の実装では戻り値の型はLongです。

IEEERemainder

Static Function IEEERemainder(x As Double, y As Double) As Double

x / yの余りを返します。IEEE 754-1985 §5.1で規定されている剰余演算に準拠した結果を返します。

BigMul

Static Function BigMul(x As Long, y As Long) As Int64

xとyの積を求めますが、結果を64ビット整数で返します。

DivRem

Static Function DivRem(x As Long, y As Long, ByRef ret As Long) As Long
Static Function DivRem(x As Int64, y As Int64, ByRef ret As Int64) As Int64

x / yを返します。retにはその余りを返します。

Max

Static Function Max(x As Byte, y As Byte) As Byte
Static Function Max(x As Char, y As Char) As Char
Static Function Max(x As Word, y As Word) As Word
Static Function Max(x As Integer, y As Integer) As Integer
Static Function Max(x As DWord, y As DWord) As DWord
Static Function Max(x As Long, y As Long) As Long
Static Function Max(x As QWord, y As QWord) As QWord
Static Function Max(x As Int64, y As Int64) As Int64
Static Function Max(x As Single, y As Single) As Single
Static Function Max(x As Double, y As Double) As Double

xとyのうち大きいほうを返します。

Min

Static Function Min(x As Byte, y As Byte) As Byte
Static Function Min(x As Char, y As Char) As Char
Static Function Min(x As Word, y As Word) As Word
Static Function Min(x As Integer, y As Integer) As Integer
Static Function Min(x As DWord, y As DWord) As DWord
Static Function Min(x As Long, y As Long) As Long
Static Function Min(x As QWord, y As QWord) As QWord
Static Function Min(x As Int64, y As Int64) As Int64
Static Function Min(x As Single, y As Single) As Single
Static Function Min(x As Double, y As Double) As Double

xとyのうち小さいほうを返します。

Sign

Static Function Sign(value As Char) As Long
Static Function Sign(value As Integer) As Long
Static Function Sign(value As Long) As Long
Static Function Sign(value As Int64) As Long
Static Function Sign(value As Single) As Long
Static Function Sign(value As Double) As Long

xが0を超えていれば1、0に等しければ0、0未満なら-1を返します。