LCNumeric の Compare メソッド

このメソッドは、2 つの LCNumeric オブジェクトを比較します。

定義位置

LCNumeric

構文

result = numericFirst. Compare (numericSecond)

パラメータ

パラメータ

説明

numericSecond

比較の基準となる値です。

戻り値

説明

結果

Long。比較の結果 (以下のいずれか)。

 

Result > 0 (正) -- numericFirst は numericSecond より大きい。

 

Result < 0 (負) -- numericFirst は numericSecond より小さい。

 

Result = 0 -- numericFirst は numericSecond と等しい。

Option Public
Uselsx "*lsxlc" 
Sub Initialize
  Dim num1 As New LCNumeric
  Dim num2 As New LCNumeric
  Dim diff As Long
  num1.Value = 123.456789
  num2.Value = 123
  diff = num1.Compare (num2)
  If (diff = 0) Then
    Print "The first number is the same as the second."
  Elseif (diff > 0) Then
    Print "The first number is greater than the second."
  Else
    Print "The first number is less than the second."
  End If
End Sub

出力例

The first number is greater than the second.