The Rounding Environment Variable - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Numerical Computations : Maple Numerics : Rounding

The Rounding Environment Variable

Calling Sequence

Rounding := x

Parameters

x

-

one of 0, nearest, infinity, -infinity, simple

Description

• 

The Rounding environment variable controls the rounding of floating-point results.

• 

There are five rounding modes available in Maple.

  

 

Rounding Mode

Meaning

 

 

nearest

round to the nearest possible value,

 

with ties resolved by rounding to the nearest even

0

round towards zero

infinity

round towards positive infinity

-infinity

round towards negative infinity

simple

round to the nearest possible value,

 

with ties resolved by rounding up

 

 

• 

The value of Rounding is changed by using the assignment operator.  The default value of Rounding is nearest.

• 

To determine the current value of Rounding during a Maple session, enter the command Rounding;.

• 

The rounding mode determines the sign of 0 when it cannot be obtained otherwise.

• 

Infinities always round to themselves, independent of the rounding value.

• 

Maple fully evaluates environment variables such as Rounding. Because Rounding is an environment variable, any assignments to it inside a procedure body are undone upon exit from the procedure.

Examples

Rounding

nearest

(1)

f := proc()
    print( "Entering f. Rounding is", Rounding );
    Rounding := -infinity;
    print( "The current value of Rounding is", Rounding );
end proc:

f

Entering f. Rounding is,nearest

The current value of Rounding is,∞

(2)

Rounding

nearest

(3)

When returning from f in the procedure above, Maple resets Rounding to its value on entry to f.

1.410

28.92546550

(4)

Rounding:=0

Rounding:=0

(5)

1.410

28.92546549

(6)

Rounding:=nearest

Rounding:=nearest

(7)

2.2.

0.

(8)

Rounding:=∞

Rounding:=∞

(9)

2.2.

0.

(10)

See Also

assignment, Default0, environment, float, infinity, last_name_eval, round, type[float], type[infinity]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam