<cfloat> (float.h)

Source: Internet
Author: User

Header file:

<cfloat> (float.h)

Characteristics of floating-point types

This header file describes the characteristics of floating-point types for special system and compiler implementations.

A floating-point number consists of four elements:

    • A symbol (a sign): positive or negative;
    • A base (a base): This means that a string of different numbers can be represented by a single number (2 is binary), 10 is decimal (decimal), and 16 is hexadecimal (hexadecimal) ...);
    • An effective number (a significand): This is a series of numbers mentioned earlier, the number of digits in this series is well-known precision;
    • An exponent (an exponent): it represents the offset of a valid number, affecting its value in the following way:
Floating-point value = valid number x cardinality index (with the corresponding flag (sign))(image)

Macro Constants

The table below shows the names of the different variables defined in this header file and the minimum maximum values for all implementations
(The specific implementation may have values larger or smaller as described below):

When a group of macros is prefixed with Flt_,dbl_ and Ldbl_, the flt_ starts with float,以DBL_开头的适用于double,以LDBL_开头的适用于long double;

Name Value Represent Said
Flt_radix 2 or larger Cardinality (radix)
Cardinality of all floating-point types
flt_mant_dig
Span style= "font-size:15px;" >dbl_mant_dig
ldbl_mant_dig
&NBSP;

(Mantissa DIGits)

  the precision of the effective number, the number of digits that match the number of valid digits
flt_dig
dbl_dig
ldbl_dig

6 or greater

10 or larger

10 or greater

  Precision

(DIGits)

  with a decimal number can be converted to a floating point and convert it back again without changing the integer number

flt_min_exp
dbl_min_exp
ldbl_min_exp
&NBSP; the smallest negative integer value for generating a normalized floating-point exponent
flt_min_10_exp
Span style= "font-size:15px;" >dbl_min_10_exp
ldbl_min_10_exp

-37 or smaller

-37 or smaller

-37 or smaller

  min. 10 base exponent

decimal exponential expression for generating a standard floating-point number

flt_max_exp
dbl_max_exp
ldbl_max_exp
&NBSP;   Maximum integer value for generating a normalized floating-point exponent
flt_max_10_exp
Span style= "font-size:15px;" >dbl_max_10_exp
ldbl_max_10_exp

37 or greater

37 or greater

10-based exponent  

decimal exponential expression for generating a standard floating-point number

flt_max
dbl_max
ldbl_max
1E+37 or greater
1E+37 or greater
1E+37 or larger
  Maximum number   Represents the maximum limited number of floating-point numbers
flt_epsilon
dbl_epsilon
ldbl_epsilon
1E-5 or smaller
1E-9 or smaller
1E-9 or smaller
 epsilon:)
  can represent a difference of 1 and Min values greater than 1
flt_min
dbl_min
ldbl_min
1E-37 or smaller
1E-37 or smaller
1E-37 or smaller
  minimum   represents the least limited number of floating-point numbers
flt_rounds &NBSP;   Rounding Method

  rounding behavior, Possible values:

-1: Indeterminate

0: rounding to 0

1: rounding

2: Positive Infinity

3: Negative infinity

* applies to all floating-point types (float, Double and long double)

flt_eval_method     assignment-formatted properties, possible values:

-1: Indeterminate

0: Range and precision of the assignment type

1: Assign a value of float and double as double,

long double as long double

2: all are treated as long double when assigned, and other negative numbers are expressed as the definition of implementation (implementation-defined) behavior

* applies to all floating-point types

Decimal_dig Decimal precision

You can convert a decimal number to a floating-point type number,

And again to the same number as the original without loss of precision

Versatility

FLT_EVAL_METHOD AndDECIMAL_DIG 是在符合C99标准的库中定义的或者只在符合C11的库中

Please see

<climits> (LIMITS.H) The size of an integer type

/*

First modified: January 30, 2016 20:32:35

*/

<cfloat> (float.h)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.