POV-Ray : Newsgroups : povray.advanced-users : Numerical Precision Server Time
4 Oct 2024 21:10:26 EDT (-0400)
  Numerical Precision (Message 11 to 20 of 29)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 9 Messages >>>
From: Tim Attwood
Subject: Re: Numerical Precision
Date: 9 Sep 2007 17:50:35
Message: <46e46aab$1@news.povray.org>
> By the way, I may need a lecture on computer float representation and
> binaries ...

Floating point in computers means floating point binary.

You may be familiar with binary integers...
the first bit is one, the next two, the next four, then eight,
16, 32, 64 128 etc. So for example you could represent
the number three in binary as a byte  00000011

But binary fractions go 1/2, 1/4, 1/8, 1/16, etc
At some point the fraction repeats, but in a computer
it just gets truncated after some point.
So 1/3 ends up 0.01010101...
An interesting part of this is that any fraction that has a
denominator with a factor other than 2 repeats, and
therefore exhibits a small amount of error. You can
look at the actual floating point bits online.
http://www.h-schmidt.net/FloatApplet/IEEE754.html
There's one bit for the sign, 8 bits for the exponent,
and 23 bits for the numbers.

The easiest way to get better accuracy is to use integers
where you can.


Post a reply to this message

From: Alain
Subject: Re: Numerical Precision
Date: 10 Sep 2007 09:50:13
Message: <46e54b95@news.povray.org>
Woody nous apporta ses lumieres en ce 2007/09/09 11:55:
> Does anybody know of a way, short of modifying the sourcecode, to increase
> the numerical precision that pov ray uses.
> 
> For example say I need to calculate 1/3 to the 100th decimal place. I
> believe it goes upto maybe the 8th or sixteenth place?
> 
> Is there some ini option that can do this?
> 
> What about declaring the value as you want it.
> i.e. instead of writing
> #declcare my_var = 1/3;
> 
> declare it as
> #declare my_var = 0.333333333333333333333333333333333333333333333333333;
> 
> Would this do anything or would it truncate after a certain decimal spot?
It would only take more place in the source file and take longer to parse.
> 
> 
If you recompile POV-Ray with a smaller epsilon value, you may, just may, gain 1 
decimal place, then, only in some cases.
To realy be able to use more presision in your floating point operations, you 
need a different HARDWARE: an FPU with more bits than the current implementation.
Currently, ALL CPUs have 64 bits FPU with an internal extention to 80.
You need an FPU with 96 or 128 bit to get the kind of precision that you want.
Then, you'd need to recompile POV-Ray to take advantage of the new architecture.
Any way, 1/3 will always be shorter and faster to parse than 
0.333333333333333333333333333333333333333333333333333 for the same effective 
precision.

-- 
Alain
-------------------------------------------------
   My wife is such a bad cook, in my house we pray after the meal.
   	Rodney Dangerfield


Post a reply to this message

From: Warp
Subject: Re: Numerical Precision
Date: 10 Sep 2007 10:19:33
Message: <46e55275@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> To realy be able to use more presision in your floating point operations, you 
> need a different HARDWARE: an FPU with more bits than the current implementation.

  Not really. There exist libraries for arbitrary-precision floating points.
They are, of course, not as fast as native floating point numbers, but it's
certainly possible.

-- 
                                                          - Warp


Post a reply to this message

From: Alain
Subject: Re: Numerical Precision
Date: 10 Sep 2007 16:25:33
Message: <46e5a83d$1@news.povray.org>
Warp nous apporta ses lumieres en ce 2007/09/10 10:19:
> Alain <ele### [at] netscapenet> wrote:
>> To realy be able to use more presision in your floating point operations, you 
>> need a different HARDWARE: an FPU with more bits than the current implementation.
> 
>   Not really. There exist libraries for arbitrary-precision floating points.
> They are, of course, not as fast as native floating point numbers, but it's
> certainly possible.
> 
Possible but not realy practical in any case when you need to do 1000's+ of FP 
operations, some of those been possibly quite complexe. And this was my point: 
maintain acceptable rendering speed while geting higher FP precision.
Arbitrary precision can be 100 to 1000 times slower, and possibly even worse.

-- 
Alain
-------------------------------------------------
   I knew a girl so ugly that she was known as a two-bagger. That's When you put 
a bag over your head in case the bag over her head comes Off.
	Rodney Dangerfield


Post a reply to this message

From: Warp
Subject: Re: Numerical Precision
Date: 10 Sep 2007 19:35:44
Message: <46e5d4cf@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> Possible but not realy practical in any case when you need to do 1000's+ of FP 
> operations, some of those been possibly quite complexe. And this was my point: 
> maintain acceptable rendering speed while geting higher FP precision.
> Arbitrary precision can be 100 to 1000 times slower, and possibly even worse.

  He didn't ask to render using the high-precision FP. He asked for
#defined variables with high precision.

-- 
                                                          - Warp


Post a reply to this message

