Changeset 231 for Include/com/decimal.ab
- Timestamp:
- May 6, 2007, 5:30:42 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/com/decimal.ab
r211 r231 3 3 #require <oleauto.ab> 4 4 #require <com/variant.ab> 5 #require <com/currency.ab> 5 6 6 7 Class Decimal 7 8 Public 8 Sub Decimal(ByRef d As Decimal) 9 Sub Decimal() 10 End Sub 11 12 Sub Decimal(d As Decimal) 9 13 dec = d 10 14 End Sub 11 15 16 Sub Decimal(lo As Long, mid As Long, hi As Long, isNegative As Boolean, scale As Byte) 17 If scale > 28 Then 18 Debug 19 Throw New ArgumentOutOfRangeException 20 End If 21 Dim sign As Byte 22 If isNegative Then 23 sign = DECIMAL_NEG 24 Else 25 sign = 0 26 End If 27 dec.signscale = MAKEWORD(sign, scale) 'ToDo:どっちが上位だか検証すること 28 dec.Hi32 = hi 29 dec.Lo64 = MAKEQWORD(mid, lo) 30 End Sub 31 32 Sub Decimal(x As Long) 33 VarDecFromI4(x, dec) 34 End Sub 35 36 Sub Decimal(x As DWord) 37 VarDecFromUI4(x, dec) 38 End Sub 39 40 Sub Decimal(x As Int64) 41 VarDecFromI8(x, dec) 42 End Sub 43 44 Sub Decimal(x As QWord) 45 VarDecFromUI8(x, dec) 46 End Sub 47 48 Sub Decimal(x As Single) 49 VarDecFromR4(x, dec) 50 End Sub 51 52 Sub Decimal(x As Double) 53 VarDecFromR8(x, dec) 54 End Sub 55 56 Const Function Operator() As Variant 57 Return New Variant(This) 58 End Function 59 /* 60 Static Function Operator(x As SByte) As Decimal 61 Dim d = New Decimal 62 VarDecFromI1(x, d.dec) 63 Return d 64 End Function 65 66 Static Function Operator(x As Byte) As Decimal 67 Dim d = New Decimal 68 VarDecFromUI1(x, d.dec) 69 Return d 70 End Function 71 72 Static Function Operator(x As Integer) As Decimal 73 Dim d = New Decimal 74 VarDecFromI2(x, d.dec) 75 Return d 76 End Function 77 78 Static Function Operator(x As Word) As Decimal 79 Dim d = New Decimal 80 VarDecFromUI2(x, d.dec) 81 Return d 82 End Function 83 84 Static Function Operator(x As Long) As Decimal 85 Dim d = New Decimal 86 VarDecFromI4(x, d.dec) 87 Return d 88 End Function 89 90 Static Function Operator(x As DWord) As Decimal 91 Dim d = New Decimal 92 VarDecFromUI4(x, d.dec) 93 Return d 94 End Function 95 96 Static Function Operator(x As Int64) As Decimal 97 Dim d = New Decimal 98 VarDecFromI8(x, d.dec) 99 Return d 100 End Function 101 102 Static Function Operator(x As QWord) As Decimal 103 Dim d = New Decimal 104 VarDecFromUI8(x, d.dec) 105 Return d 106 End Function 107 108 Static Function Operator(x As DECIMAL) As Decimal 109 Return New Decimal(X) 110 End Function 111 112 Const Function Operator As() As SByte 113 Dim x As SByte 114 VarI1FromDec(dec, x) 115 Return x 116 End Function 117 118 Const Function Operator As() As Byte 119 Dim x As Byte 120 VarUI1FromDec(dec, x) 121 Return x 122 End Function 123 124 Const Function Operator As() As Integer 125 Dim x As Integer 126 VarI2FromDec(dec, x) 127 Return x 128 End Function 129 130 Const Function Operator As() As Word 131 Dim x As Word 132 VarUI2FromDec(dec, x) 133 Return x 134 End Function 135 136 Const Function Operator As() As Long 137 Dim x As Long 138 VarI4FromDec(dec, x) 139 Return x 140 End Function 141 142 Const Function Operator As() As DWord 143 Dim x As DWord 144 VarUI4FromDec(dec, x) 145 Return x 146 End Function 147 148 Const Function Operator As() As Int64 149 Dim x As Int64 150 VarI8FromDec(dec, x) 151 Return x 152 End Function 153 154 Const Function Operator As() As QWord 155 Dim x As QWord 156 VarUI8FromDec(dec, x) 157 Return x 158 End Function 159 160 Const Function Operator As() As Single 161 Dim x As Single 162 VarR4FromDec(dec, x) 163 Return x 164 End Function 165 166 Const Function Operator As() As Double 167 Dim x As Double 168 VarR8FromDec(dec, x) 169 Return x 170 End Function 171 172 Const Function Operator As() As Currency 173 Dim x As Currency 174 VarCyFromDec(dec, x) 175 Return x 176 End Function 177 178 Const Function Operator As() As DECIMAL 179 Return dec 180 End Function 181 182 Static Function Operator As(x As Single) As Decimal 183 Dim d = New Decimal 184 VarDecFromR4(x, d.dec) 185 Return d 186 End Function 187 188 Static Function Operator As(x As Double) As Decimal 189 Dim d = New Decimal 190 VarDecFromR8(x, d.dec) 191 Return d 192 End Function 193 */ 12 194 Const Function Operator +() As Decimal 13 195 Return New Decimal(dec)
Note:
See TracChangeset
for help on using the changeset viewer.