-y

Category

Floating-point and integer control

Pragma equivalent

None.

Purpose

Specifies the rounding mode for the compiler to use when evaluating constant floating-point expressions at compile time.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-dn--.   
        +-n---+   
>>- -y--+-m---+------------------------------------------------><
        +-p---+   
        +-z---+   
        +-di--+   
        +-dm--+   
        +-dna-+   
        +-dnz-+   
        +-dp--+   
        '-dz--'   

Defaults

-yn, -ydn

Parameters

The following suboptions are valid for binary floating-point types only:
m
Round toward minus infinity.
n
Round to the nearest representable number, ties to even.
p
Round toward plus infinity.
z
Round toward zero.
The following suboptions are valid for decimal floating-point types only:
di
Round toward infinities (away from zero).
dm
Round toward minus infinity.
dn
Round to the nearest representable number, ties to even.
dna
Round to the nearest representable number, ties away from zero.
dnz
Round to the nearest representable number, ties toward zero.
dp
Round toward plus infinity.
dz
Round toward zero.

Usage

If your program contains operations involving long doubles, the rounding mode must be set to -yn (round-to-nearest representable number, ties to even).

Predefined macros

None.

Examples

To compile myprogram.c so that constant floating-point expressions are rounded toward zero at compile time, enter:
xlc myprogram.c -yz -ydz