POV-Ray : Newsgroups : povray.advanced-users : single precision vs double precision Server Time
26 Jun 2024 08:13:38 EDT (-0400)
  single precision vs double precision (Message 11 to 13 of 13)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Bruno Cabasson
Subject: Re: single precision vs double precision
Date: 16 Nov 2012 07:55:00
Message: <web.50a63783be17c2844aa45fdf0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> > Mesh math is pretty trivial, requiring only linear equations to be
> > solved. But even a seemingly simple thing as a sphere already involves
> > quadratic equations, and cubic equations aren't uncommon in POV-Ray
> > either. Some primitives require even higher-order polynomials.
>
> > And the higher the order of a polynomial, the higher the dynamic range
> > needed to solve it.
>
> To get a clearer picture of why this is so, consider that when you
> multiply two values, the result requires double the bits of the original
> values if exact accuracy of the result is required. (If you now multiply
> the result with a third value, the amount of bits is triple that of the
> original values. Basically, each multiplication requires as many bits
> as the sum of bits of the factors.)
>
> If you don't have that many bits in the result, it will be inaccurate
> (because the least-significant bits of the result will be dropped.)
>
> When talking about floating point values, the crucial bits are the
> mantissa bits: Their amount determines how accurate the result will be
> (ie. how many least-significant bits of the result will be dropped after
> a multiplication.)
>
> In this context it's easy to imagine why single-precision floats (which
> have 24 mantissa bits) will quickly become very inaccurate when you
> perform multiplications on them. (Double-precision floats have 53 mantissa
> bits.)
>
> --
>                                                           - Warp

Just for curiousity, would it be that difficult do make a full 32 bits build of
Pov-ray, run a few scenes and see the differences between renders?

NB: AKAIK, CPUs use a 80 bits format internally in all cases.


Post a reply to this message

From: Warp
Subject: Re: single precision vs double precision
Date: 16 Nov 2012 08:11:03
Message: <50a63b66@news.povray.org>
Bruno Cabasson <bru### [at] cabassoncom> wrote:
> NB: AKAIK, CPUs use a 80 bits format internally in all cases.

x87 uses 80-bit ("extended-precision") floating point values, but SSE doesn't
(it uses 64-bit values.) Thus the internal representation used by the
hardware will depend on whether POV-Ray has been compiled to use the FPU
or SSE.

(All floating point values will be stored in memory as 64-bit, though.
It's only the intermediate values inside the FPU that are 80-bit.)

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: single precision vs double precision
Date: 16 Nov 2012 14:01:34
Message: <50a68d8e$1@news.povray.org>
Am 16.11.2012 13:54, schrieb Bruno Cabasson:
> Warp <war### [at] tagpovrayorg> wrote:

>> In this context it's easy to imagine why single-precision floats (which
>> have 24 mantissa bits) will quickly become very inaccurate when you
>> perform multiplications on them. (Double-precision floats have 53 mantissa
>> bits.)
>>
>> --
>>                                                            - Warp
>
> Just for curiousity, would it be that difficult do make a full 32 bits build of
> Pov-ray, run a few scenes and see the differences between renders?

There might be more to change than just data types; some "epsilon" 
values might need to be changed as well.


> NB: AKAIK, CPUs use a 80 bits format internally in all cases.

That used to be the case in times of x87 math; SSE2 uses only 64 bit 
precision.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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