
Calling Sequence


Float(M, E)
SFloat(M, E)
x.yen
x.yEn


Parameters


M



expression

E



expression

x



(optional) integer constant

y



(optional) unsigned integer constant

n



(optional) integer constant





Description


•

An arbitraryprecision software floatingpoint number (an object of type sfloat) is represented internally in Maple by a pair of integers (the mantissa M and the exponent E).

•

The Float(M, E) command can be used to construct the floatingpoint number M * 10^E.


If the mantissa parameter is of type imaginary, Float(M, E) returns I * Float(Im(M), E).


If the mantissa is of type nonreal, Float(M, E) returns Float(Re(M), E) + I * Float(Im(M), E).


The SFloat(M, E) command is equivalent to the Float(M, E) function.


In Maple, a software floatingpoint number (see type[sfloat]) and a general floatingpoint number (see type[float]) are considered to be the same object. Maple also has hardware floatingpoint numbers, of type hfloat (see type[hfloat]), which can be constructed using the HFloat constructor.

•

The maximum number of digits in the mantissa of a software float, and the maximum and minimum allowable exponents, can be obtained from the Maple_floats routine.

•

Software floatingpoint numbers can also be created by entering x.yEn or x.yen, where n is the integer exponent. All three parameters are optional in the calling sequence. If y is omitted in the calling sequence, then the decimal point must also be omitted (for example, 1e0 not 1.e0).

•

The presence of a floatingpoint number in an expression generally implies that the computation will use floatingpoint evaluation. The floatingpoint evaluator, evalf, can be used to force computation to take place in the floatingpoint domain.

•

The number of digits carried in the mantissa for floatingpoint arithmetic is determined by the Maple environment variable Digits (default is 10).

•

Maple includes a variety of numeric functions to use with floatingpoint numbers.

Notes regarding infinity

The quantity Float(infinity) represents a floatingpoint infinity. This value is used to indicate a floatingpoint value that is too large to be otherwise represented. It does not necessarily represent the mathematical concept of infinity.


Float(infinity) can be returned by a function or an operation when the input operands are such that the indicated function or operation will overflow (that is, produce a value that cannot be represented in the $\mathrm{Float}\left(a\,b\right)$ format).


Float(infinity) can be either or both components of a complex number (for example, Float(infinity) + 3.7*I, 0. + Float(infinity)*I). By convention, Maple treats all complex numbers both of whose components are Float(infinity) as the single point complex infinity. This is a convention only, but you (and in your programs) should be cautious about relying on the sign of the real or imaginary part of such an object. See type/cx_infinity.

Notes regarding undefined

The quantity Float(undefined) represents a nonnumeric object in the floatingpoint system. This value can be returned by a function or operation if the input operands are not in the domain of the function or operand.


Note: Float(undefined) values always compare as equal. You can also use type(expr, undefined) to check for an undefined value.


You can tag a Float(undefined) object with the notation Float(n,undefined), where n is a nonzero integer. Whenever possible, Maple preserves this object, in the sense that if it is passed in as an operand to a function or operation, Maple tries to return the same value if it makes sense to do so. In this way, it is possible to perform some retrospective analysis to determine precisely when the object first appeared.


Float(undefined) can be either or both components of a complex number (for example, Float(undefined) + 1.*I, Float(infinity) + Float(undefined)*I. The type undefined recognizes such an object.

Notes regarding zero

In its floatingpoint format, 0 has a sign. The sign of 0 is preserved by arithmetic operations whenever possible, according to the standard rules of algebra. Operations and functions can use the sign of 0 to distinguish qualitative information (for example, branch cut closure), but not quantitative information (0.0 < +0.0 returns false).


It is possible that the result of a computation is mathematically 0, but the sign of that result cannot be established from the application of the standard rules of arithmetic. The simplest such example is x  x. In such cases, Maple uses the following convention.


The result of an indefinitely signed computation whose mathematical value is '0' is set to '+0', unless the `rounding` mode is set to 'infinity', in which case it is set to '0'.


This convention is implemented by the Default0 function.


Corresponding to the convention regarding complex infinities, as described above, Maple treats all complex numbers, both of whose components are floatingpoint 0.'s, as the same. Again, this is a convention, but code should in general not rely on the sign of the real or imaginary part of $0.\+0.\mathrm{I}$, $0.0.\mathrm{I}$, etc.

•

The Float constructor is called during parsing of all floatingpoint numbers and so can be overloaded by creating a module like this: M := module() export Float; Float := proc(m,e) m*ten^e; end; end; The statement, use M in 1.234 end; will then return 123*ten^(2);



Examples


The Float command will only be seen when this page is viewed in 1D Math.
${}{2.76}{}{{10}}^{{10}}$
 (5) 
>

$\mathrm{Default0}\left(\right)$

>

$\mathrm{Rounding}\u2254\mathrm{\∞}$

${\mathrm{Rounding}}{:=}{}{\mathrm{\∞}}$
 (7) 
>

$\mathrm{Default0}\left(\right)$

${2.3}{}{{10}}^{{44}}$
 (10) 
>

$\mathrm{SFloat}\left(23\,45\right)$

${2.3}{}{{10}}^{{44}}$
 (11) 
>

$\mathrm{interface}\left(\mathrm{prettyprint}\=0\right)$

${y}{:=}{}{23000.}$
 (15) 
${}{2.76}{}{{10}}^{{9}}$
 (16) 
${2.3}{}{{10}}^{{44}}$
 (17) 
Here is an example of float overflow:
>

${\ⅇ}^{1.{10}^{100}}$

${\mathrm{Float}}{}\left({\mathrm{\∞}}\right)$
 (18) 


