## Name:

round rounds a number to a floating-point format.

## Usage:

round(x,n,mode) : (constant, integer, RN|RZ|RU|RD) -> constant round(x,format,mode) : (constant, D|double|DD|doubledouble|DE|doubleextended|TD|tripledouble, RN|RZ|RU|RD) -> constant

## Parameters:

• x is a constant to be rounded.
• n is the precision of the target format.
• format is the name of a supported floating-point format.
• mode is the desired rounding mode.

## Description:

• If used with an integer parameter n, round(x,n,mode) rounds x to a floating-point number with precision n, according to rounding-mode mode.
• If used with a format parameter format, round(x,format,mode) rounds x to a floating-point number in the floating-point format format, according to rounding-mode mode.
• Subnormal numbers are not handled are handled only if a format parameter is given that is different from doubleextended. The range of possible exponents is the range used for all numbers represented in Sollya (e.g. basically the range used in the library MPFR).

## Example 1:

> display=binary!;
> round(Pi,20,RN);
1.100100100001111111_2 * 2^(1)

## Example 2:

> printdouble(round(exp(17),53,RU));
0x417709348c0ea4f9
> printdouble(D(exp(17)));
0x417709348c0ea4f9

## Example 3:

> display=binary!;
> a=2^(-1100);
> round(a,53,RN);
1_2 * 2^(-1100)
> round(a,D,RN);
0
> double(a);
0
Go back to the list of commands