float.h in C
float.h in C
The header file named float.h of Library C contains a set of diverse constants (platform dependent) related to floating point real number values. These constants are proposed by ANSI C. Before understanding these constants, you need to know the floating-point real number of 4 components:
Composition Description (+/-) b Representation of base: binary is 2, decimal is 10, hexadecimal is 16, . e exponent (exponent), an integer between e min and e max p Meaning decimal number (Precision)Based on the above 4 components, a floating point number will have its value expressed as follows:
s ố th ự c d ấ u ch ấ m độ ng = ( S ) p x b e ho ặ c s ố th ự c d ấ u ch ấ m độ ng = (+/-) precision x base exponent
Macros are defined in float.h
The following values are separate implementers and are defined with #define directives, but these values cannot be lowercase. Note that all FLT references to float type, DBL refers to double and LDBL refers to long double.
Macro Description FLT_ROUNDS Defining the rounding mode allows the addition of floating point numbers and it can have any of the following values:-1 - Unknown
0 - Round to 0
1 - Rounding to the nearest value
2 - Towards positive infinity
3 - Towards infinity negative FLT_RADIX 2 Definition represents the radix of the exponent. Base-2 is binary, base-10 is a decimal system .
FLT_MANT_DIG
DBL_MANT_DIG
LDBL_MANT_DIG
These macros define the number of digits to represent the real number (in FLT_RADIX base)FLT_DIG 6
DBL_DIG 10
LDBL_DIG 10
These macros determine the maximum number of decimal places (base-10) that can be represented without changing after rounding.FLT_MIN_EXP
DBL_MIN_EXP
LDBL_MIN_EXP
These macros determine the smallest vowel value for exponent in FLT_RADIX radixFLT_MIN_10_EXP -37
DBL_MIN_10_EXP -37
LDBL_MIN_10_EXP -37
These macros define the smallest vowel value for an exponent in base 10FLT_MAX_EXP
DBL_MAX_EXP
LDBL_MAX_EXP
These macros define the maximum integer value for an exponent in FLT_RADIX baseFLT_MAX_10_EXP +37
DBL_MAX_10_EXP +37
LDBL_MAX_10_EXP +37
These macros define the maximum integer value for an exponent in base 10FLT_MAX 1E + 37
DBL_MAX 1E + 37
LDBL_MAX 1E + 37
These macros determine the largest floating point real number valueFLT_EPSILON 1E-5
DBL_EPSILON 1E-9
LDBL_EPSILON 1E-9
These macros define the least significant digit that can be representedFLT_MIN 1E-37
DBL_MIN 1E-37
LDBL_MIN 1E-37
These macros define the smallest floating point real number valuesFor example
The following program C illustrates the usage of some constants defined in float.h.
#include #include int main () { printf ( "Gia tri max cua mot so thuc = %.10en" , FLT_MAX ); printf ( "Gia tri min cua mot so thuc = %.10en" , FLT_MIN ); printf ( "So ky so de bieu dien mot so = %.10en" , FLT_MANT_DIG ); }
Compiling and running the above C program will result:
According to Tutorialspoint
Previous article: errno.h in C
Next lesson: limits.h in C
You should read it
May be interested
- Check out the 'buffalo' Pokémon in Pokémon Goeach type of pokemon has hp, cp, ability to attack and endure differently. based on these indicators, players can determine as well as choosing the most powerful pokemon for their offensive tactics.
- Sitting home can also locate Pokemon around, do you believe it?the tightening of the niantic developers' rules to prevent players from abusing the support tools also brings annoyance, such as those who have no conditions to move much, go away, it is hard to know. get the location of the pokemon around the area they live in
- 5 undeniable benefits when playing Pokemon Goget to know many new people, breathe fresh air, relieve stress, increase concentration thanks to going out for a walk .... are compelling reasons to force you to try pokemon go now .
- Want to earn the fastest Pokécoins in Pokémon Go? So don't miss this article!pokécoins in pokémon go play the role of buying items in the store. the more coins you earn, the more likely you are to buy more items. to earn pokécoins, players will have to complete certain tasks or buy real money.
- Pokémon systems when fighting in Pokémon Goeach pokémon system in pokémon go has different strengths, along with a specific weakness. this type of pokémon will have the power to attack the other pokémon, but can defeat the other pokémon. if you know the characteristics of each type, it will be easier to choose which pokémon to battle.
- The terms you need to know when playing Pokémon Gopokémon go is the most prominent name in recent days. this game of capturing and training virtual animals has created a relatively new way of playing, as players have to constantly move to catch pokémon. during the process of joining pokémon go, you will encounter and use a lot of important terms. so what do they mean?
- How to play Pokemon GO on Windows computersrecently, pokemon go has become a popular game, attracting thousands of gamers around the world. in previous posts network administrator has guided you on how to play pokemon go on android devices and ios devices. in the article below, network administrator will guide you how to play pokemon go on windows computers using bluestacks emulator software.
- How to become a good Pokémon Go hunter?with a new way of playing, pokémon go has created a new phenomenon in the game village around the world. players will have to go around and find pokémon for themselves. so how to quickly catch pokémon and in large numbers?
- Things to know to upgrade Pokémon in Pokémon Gothe whirlwind pokémon go has spread its power right on the first day of its release. everyone rushed to the street to find a pokémon for themselves. therefore, in order to become a pokémon hunter, you need to master the basics of participating in pokémon go battlefield.
- List of medals received in Pokemon Goin addition to getting items when leveling up, gamers who join pokemon go also have the opportunity to receive their proud achievements.