Floating-point Macros and Pragmas

Floating-point macros and pragmas for math.h


#pragma OPENCL FP_CONTRACT on-off-switch
        
on-off-switch is one of:
     ON, OFF or DEFAULT.
     The DEFAULT value is ON.
        

FP_CONTRACT

The FP_CONTRACT pragma takes the form:

#pragma OPENCL FP_CONTRACT on-off-switch

FP_CONTRACT can be used to allow (if the state is on) or disallow (if the state is off) the implementation to contract expressions. Each pragma can occur either outside external declarations or preceding all explicit declarations and statements inside a compound statement.

The parameter on-off-switch is one of ON, OFF or DEFAULT. The DEFAULT value is ON.

When outside external declarations, the pragma takes effect from its occurrence until another FP_CONTRACT pragma is encountered, or until the end of the translation unit. When inside a compound statement, the pragma takes effect from its occurrence until another FP_CONTRACT pragma is encountered (including within a nested compound statement), or until the end of the compound statement; at the end of a compound statement the state for the pragma is restored to its condition just before the compound statement. If this pragma is used in any other context, the behavior is undefined.

FP_FAST_FMA and FP_FAST_FMAF

The FP_FAST_FMA macro indicates whether the fma family of functions are fast compared with direct code for double precision floating-point. If defined, the FP_FAST_FMA macro shall indicate that the fma() function generally executes about as fast as, or faster than, a multiply and an add of double operands.

The FP_FAST_FMAF macro indicates whether the fma function is fast compared with direct code for single precision floating-point. If defined, the FP_FAST_FMAF macro shall indicate that the fma() function generally executes about as fast as, or faster than, a multiply and an add of float operands.

Specification

OpenCL Specification

Also see

Math Functions, Symbolic Math Constants, Macros and Limits

Copyright © 2007-2010 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.