IMcOMGlobalMcOpCast Method
|
|
Casts the values in a Variant to another arithmetic type
Namespace:
MediaCy.IQL.ObjectManager
Assembly:
MediaCy.IQL.ObjectManager (in MediaCy.IQL.ObjectManager.dll) Version: 10.0.6912.0
SyntaxFunction McOpCast (
Operand As Object,
CastToTypeName As String
) As McObject
Parameters
- Operand
- Type: SystemObject
May be a scalar or array of any arithmetic type. It may also
be an McObject instance of an arithmetic type. - CastToTypeName
- Type: SystemString
Destination type for the case. Allowed names are
"INTEGER" for 32-bit integer (VB Long type), "LONG" for 64-bit integer,
"SHORT" for 16-bit integer (VB Integer type), "BYTE" for 8-bit unsigned
integer (VB Byte type), "REAL" for 64-bit IEEE floating point (VB Double
type) or "FLOAT" for 32-bit IEEE floating point (DB Single type).
Return Value
Type:
McObjectA McObject instance holding the cast Operand. The returned result will
be of the arithmetic type specified by the CastToTypeName argument. It will
also be the same shape as Operand, except that it will always be an array, even
if the Operand is a scalar (generally there is no reason to use these vector
operators unless you are dealing with arrays).
RemarksThe Operand (which may be a scalar or an array of arthmetic values) is
converted to a requested destination type.
Casting can be especially important when using these vector operations, because
the association rules for both arithmetic and logical binary operations (E.g.
McOpAdd or McOpGT) always cast the right operand to the type of the left before
performing the operation. Thus, McOpAdd( 1, 1.5) yields 2, not the intuitively
expected 2.5; McOpAdd(McOpCast(1,"REAL"),1.5) does give the expected result.
Examples
Set var2thru10 = McOpCast( McOpFillIn(2,11), "REAL")
Set varResult = McOpMul( var2thru10, 0.1)
MsgBox( "Operation IMcObject Result = " + McToText(varResult))
See Also