From: Alain
Subject: Re: Numerical Precision
Date: 11 Sep 2007 07:47:13
Message: <46e68041$1@news.povray.org>
Warp nous apporta ses lumieres en ce 2007/09/10 19:35:
> Alain <ele### [at] netscapenet> wrote:
>> Possible but not realy practical in any case when you need to do 1000's+ of FP 
>> operations, some of those been possibly quite complexe. And this was my point: 
>> maintain acceptable rendering speed while geting higher FP precision.
>> Arbitrary precision can be 100 to 1000 times slower, and possibly even worse.
> 
>   He didn't ask to render using the high-precision FP. He asked for
> #defined variables with high precision.
> 
There is no use to only define the variable using extreme precision if you can't 
use it at that precision.
If you #define a variable at 100 decimal places, you also want to use it at 100 
decimal places.

-- 
Alain
-------------------------------------------------
Utopianism: This shit does not stink.


Post a reply to this message

From: Warp
Subject: Re: Numerical Precision
Date: 11 Sep 2007 09:59:07
Message: <46e69f2b@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
> There is no use to only define the variable using extreme precision if you can't 
> use it at that precision.
> If you #define a variable at 100 decimal places, you also want to use it at 100 
> decimal places.

  Yes, like making some calculations with them, printing them, and perhaps
creating something with them (rounded to the precision used by objects).

-- 
                                                          - Warp


Post a reply to this message

From: Woody
Subject: Re: Numerical Precision
Date: 11 Sep 2007 23:40:00
Message: <web.46e75e6bf39078cad76865360@news.povray.org>
Le Forgeron <jgr### [at] freefr> wrote:
> Le 09.09.2007 19:40, Woody nous fit lire :
> > Le Forgeron
> > GTH!
> You're oversensitive.
My apologies.

Woody is overworked, underpaid, and overzealous.


Post a reply to this message

From: Penelope20k
Subject: Re: Numerical Precision
Date: 12 Sep 2007 04:06:07
Message: <46e79def@news.povray.org>
well need to calculate A/B

well the units are:                         The rest of
C0 = int (A/B)           ....................  R0 = A - C0 * B

the first decimal is

C1 = int ( (A - B * C0 ) *10 / B )   .........  C1 = int ( R0*10 / B)
.............  R1 = R0*10 - C1*B

C2 = int ( R1 * 10 /  B )


Cn= int ( 10 * R(n-1) / B) .................... Rn = 10*R(n-1) - Cn*B




Exemple: 7 / 11

C0 = 0    R0 = 7
C1 = int (70/11)   = 6           R1= 70-6*11 = 4
C2 = int (40/11) =  3            R2 = 7
C3 = 70/11 = 6                 R3 = 4
C4 = 40/11 = 3                R4 = 7

etc ...  with a loop willbe easy




so 7 / 11   =   0.6309




hope this will help you ....












web.46e41787bca8f08494e61a50@news.povray.org...
> Does anybody know of a way, short of modifying the sourcecode, to increase
> the numerical precision that pov ray uses.
>
> For example say I need to calculate 1/3 to the 100th decimal place. I
> believe it goes upto maybe the 8th or sixteenth place?
>
> Is there some ini option that can do this?
>
> What about declaring the value as you want it.
> i.e. instead of writing
> #declcare my_var = 1/3;
>
> declare it as
> #declare my_var = 0.333333333333333333333333333333333333333333333333333;
>
> Would this do anything or would it truncate after a certain decimal spot?
>
>


Post a reply to this message

From: Penelope20k
Subject: Re: Numerical Precision
Date: 12 Sep 2007 04:07:41
Message: <46e79e4d@news.povray.org>
7/11 = 0.63636363... etc ...sorry for the typo




46e79def@news.povray.org...
> well need to calculate A/B
>
> well the units are:                         The rest of
> C0 = int (A/B)           ....................  R0 = A - C0 * B
>
> the first decimal is
>
> C1 = int ( (A - B * C0 ) *10 / B )   .........  C1 = int ( R0*10 / B)
> .............  R1 = R0*10 - C1*B
>
> C2 = int ( R1 * 10 /  B )
>
>
> Cn= int ( 10 * R(n-1) / B) .................... Rn = 10*R(n-1) - Cn*B
>
>
>
>
> Exemple: 7 / 11
>
> C0 = 0    R0 = 7
> C1 = int (70/11)   = 6           R1= 70-6*11 = 4
> C2 = int (40/11) =  3            R2 = 7
> C3 = 70/11 = 6                 R3 = 4
> C4 = 40/11 = 3                R4 = 7
>
> etc ...  with a loop willbe easy
>
>
>
>
> so 7 / 11   =   0.6309
>
>
>
>
> hope this will help you ....
>
>
>
>
>
>
>
>
>
>
>

> web.46e41787bca8f08494e61a50@news.povray.org...
> > Does anybody know of a way, short of modifying the sourcecode, to
increase
> > the numerical precision that pov ray uses.
> >
> > For example say I need to calculate 1/3 to the 100th decimal place. I
> > believe it goes upto maybe the 8th or sixteenth place?
> >
> > Is there some ini option that can do this?
> >
> > What about declaring the value as you want it.
> > i.e. instead of writing
> > #declcare my_var = 1/3;
> >
> > declare it as
> > #declare my_var = 0.333333333333333333333333333333333333333333333333333;
> >
> > Would this do anything or would it truncate after a certain decimal
spot?
> >
> >
>
>


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 9 Messages >>>

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