comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Large Numbers
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Large Numbers [message #64993 is a reply to message #64992] Fri, 06 February 2009 15:35 Go to previous messageGo to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
Well, if you deal with very large numbers,
you can do all the computations
with the logarithm of the numbers.

Simple, no?

Ciao,
Paolo


David Fanning wrote:
> Folks,
>
> I made a big mistake and signed up for an Applied Statistics
> class this semester. Now I pretty much spend every free
> waking moment doing stats homework. :-(
>
> Anyway, for lunch today I decided to grab a sandwich and
> give my youngest some support by calculating how many
> girls he had to ask out to have an 80% chance of getting
> a date for Saturday night.
>
> I made some conservative assumptions (I learned later
> my ideas about the college social scene apply more to the
> 1970s than they do to today), and off I went writing a
> couple of short IDL programs to do the calculations for
> the Binomial and Geometry Distributions, etc. All pretty
> straightforward.
>
> But then I started getting screwy results. (This, in itself,
> is not all that unusual in this particular class. In fact, I've
> begun to consider it something of a minor miracle if I'm within
> an order of magnitude of the right answer.) But even I know
> that negative probabilities don't show up until the second
> semester. What in the world!?
>
> It turns out that the recursive function I naively wrote to
> process a factorial calculation was overflowing my long
> integers, even with a simple calculation like 20! (twenty
> factorial). Yowser!
>
> Now, of course, the formula I was using has a large
> factorial number divided by another large factorial
> number, so the *actual* number I wanted to use in the
> calculation is not that big. But it begs the question:
> what strategy do computer scientists use to deal with
> one very, very big number divided by another very, very
> big number?
>
> I've solved my immediate problem for my little toy problem
> by using LONG64 variables. But this can't be the right solution.
> Does anyone know?
>
> Cheers,
>
> David
>
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to read a multi-band image with IDL
Next Topic: Re: 12 bit jpeg

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 15:48:47 PDT 2025

Total time taken to generate the page: 0.87892 seconds