Software Floating-point Numbers and Their Constructors
(optional) integer constant
(optional) unsigned integer constant
An arbitrary-precision software floating-point 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 floating-point 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 floating-point number (see type/sfloat) and a general floating-point number (see type/float) are considered to be the same object. Maple also has hardware floating-point 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 floating-point 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).
To obtain the mantissa and exponent fields of a software float, use SFloatMantissa and SFloatExponent, respectively.
The presence of a floating-point number in an expression generally implies that the computation will use floating-point evaluation. The floating-point evaluator, evalf, can be used to force computation to take place in the floating-point domain.
The number of digits carried in the mantissa for floating-point arithmetic is determined by the Maple environment variable Digits (default is 10).
Maple includes a variety of numeric functions to use with floating-point numbers.
Notes regarding infinity
The quantity Float(infinity) represents a floating-point infinity. This value is used to indicate a floating-point 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 Float⁡a,b 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 non-numeric object in the floating-point 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 non-zero 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 floating-point 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 floating-point 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.⁢I, −0.⁢I, etc.
The Float constructor is called during parsing of all floating-point 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);
The Float command will only be seen when this page is viewed in 1-D Math.
x ≔ −23000.
Rounding ≔ −∞
y ≔ −23000.
Here is an example of float overflow:
Download Help Document
What kind of issue would you like to report? (Optional)