25112 Rev. 3.06 September 2005

Software Optimization Guide for AMD64 Processors

2.1Declarations of Floating-Point Values

Optimization

When working with single precision (float) values:

Use the f or F suffix (for example, 3.14f) to specify a constant value of type float.

Use function prototypes for all functions that accept arguments of type float.

Application

This optimization applies to:

32-bit software

64-bit software

Rationale

C and C++ compilers treat floating-point constants and arguments as double precision (double) unless you specify otherwise. However, single precision floating-point values occupy half the memory space as double precision values and can often provide the precision necessary for a given computational problem.

Chapter 2

C and C++ Source-Level Optimizations

9

Page 25
Image 25
AMD 250 manual Declarations of Floating-Point Values, Optimization, Application, Rationale