Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) float

 

float is a keyword for the data type to store a real number, for example the value of pi.

 

Consider using double exclusively for floating-point types used in a class interface unless there is compelling reason to use float or long double instead [1].

 

float x = 1.23456789;

 

 

 

 

 

double code snippets

 

  1. GetSmallestFloat
  2. GetMaxFloat

 

 

 

 

 

References

 

  1. John Lakos. Large-Scale C++ Software Design. 1996. ISBN: 0-201-63362-0. Chapter 9.2.4: 'Consider using double exclusively for floating-point types used in the interface unless there is a compelling reason to use float or long double'

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict