* how compiler decide the range of real numbers in C...
@ 2009-07-30 17:33 RAM_LOCK
2009-07-30 17:46 ` Glynn Clements
0 siblings, 1 reply; 2+ messages in thread
From: RAM_LOCK @ 2009-07-30 17:33 UTC (permalink / raw)
To: linux-c-programming
Say 16 bit compiler (for ex Turbo C) uses 2's compliment to find the range of
signed integer.
Say for 16 bit n=16. Now applying 2's compliment equation : -2^(n-1) to
2^(n-1) -1
so for n=16 : The range is -32768 to 32767
This is ok. The question arises when it tell about real constant's range.
For 16 bit compiler the range of real constant is : -3.4e38 to 3.4e38
How they arrived to this real constant range?
Can any one share the mathematical calculation behind it?
thnx,
RAM_LOCK
--
View this message in context: http://www.nabble.com/how-compiler-decide-the-range-of-real-numbers-in-C...-tp24743191p24743191.html
Sent from the linux-c-programming mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: how compiler decide the range of real numbers in C...
2009-07-30 17:33 how compiler decide the range of real numbers in C RAM_LOCK
@ 2009-07-30 17:46 ` Glynn Clements
0 siblings, 0 replies; 2+ messages in thread
From: Glynn Clements @ 2009-07-30 17:46 UTC (permalink / raw)
To: RAM_LOCK; +Cc: linux-c-programming
RAM_LOCK wrote:
> Say 16 bit compiler (for ex Turbo C) uses 2's compliment to find the range of
> signed integer.
> Say for 16 bit n=16. Now applying 2's compliment equation : -2^(n-1) to
> 2^(n-1) -1
> so for n=16 : The range is -32768 to 32767
>
> This is ok. The question arises when it tell about real constant's range.
> For 16 bit compiler the range of real constant is : -3.4e38 to 3.4e38
>
> How they arrived to this real constant range?
>
> Can any one share the mathematical calculation behind it?
http://en.wikipedia.org/wiki/IEEE_754-1985
--
Glynn Clements <glynn@gclements.plus.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-30 17:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-30 17:33 how compiler decide the range of real numbers in C RAM_LOCK
2009-07-30 17:46 ` Glynn Clements
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).