OT: Re: code for fun

2010-07-18 Thread Aaron Lewis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/18/2010 06:56 PM, Firas Kraiem wrote: On 18/07/2010 12:27, Aaron Lewis wrote: Hi, how can i determine the maximum size of `double' without printing out DOUBLE_MAX ? And what about the precision of a `double' , anyone give a try ?

Re: OT: Re: code for fun

2010-07-18 Thread Floor Terra
On Sun, Jul 18, 2010 at 1:07 PM, Aaron Lewis aaron.lewis1...@gmail.com wrote: What do you mean by precision? Kinda of significance digit. For example: B A number `12.340' , and if say it has 2 digits' precision , then we consider the `0' is not accurate , while `.34' is accurate. What?!

Re: OT: Re: code for fun

2010-07-18 Thread Firas Kraiem
Assuming 64-bit double, it has a mantissa of 52 bits and an exponent of 11 bits. If the mantissa is all-ones, that will give a significant of 2-2^(-52). The exponent cannot be all-ones (an all-ones exponent means infinity or NaN), so the largest exponent is 2^11-2 = 2046, minus bias

Re: OT: Re: code for fun

2010-07-18 Thread Aaron Lewis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/18/2010 08:04 PM, Floor Terra wrote: On Sun, Jul 18, 2010 at 1:07 PM, Aaron Lewis aaron.lewis1...@gmail.com wrote: What do you mean by precision? Kinda of significance digit. For example: A number `12.340' , and if say it has 2 digits'

Re: OT: Re: code for fun

2010-07-18 Thread Floor Terra
On Sun, Jul 18, 2010 at 2:32 PM, Aaron Lewis aaron.lewis1...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/18/2010 08:04 PM, Floor Terra wrote: On Sun, Jul 18, 2010 at 1:07 PM, Aaron Lewis aaron.lewis1...@gmail.com wrote: What do you mean by precision? Kinda of