SuggestedDatatype - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ArrayTools

  

SuggestedDatatype

  

suggest Array datatype for an operation on two Arrays

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

SuggestedDatatype(X,Y)

Parameters

X, Y

-

Array, hardware float, or general expression

Description

• 

SuggestedDatatype(X,Y) accepts two Arrays, X and Y, and suggests a datatype to use for a result involving an operation between X and Y.

• 

If X or Y is a hardware float (hfloat), it is considered to be an Array with datatype float[8].

• 

If X or Y is not an Array or hardware float, it is considered to be of type anything.

• 

The suggested datatype for the resulting Array will be one that can represent any value appearing in either of the two Arrays. For example, if X has datatype integer[2] and Y has datatype float[4], then the suggested datatype will be float[4].

• 

SuggestedDatatype does not know what operation will be performed between X and Y, so the suggestion might still be unsuitable. For example, if the elements of X and Y Arrays with datatype integer[1] are to be added, the resulting values may be too large. On the other hand, if the operation is to find the smaller of each pair of values, the resulting values will all fit into the datatype.

• 

This function is part of the ArrayTools package, so it can be used in the short form SuggestedDatatype(..) only after executing the command with(ArrayTools). However, it can always be accessed through the long form of the command by using ArrayTools[SuggestedDatatype](..).

Examples

withArrayTools:

M1Matrix1,2,3,4,datatype=integer2

M11234

(1)

M2Vectorrow1+2I,3+4I,datatype=complex8

M21.+2.I3.+4.I

(2)

SuggestedDatatypeM1,M2

complex8

(3)

M3Vectorrowhello,world,datatype=string

M3helloworld

(4)

SuggestedDatatypeM1,M3

anything

(5)

Because float[4] has less precision than integer[4], the datatype is promoted to float[8] when combining these two.

M4Vectorrow1.2,3.4,datatype=float4

M41.200000047683723.40000009536743

(6)

M5Vectorrow7,8,9,datatype=integer4

M5789

(7)

SuggestedDatatypeM4,M5

float8

(8)

Compatibility

• 

The ArrayTools[SuggestedDatatype] command was introduced in Maple 2021.

• 

For more information on Maple 2021 changes, see Updates in Maple 2021.

See Also

ArrayTools

ArrayTools[SuggestedOrder]

ArrayTools[SuggestedSubtype]