flat assembler
Message board for the users of flat assembler.

 Index > Main > Floating point representation doubts
Author
playworld

Joined: 27 Dec 2006
Posts: 4
playworld 28 Dec 2006, 06:45
how a number say (a.bc * 10 exp def ) is represented in a fpu ? say for example, 9.75 * 10 exp 263 .How this number is normalised?
28 Dec 2006, 06:45
m

Joined: 28 Dec 2006
Posts: 304
Location: in
m 28 Dec 2006, 08:47
Could you elaborate (c l a r i f y) a little, what you want ?
28 Dec 2006, 08:47
zhak

Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 28 Dec 2006, 11:30
it's hard to normalize numbers manually. but I'm sure, there are some algos or formulas to do this. I know one method of normalization:
for example, we have decimal number 2.5, and we want to represent it as double-precision floting-point (DPFP) value...
we know the format of DPFP value: 11 bits for biased exponent, 52 bits for significand. biasing constant = 1023.
to normalize the number we should solve an equation: 1.x * y = 2.5; here will take y = 2^1. then x = 2.5/2 = 1.25
now we have x = 0.25 decimal or 01b.
now let's form the value: exponent = 1, then biased exponent = 1024 (or 10000000000b), and significand is 4000000000000h

2.5 decimal = 01000000000001000000000... 40 more zeros...0b
28 Dec 2006, 11:30
playworld

Joined: 27 Dec 2006
Posts: 4
playworld 28 Dec 2006, 12:22
Quote:

Shak wrote:
it's hard to normalize numbers manually

If we take small numbers it is fine.But i get confuse when considering large numbers.DPFP range is upto 1.79 * 10 exp 308.Lets declare a variable double d in some lang with value 12.83 * 10 exp 300.Now how the FPU going to normalise this.It must normalise as the number is within the range.
28 Dec 2006, 12:22
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum