type/float - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Type Checking : Types : type/float

type/float

check for an object of type float

type/sfloat

check for an object of type sfloat

type/hfloat

check for an object of type hfloat

type/float[] and type/float[8]

check for an object of type float[] or float[8]

type/double

check for an object of type double

 Calling Sequence type(x, float) type(x, sfloat) type(x, hfloat) type(x, float[]) type(x, float[8]) type(x, double)

Parameters

 x - any expression

Description

 • The type(x, sfloat) function returns true if x is a Maple software float. Otherwise, false is returned.
 • The type(x, float[]), type(x, float[8]), type(x, double), and type(x, hfloat) functions return true if x is a Maple hardware float.
 The "8" in float[8] refers to the number of bytes allocated for the hardware floating-point number.  Only double precision floats (8 bytes) are currently supported. The types float[], float[8], double, and hfloat are synonymous with one another.
 • The type(x, float) function returns true if x is of type sfloat, hfloat, float[], float[8], or double.
 • The type(x, double) function returns true if x is of type hfloat, float[], float[8], or double.

Examples

 > $\mathrm{type}\left(\frac{1}{2},\mathrm{float}\right)$
 ${\mathrm{false}}$ (1)
 > $\mathrm{type}\left(0.5,\mathrm{float}\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{type}\left(0.5,\mathrm{sfloat}\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{type}\left(0.5,\mathrm{hfloat}\right)$
 ${\mathrm{false}}$ (4)
 > $\mathrm{half}≔\mathrm{HFloat}\left(.5\right)$
 ${\mathrm{half}}{≔}{0.500000000000000}$ (5)
 > $\mathrm{type}\left(\mathrm{half},\mathrm{float}\right)$
 ${\mathrm{true}}$ (6)
 > $\mathrm{type}\left(\mathrm{half},\mathrm{sfloat}\right)$
 ${\mathrm{false}}$ (7)
 > $\mathrm{type}\left(\mathrm{half},\mathrm{hfloat}\right)$
 ${\mathrm{true}}$ (8)
 > $\mathrm{type}\left("String",\mathrm{float}\right)$
 ${\mathrm{false}}$ (9)
 > $\mathrm{type}\left(\mathrm{Name},\mathrm{float}\right)$
 ${\mathrm{false}}$ (10)
 > $\mathrm{type}\left(a\left[b\right],\mathrm{float}\right)$
 ${\mathrm{false}}$ (11)
 > $\mathrm{type}\left(\frac{a}{b},\mathrm{float}\right)$
 ${\mathrm{false}}$ (12)
 > $A≔\mathrm{Matrix}\left(\left[\left[1,2\right],\left[3,4\right]\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${A}{≔}\left[\begin{array}{cc}{1.}& {2.}\\ {3.}& {4.}\end{array}\right]$ (13)
 > $\mathrm{type}\left(A,'\mathrm{Matrix}'\left(\mathrm{float}\left[8\right]\right)\right)$
 ${\mathrm{true}}$ (14)
 > $\mathrm{type}\left(A,'\mathrm{Matrix}'\left(\mathrm{hfloat}\right)\right)$
 ${\mathrm{true}}$ (15)
 > $\mathrm{type}\left(A,'\mathrm{Matrix}'\left(\mathrm{double}\right)\right)$
 ${\mathrm{true}}$ (16)
 > $\mathrm{type}\left(A,'\mathrm{Matrix}'\left(\mathrm{sfloat}\right)\right)$
 ${\mathrm{false}}$ (17)

Compatibility

 • The type/double command was introduced in Maple 2015.