本文整理汇总了VB.NET中System.Numerics.BigInteger.Explicit操作符的典型用法代码示例。如果您正苦于以下问题:VB.NET BigInteger.Explicit操作符的具体用法?VB.NET BigInteger.Explicit怎么用?VB.NET BigInteger.Explicit使用的例子?那么恭喜您, 这里精选的操作符代码示例或许可以为您提供帮助。您也可以进一步了解该操作符所在类System.Numerics.BigInteger 的用法示例。
在下文中一共展示了BigInteger.Explicit操作符的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: decimals
' Explicit Decimal to BigInteger conversion
Dim decimals() As Decimal = { Decimal.MinValue, -15632.991d, 9029321.12d,
Decimal.MaxValue }
Dim number As BigInteger
Console.WriteLine("{0,35} {1,35}", "Decimal", "BigInteger")
Console.WriteLine()
For Each value As Decimal In decimals
number = CType(value, BigInteger)
Console.WriteLine("{0,35} {1,35}",
value, number)
Next
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:12,代码来源:BigInteger.Explicit 输出:
Decimal BigInteger
-79228162514264337593543950335 -79228162514264337593543950335
-15632.991 -15632
9029321.12 9029321
79228162514264337593543950335 79228162514264337593543950335
示例2: doubles
Dim doubles() As Double = { Double.MinValue, -1.430955172e03, 2.410970032e05,
Double.MaxValue, Double.PositiveInfinity,
Double.NegativeInfinity, Double.NaN }
Dim number As BigInteger
Console.WriteLine("{0,37} {1,37}", "Double", "BigInteger")
Console.WriteLine()
For Each value As Double In doubles
Try
number = CType(value, BigInteger)
Console.WriteLine("{0,37} {1,37}", value, number)
Catch e As OverflowException
Console.WriteLine("{0,37} {1,37}", value, "OverflowException")
End Try
Next
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:15,代码来源:BigInteger.Explicit 输出:
Double BigInteger
-1.79769313486232E+308 -1.7976931348623157081452742373E+308
-1430.955172 -1430
241097.0032 241097
1.79769313486232E+308 1.7976931348623157081452742373E+308
Infinity OverflowException
-Infinity OverflowException
NaN OverflowException
示例3: CType
' BigInteger to Byte conversion.
Dim goodByte As BigInteger = BigInteger.One
Dim badByte As BigInteger = 256
Dim byteFromBigInteger As Byte
' Convert using CType function.
byteFromBigInteger = CType(goodByte, Byte)
Console.WriteLine(byteFromBigInteger)
' Convert using CByte function.
byteFromBigInteger = CByte(goodByte)
Console.WriteLine(byteFromBigInteger)
' Handle conversion that should result in overflow.
Try
byteFromBigInteger = CType(badByte, Byte)
Console.WriteLine(byteFromBigInteger)
Catch e As OverflowException
Console.WriteLine("Unable to convert {0}:{1} {2}", _
badByte, vbCrLf, e.Message)
End Try
Console.WriteLine()
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:22,代码来源:BigInteger.Explicit
示例4: CType
' BigInteger to Decimal conversion.
Dim goodDecimal As BigInteger = 761652543
Dim badDecimal As BigInteger = CType(Decimal.MaxValue, BigInteger)
badDecimal += BigInteger.One
Dim decimalFromBigInteger As Decimal
' Convert using CType function.
decimalFromBigInteger = CType(goodDecimal, Decimal)
Console.WriteLine(decimalFromBigInteger)
' Convert using CDec function.
decimalFromBigInteger = CDec(goodDecimal)
Console.WriteLine(decimalFromBigInteger)
' Handle conversion that should result in overflow.
Try
decimalFromBigInteger = CType(badDecimal, Decimal)
Console.WriteLine(decimalFromBigInteger)
Catch e As OverflowException
Console.WriteLine("Unable to convert {0}:{1} {2}", _
badDecimal, vbCrLf, e.Message)
End Try
Console.WriteLine()
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:23,代码来源:BigInteger.Explicit
示例5: CType
' BigInteger to Double conversion.
Dim goodDouble As BigInteger = 102.43e22
Dim badDouble As BigInteger = CType(Double.MaxValue, BigInteger)
badDouble = badDouble * 2
Dim doubleFromBigInteger As Double
' Convert using CType function.
doubleFromBigInteger = CType(goodDouble, Double)
Console.WriteLine(doubleFromBigInteger)
' Convert using CDbl function.
doubleFromBigInteger = CDbl(goodDouble)
Console.WriteLine(doubleFromBigInteger)
' Convert an out-of-bounds BigInteger value to a Double.
doubleFromBigInteger = CType(badDouble, Double)
Console.WriteLine(doubleFromBigInteger)
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:17,代码来源:BigInteger.Explicit
示例6: CType
' Increase a BigInteger so it exceeds Double.MaxValue.
Dim number1 As BigInteger = CType(Double.MaxValue, BigInteger)
Dim number2 As BigInteger = number1
number2 = number2 + 9.999e291
' Compare the BigInteger values for equality.
Console.WriteLine("BigIntegers equal: {0}", number2.Equals(number1))
' Convert the BigInteger to a Double.
Dim dbl As Double = CType(number2, Double)
' Display the two values.
Console.WriteLine("BigInteger: {0}", number2)
Console.WriteLine("Double: {0}", dbl)
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:13,代码来源:BigInteger.Explicit 输出:
BigIntegers equal: False
BigInteger: 1.7976931348623158081352742373E+308
Double: 1.79769313486232E+308
示例7: CType
' BigInteger to Int16 conversion.
Dim goodShort As BigInteger = 20000
Dim badShort As BigInteger = 33000
Dim shortFromBigInteger As Short
' Convert using CType function.
shortFromBigInteger = CType(goodShort, Short)
Console.WriteLine(shortFromBigInteger)
' Convert using CShort function.
shortFromBigInteger = CShort(goodShort)
Console.WriteLine(shortFromBigInteger)
' Handle conversion that should result in overflow.
Try
shortFromBigInteger = CType(badShort, Short)
Console.WriteLine(shortFromBigInteger)
Catch e As OverflowException
Console.WriteLine("Unable to convert {0}:{1} {2}", _
badShort, vbCrLf, e.Message)
End Try
Console.WriteLine()
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:22,代码来源:BigInteger.Explicit
示例8: CType
' BigInteger to Int32 conversion.
Dim goodInteger As BigInteger = 200000
Dim badInteger As BigInteger = 65000000000
Dim integerFromBigInteger As Integer
' Convert using CType function.
integerFromBigInteger = CType(goodInteger, Integer)
Console.WriteLine(integerFromBigInteger)
' Convert using CInt function.
integerFromBigInteger = CInt(goodInteger)
Console.WriteLIne(integerFromBigInteger)
' Handle conversion that should result in overflow.
Try
integerFromBigInteger = CType(badInteger, Integer)
Console.WriteLine(integerFromBigInteger)
Catch e As OverflowException
Console.WriteLine("Unable to convert {0}:{1} {2}", _
badInteger, vbCrLf, e.Message)
End Try
Console.WriteLine()
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:22,代码来源:BigInteger.Explicit
示例9: CType
' BigInteger to Int64 conversion.
Dim goodLong As BigInteger = 2000000000
Dim badLong As BigInteger = BigInteger.Pow(goodLong, 3)
Dim longFromBigInteger As Long
' Convert using CType function.
longFromBigInteger = CType(goodLong, Long)
Console.WriteLine(longFromBigInteger)
' Convert using CLng function.
longFromBigInteger = CLng(goodLong)
Console.WriteLine(longFromBigInteger)
' Handle conversion that should result in overflow.
Try
longFromBigInteger = CType(badLong, Long)
Console.WriteLine(longFromBigInteger)
Catch e As OverflowException
Console.WriteLine("Unable to convert {0}:{1} {2}", _
badLong, vbCrLf, e.Message)
End Try
Console.WriteLine()
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:22,代码来源:BigInteger.Explicit
示例10: CType
' BigInteger to SByte conversion.
Dim goodSByte As BigInteger = BigInteger.MinusOne
Dim badSByte As BigInteger = -130
Dim sByteFromBigInteger As SByte
' Convert using CType function.
sByteFromBigInteger = CType(goodSByte, SByte)
Console.WriteLine(sByteFromBigInteger)
' Convert using CSByte function.
sByteFromBigInteger = CSByte(goodSByte)
Console.WriteLine(sByteFromBigInteger)
' Handle conversion that should result in overflow.
Try
sByteFromBigInteger = CType(badSByte, SByte)
Console.WriteLine(sByteFromBigInteger)
Catch e As OverflowException
Console.WriteLine("Unable to convert {0}:{1} {2}", _
badSByte, vbCrLf, e.Message)
End Try
Console.WriteLine()
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:22,代码来源:BigInteger.Explicit
示例11: CType
' BigInteger to Single conversion.
Dim goodSingle As BigInteger = 102.43e22
Dim badSingle As BigInteger = CType(Single.MaxValue, BigInteger)
badSingle = badSingle * 2
Dim singleFromBigInteger As Single
' Convert using CType function.
singleFromBigInteger = CType(goodSingle, Single)
Console.WriteLine(singleFromBigInteger)
' Convert using CSng function.
singleFromBigInteger = CSng(goodSingle)
Console.WriteLine(singleFromBigInteger)
' Convert an out-of-bounds BigInteger value to a Single.
singleFromBigInteger = CType(badSingle, Single)
Console.WriteLine(singleFromBigInteger)
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:17,代码来源:BigInteger.Explicit
示例12: CType
' Increase a BigInteger so it exceeds Single.MaxValue.
Dim number1 As BigInteger = CType(Single.MaxValue, BigInteger)
Dim number2 As BigInteger = number1
number2 = number2 + 9.999e30
' Compare the BigInteger values for equality.
Console.WriteLine("BigIntegers equal: {0}", number2.Equals(number1))
' Convert the BigInteger to a Single.
Dim sng As Single = CType(number2, Single)
' Display the two values.
Console.WriteLine("BigInteger: {0}", number2)
Console.WriteLine("Single: {0}", sng)
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:13,代码来源:BigInteger.Explicit 输出:
BigIntegers equal: False
BigInteger: 3.4028235663752885981170396038E+38
Single: 3.402823E+38
示例13: CType
' BigInteger to UInt16 conversion.
Dim goodUShort As BigInteger = 20000
Dim badUShort As BigInteger = 66000
Dim uShortFromBigInteger As UShort
' Convert using CType function.
uShortFromBigInteger = CType(goodUShort, UShort)
Console.WriteLine(uShortFromBigInteger)
' Convert using CUShort function.
uShortFromBigInteger = CUShort(goodUShort)
Console.WriteLine(uShortFromBigInteger)
' Handle conversion that should result in overflow.
Try
uShortFromBigInteger = CType(badUShort, UShort)
Console.WriteLine(uShortFromBigInteger)
Catch e As OverflowException
Console.WriteLine("Unable to convert {0}:{1} {2}", _
badUShort, vbCrLf, e.Message)
End Try
Console.WriteLine()
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:22,代码来源:BigInteger.Explicit
示例14: CType
' BigInteger to UInt32 conversion.
Dim goodUInteger As BigInteger = 200000
Dim badUInteger As BigInteger = 65000000000
Dim uIntegerFromBigInteger As UInteger
' Convert using CType function.
uIntegerFromBigInteger = CType(goodInteger, UInteger)
Console.WriteLine(uIntegerFromBigInteger)
' Convert using CUInt function.
uIntegerFromBigInteger = CUInt(goodInteger)
Console.WriteLine(uIntegerFromBigInteger)
' Handle conversion that should result in overflow.
Try
uIntegerFromBigInteger = CType(badUInteger, UInteger)
Console.WriteLine(uIntegerFromBigInteger)
Catch e As OverflowException
Console.WriteLine("Unable to convert {0}:{1} {2}", _
badUInteger, vbCrLf, e.Message)
End Try
Console.WriteLine()
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:22,代码来源:BigInteger.Explicit
示例15: CType
' BigInteger to UInt64 conversion.
Dim goodULong As BigInteger = 2000000000
Dim badULong As BigInteger = BigInteger.Pow(goodULong, 3)
Dim uLongFromBigInteger As ULong
' Convert using CType function.
uLongFromBigInteger = CType(goodULong, ULong)
Console.WriteLine(uLongFromBigInteger)
' Convert using CULng function.
uLongFromBigInteger = CULng(goodULong)
Console.WriteLine(uLongFromBigInteger)
' Handle conversion that should result in overflow.
Try
uLongFromBigInteger = CType(badULong, ULong)
Console.WriteLine(uLongFromBigInteger)
Catch e As OverflowException
Console.WriteLine("Unable to convert {0}:{1} {2}", _
badULong, vbCrLf, e.Message)
End Try
Console.WriteLine()
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:22,代码来源:BigInteger.Explicit
示例16: singles
Dim singles() As Single = { Single.MinValue, -1.430955172e03, 2.410970032e05,
Single.MaxValue, Single.PositiveInfinity,
Single.NegativeInfinity, Single.NaN }
Dim number As BigInteger
Console.WriteLine("{0,37} {1,37}", "Single", "BigInteger")
Console.WriteLine()
For Each value As Single In singles
Try
number = CType(value, BigInteger)
Console.WriteLine("{0,37} {1,37}", value, number)
Catch e As OverflowException
Console.WriteLine("{0,37} {1,37}", value, "OverflowException")
End Try
Next
开发者ID:VB.NET开发者,项目名称:System.Numerics,代码行数:15,代码来源:BigInteger.Explicit 输出:
Single BigInteger
-3.402823E+38 -3.4028234663852885981170418348E+38
-1430.955 -1430
241097 241097
3.402823E+38 3.4028234663852885981170418348E+38
Infinity OverflowException
-Infinity OverflowException
NaN OverflowException
注:本文中的System.Numerics.BigInteger.Explicit操作符示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论