[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Exponential calculation

From: Kevin Channon
Subject: Re: [Help-gsl] Exponential calculation
Date: Mon, 16 Feb 2009 08:37:21 +0000

Hi Ashish,

> As structure of probability density function is as follows.
> Pdf = (expression_1) * (exponential (expression_2).
> Now during our calculation we are encountering the situation where
> expression_2 is getting evaluated to such values like -800.0.
> In this case exponential (-800.0) is zero.
> So how do we deal with such situations what will be pdf in this case.

Like you say, in this situation the result is zero.  This is down to the
limits of floating point precision.  If you can't live with this, then I guess
there are three things that I can think of right now:

1. Take logs and work with those:
        Ln(PDF) = Ln(expression1) + expression2

2. Separate the exponent:
    You know exp(-100) = 3.7e+44, so
     exp(-800) = 3.7^8 *10^(-44*8) = 35125e-352

3. Find a library that someone has written to deal with large and small

Hope that helps,


Kevin Channon

School of Chemistry
University of Bristol

reply via email to

[Prev in Thread] Current Thread [Next in Thread]