there is a problem to find first K digits of no. N^N , where N can be as
large as 10^9.
so, the algo goes like,
take fractional part(f) of  Nlog10(N).
and temp=pow(10,f),
result =(long )10^k * temp.

I want to assure myself that f has enough fractional part precision so that
at most first 9 digits can be correctly found.

I more doubt , does the maximum value of any type assures that it can hold
all intermediate value.
my ques is the maximum number of digits after decimal a type can hold.

Can any1 clear my doubt related to long double that i initially asked.
Help appreciated.


*Apologies for any stupidity.

On Wed, Apr 14, 2010 at 6:31 AM, sharad kumar <aryansmit3...@gmail.com>wrote:

> Do u have to use only C++ ,cant u use scripting languages like
> Python....where precision is very good in Python..esp wen u use Si-Py....
>
>
> On Tue, Apr 13, 2010 at 10:10 PM, Himanshu Aggarwal <
> lkml.himan...@gmail.com> wrote:
>
>> I think it should depend on the underlying architecture, on how it stores
>> the floating data types
>>
>> In case floats and double are implemented using IEEE 754, then floats have
>> 8 bits for precision and double have 11 bits for precision. Normally the
>> exponents are biased, which means that for float it ranges from 2^(-127) to
>> 2^(+ 127) and for double it ranges from 2^(-1024) to 2^(+1024).
>>
>> ~Himanshu Aggarwal
>>
>>  On Tue, Apr 13, 2010 at 6:10 AM, Anil C R <cr.a...@gmail.com> wrote:
>>
>>> correct me if I'm wrong but, float has a precision of around 8 digits.
>>> and double 16 digits... if you want arbitrary precision floating point
>>> numbers, try GNU BigNum library...
>>> Anil
>>>
>>>
>>>   On Mon, Apr 12, 2010 at 9:54 PM, Himanshu Aggarwal <
>>> lkml.himan...@gmail.com> wrote:
>>>
>>>>
>>>>
>>>> On Sun, Apr 11, 2010 at 6:55 PM, GentLeBoY <vikrantsing...@gmail.com>wrote:
>>>>
>>>>> how to store fractional numbers with a fractional part having 25-30
>>>>> digits after decimal place,
>>>>> does long double has the same precision as double?.
>>>>> 1 more prob.
>>>>> format specifier for long double is %lf and same for double, so if i
>>>>> write
>>>>>       long double a;
>>>>>       scanf("%lf",&a);
>>>>>       a=a*2;
>>>>>       printf("%lf",a);
>>>>> why is the output -2.0000  ?
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Algorithm Geeks" group.
>>>>> To post to this group, send email to algoge...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>>
>>>>
>>>> Float has single precision.
>>>> double has double precision.
>>>> Long double has extended precision.
>>>>
>>>> For your requirement, even a float would suffice. check out the value of
>>>> FLT_MAX . It is of the order of 10^37.
>>>>
>>>> ~Himanshu Aggarwal
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algoge...@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>> --
>>>  You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algoge...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>> --
>>  You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
>  You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Vikrant Singh

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to