Skip to content

Demonstrate how double and float is stored in computer memory.

License

Notifications You must be signed in to change notification settings

KenRen98/How-Double-Float-is-Stored

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

How-Double-Float-is-Stored

This is a simple code to demonstrate how double is stored in computer Memory.
展示双精度和单精度浮点数在计算机内存中存储方式的简单代码

To Understand the concept, please read details in the link below.
理解概念请参考:https://receiverhelp.trimble.com/oem-gnss/index.html#API_FloatingPointDataTypes.html.

Example Output(使用例子):

[root@localhost ~]# gcc ShowDoubleConversion.c -lm
[root@localhost ~]# ./a.out

Please enter a double number: 7464.1648

Double: 7464.164800
RawDouble: 40BD282A30553261

Dec Form:
*****************
Sign: 0
Exponent: 1035
Fraction: 3703336361865825

Hex Form:
*****************
Sign: 0
Exponent: 40B
Fraction: D282A30553261

Conversion:
*****************
Sign: Positive
Exponent: 12
Binary Fraction: 1101001010000010101000110000010101010011001001100001
Decimal Fraction: 1.822306
Raw Double in Decimal Calculation: 7464.164800=1x1.822306x2^12

Double Check Answer: 7464.164800
[root@localhost ~]#

About

Demonstrate how double and float is stored in computer memory.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages