Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Who knows the answer of this:

Author: Dann Corbit

Date: 14:46:03 12/19/01

Go up one level in this thread


On December 19, 2001 at 17:43:00, Roy Eassa wrote:

>On December 19, 2001 at 17:39:48, Dann Corbit wrote:
>
>>On December 19, 2001 at 16:57:46, Michel Langeveld wrote:
>>
>>>Problem = 1 - ( 16777216! / (16746008! * 16777216 ^ 31208) )
>>>
>>>16777216 = Number of records in my hashtable
>>>31208    = Number of nodes searched
>>>
>>>Windows calculator says BOOM.
>>>
>>>If Problem > 0.5 then I've spend 15 hours debugging for nothing :-)
>>
>>16777216 ^ 31208 is approx:
>>1.144227435e225469
>>
>>The product from i = 16746008 to 16777216 is approx:
>>4.6700775185671e225463
>>
>>the ratio is therefore: .000004
>>and Problem is about .9999959185758218
>
>
>Dann, what did you use to help you solve this (if I may ask)?

The only tricky part was the partial product, which I calculated as a sum of
logs first like this:
// 16746008 to 16777216
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int             main(void)
{
    long double     prod = 0;
    unsigned long   l;
    for (l = 16746008; l <= 16777216; l++)
        prod += log(l);
    printf("%30.20LeL\n", prod);
    return 0;
}

Then I took that output [5.1914928399738733e5], and did exp() in bigcalc.

Bigcalc does not have a looping structure, but it has lots of functions like
exp(), factorial, pow, etc.  The raw factorials were too large to calculate
(exponent is a signed long) but the partial product could be computed once I
knew the logarithm.



This page took 0.21 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.