POV-Ray : Newsgroups : povray.advanced-users : Normal distribution : Re: Normal distribution Server Time
28 Jul 2024 18:16:31 EDT (-0400)
  Re: Normal distribution  
From: Christopher James Huff
Date: 7 May 2004 08:47:28
Message: <cjameshuff-E9E2AE.07464607052004@news.povray.org>
In article <409aa06c@news.povray.org>,
 "Chris Johnson" <chris(at)chris-j(dot)co(dot)uk> wrote:

> -[I do recall asking how far apart these numbers are]-
> Pov-ray uses the IEEE double floating point standard (unless you're
> compiling it on a DEC VAX or something obscure), which has 52 bits of
> fractional precision, which gives about 2^-52 as the distance between random
> numbers.

Not quite correct. You're forgetting that floating point numbers are not 
fixed point...they're quite a bit more complicated. In addition to the 
52-bit plus-one mantissa, IEEE 754 double precision numbers also have an 
11 bit exponent, which can go down to -1023 and up to 1024. You end up 
with a pretty complex distribution of possible numbers...just how big a 
step there is between a value and the next possible larger or smaller 
value depends on what that value is.


> However, pov-ray actually uses a 32-bit linear congruential random
> number generator, which only uses 32 bits of precision.

At most, it may be even less. Assuming it fills the entire 32 bit range, 
that gives you 2^32 steps, 4294967296 steps with 2.328306436538696e-10 
between each step.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.