flat assembler
Message board for the users of flat assembler.

Index > Main > Floating point representation doubts

Author
Thread Post new topic Reply to topic
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?
Post 28 Dec 2006, 06:45
View user's profile Send private message Reply with quote
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 ?
Post 28 Dec 2006, 08:47
View user's profile Send private message Reply with quote
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
Post 28 Dec 2006, 11:30
View user's profile Send private message Reply with quote
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.
Post 28 Dec 2006, 12:22
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.