Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary Fundamental Data Types − Float, Double & Long Double

Rating
-
Sold
-
Pages
1
Uploaded on
02-03-2023
Written in
2022/2023

Fundamental Data Types − Float, Double & Long Double

Institution
Course

Content preview

Fundamental Data Types − Float, Double & Long double


Today we are going to talk about two fundamental data types called float and
double. We are also going to have a brief introduction to fixed and floating point.
We will also see some coding examples to help you illustrate the concept of float ,
double and long double. These different data types are of different sizes as well.
In my system, float takes 4 bytes of space. Double takes 8 bytes of memory space.
And long double takes 12 bytes. Size of these data types totally depend on the
system we are working on. Floating point representation on the other hand is quite
unnatural way of representing real numbers. Fixed point representation using equal
number of places would be able to represent much larger range of values. Floating
point is called floating point because the decimal point is not fixed. This is the
reason why floating point is preferred over fixed point. This topic is a part of
computer organization and architecture and explaining further details regarding
this topic is out of the scope. In this first line I have declared a variable of
float type and assigned it a value which is famously known as PIE. Value of PIE is
3. 1415926535897932 and so on. It is going on continuously without even repetition
of the digits. To print long double, we need to put format specifier as L and f.

The precision depends on the size of these data types. If you want less precision,
then you can use float or long double. Some applications require precision up to 2
3 or 4 decimal places. Then using float would be a better choice. And long double
up to 19 digits. Up to this point everything is printed correctly but after that
everything is changed. The correct answer is changing these integer values to
fractional values 4. 0 and 9. 0. Placing. 0 after 4 and 9 make these these numbers
double. By default they are double constants. And if you want to make them float
you just have to place f at the suffix. If you try to print this value then it will
give you your desired result which is 0. 44.

Written for

Institution
Course

Document information

Uploaded on
March 2, 2023
Number of pages
1
Written in
2022/2023
Type
SUMMARY

Subjects

$7.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
siddarths

Also available in package deal

Get to know the seller

Seller avatar
siddarths jain
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
6
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions