Skip to Content
C Pocket Reference
book

C Pocket Reference

by Peter Prinz, Ulla Kirch-Prinz
November 2002
Beginner to intermediate
142 pages
4h 19m
English
O'Reilly Media, Inc.
Content preview from C Pocket Reference

Range and Precision of Real Floating Types

The macros listed in Table 1-26 are defined in the header file float.h to represent the range and the precision of the types float , double , and long double . The macro names are formed using the prefixes FLT for float, DBL for double, and LDBL for long double. The macros FLT_RADIX and FLT_ROUNDS apply to all three floating types.

Table 1-26. Macros for floating types in float.h

Macro name

Purpose

FLT_RADIX

Base (or radix) of the exponential notation

FLT_ROUNDS

Indicates how rounding is performed on values that cannot be represented exactly:

-1 = undetermined

0 = towards zero,

1 = towards the nearest representable value

2 = upwards

3 = downwards

FLT_MANT_DIG 
DBL_MANT_DIG 
LDBL_MANT_DIG

The number of digits in the mantissa to base FLT_RADIX

FLT_MIN_EXP 
DBL_MIN_EXP 
LDBL_MIN_EXP

Minimum value of the exponent to base FLT_RADIX

FLT_MAX_EXP 
DBL_MAX_EXP 
LDBL_MAX_EXP

Maximum value of the exponent to base FLT_RADIX

The macros listed in Table 1-26 document the range and precision of all real floating types. In actual programs, such information is most often needed for decimal (base 10) notation. Accordingly, you can use the macros for type float listed Table 1-27, and which are defined in float.h.

Table 1-27. Limits for the type float

Macro name

Purpose

FLT_DIG

Precision as a number of decimal digits

FLT_MIN_10_EXP

Minimum negative exponent to base 10

FLT_MAX_10_EXP

Maximum positive exponent to base 10 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Embedded-Software entwickeln

Embedded-Software entwickeln

Thomas Eißenlöffel
Eingebettete Systeme, 2nd Edition

Eingebettete Systeme, 2nd Edition

Walter Lange, Martin Bogdan, Thomas Schweizer

Publisher Resources

ISBN: 0596004362Errata Page