- Related Questions & Answers
- Java program to multiply given floating point numbers
- C++ Program to Multiply two Numbers
- Signed floating point numbers
- Program to find GCD of floating point numbers in C++
- C++ Floating Point Manipulation
- 8051 Program to Multiply two 8 Bit numbers
- 8085 Program to Multiply two 8 bits numbers
- 8085 program to multiply two 8 bit numbers
- 8086 program to multiply two 8-bit numbers
- 8086 program to multiply two 16-bit numbers
- C# program to multiply two matrices
- Floating point comparison in C++
- Write a one line C function to round floating point numbers
- Binary Search for Rational Numbers without using floating point arithmetic in C program
- 8085 Program to multiply two 2-digit BCD numbers

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Float is a shortened term for "floating-point." By definition, it's a fundamental data type built into the compiler that's used to define numeric values with floating decimal points. A floating-point type variable is a variable that can hold a real number, such as 4320.0, -3.33, or 0.01226. The floating part of the name floating point refers to the fact that the decimal point can “float”; that is, it can support a variable number of digits before and after the decimal point.

Category | Type | Minimum Size | Typical Size |
---|---|---|---|

floating point | float | 4 bytes | 4 bytes |

double | 8 bytes | 8 bytes | |

long double | 8 bytes | 8, 12, or 16 bytes |

Size | Range | Precision |
---|---|---|

4 bytes | ±1.18 x 10^{-38} to ±3.4 x 10^{38} | 6-9 significant digits, typically 7 |

8 bytes | ±2.23 x 10^{-308} to ±1.80 x 10^{308} | 15-18 significant digits, typically 16 |

80-bits (typically uses 12 or 16 bytes) | ±3.36 x 10^{-4932} to ±1.18 x 10^{4932} | 18-21 significant digits |

16 bytes | ±3.36 x 10^{-4932 }to ±1.18 x 10^{4932} | 33-36 significant digits |

**Input** − a=11.23 b=6.7

**Output** − 75.241

**Explanation** − Use of Float variables. In this program, the user has two numbers (floating point numbers)means float variables. Then, the product of those two numbers is stored in a variable and displayed on the screen.

#include <stdio.h> int main() { float a, b, c; a=11.23; b=6.7; c = (float)(a*b); // Displaying result up to 3 decimal places. printf("%3f", c); return 0; }

75.241

Advertisements