POV-Ray : Newsgroups : povray.advanced-users : single precision vs double precision : Re: single precision vs double precision Server Time
26 Jun 2024 08:16:24 EDT (-0400)
  Re: single precision vs double precision  
From: Warp
Date: 16 Nov 2012 06:29:02
Message: <50a6237e@news.povray.org>
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


Post a reply to this message

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