-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
        .-n-.   
>>- -y--+-m-+--------------------------------------------------><
        +-p-+   
        '-z-'   

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.

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