POV-Ray : Newsgroups : povray.advanced-users : Numerical Precision Server Time
4 Oct 2024 17:04:28 EDT (-0400)
  Numerical Precision (Message 20 to 29 of 29)  
<<< Previous 10 Messages Goto Initial 10 Messages
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

From: Penelope20k
Subject: Re: Numerical Precision
Date: 12 Sep 2007 04:36:34
Message: <46e7a512$1@news.povray.org>
an alternative method with modulo exist


#macro Want_decimal_of (  VarA , VarB , Nth)

#declare index=0;
#declare A=VarA;
#declare BASE=VarB;

#while(index<Nth)
#declare EUCLIDIANREST=mod(A,BASE);
#declare NTH_UNIT=(A-(BASE*EUCLIDIANREST) ) / BASE ;    // or
NTH_UNIT=int(A,BASE) ;  its the same



// REASSIGN FOR LOOP
#declare A=10*EUCLIDIANREST;
#declare index=index+1;
#end

// SORT THE RESULT UNDER STRING
 #debug str(NTH_UNIT,0,0)


#end










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: scott
Subject: Re: Numerical Precision
Date: 12 Sep 2007 06:39:01
Message: <46e7c1c5$1@news.povray.org>
>> 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).

If that's all you want to do, then better to write/use some external program 
to do the calculations then import to POV for rendering.


Post a reply to this message

From: Warp
Subject: Re: Numerical Precision
Date: 12 Sep 2007 07:37:09
Message: <46e7cf65@news.povray.org>
scott <sco### [at] laptopcom> wrote:
> If that's all you want to do, then better to write/use some external program 
> to do the calculations then import to POV for rendering.

  Any suggestions? ;)

-- 
                                                          - Warp


Post a reply to this message

From: Orchid XP v3
Subject: Re: Numerical Precision
Date: 12 Sep 2007 14:23:56
Message: <46e82ebc$1@news.povray.org>
Warp wrote:
> scott <sco### [at] laptopcom> wrote:
>> If that's all you want to do, then better to write/use some external program 
>> to do the calculations then import to POV for rendering.
> 
>   Any suggestions? ;)

gp/pari?

Matlab?

*cough* Haskell? 0;-)

-- 
http://blog.orphi.me.uk/


Post a reply to this message

From: andrel
Subject: Re: Numerical Precision
Date: 12 Sep 2007 15:28:22
Message: <46E83ED4.604@hotmail.com>
Orchid XP v3 wrote:
> Warp wrote:
>> scott <sco### [at] laptopcom> wrote:
>>> If that's all you want to do, then better to write/use some external 
>>> program to do the calculations then import to POV for rendering.
>>
>>   Any suggestions? ;)
> 
> gp/pari?
> 
> Matlab?
no, all floating point arithmetic (unless with special libraries).
BTW for a real scene you would never need more than a precision of 
1:1e56 (size of the universe divided by the Planck length ;) )
> 
> *cough* Haskell? 0;-)
probably


Post a reply to this message

From: Orchid XP v3
Subject: Re: Numerical Precision
Date: 12 Sep 2007 15:47:44
Message: <46e84260$1@news.povray.org>
andrel wrote:

>>>   Any suggestions? ;)

>> Matlab?

> no, all floating point arithmetic (unless with special libraries).

OK. I really know nothing about it other than

1. I hate it.

2. It's meant to be fast.

> BTW for a real scene you would never need more than a precision of 
> 1:1e56 (size of the universe divided by the Planck length ;) )

Not in the final scene, no. But the intermediate calculations? Maybe! ;-)

-- 
http://blog.orphi.me.uk/


Post a reply to this message

From: Warp
Subject: Re: Numerical Precision
Date: 12 Sep 2007 19:43:15
Message: <46e87993@news.povray.org>
Orchid XP v3 <voi### [at] devnull> wrote:
> Warp wrote:
> > scott <sco### [at] laptopcom> wrote:
> >> If that's all you want to do, then better to write/use some external program 
> >> to do the calculations then import to POV for rendering.
> > 
> >   Any suggestions? ;)

> gp/pari?

  How do you create a povray scene with it?

-- 
                                                          - Warp


Post a reply to this message

From: Orchid XP v3
Subject: Re: Numerical Precision
Date: 13 Sep 2007 13:12:09
Message: <46e96f69$1@news.povray.org>
Warp wrote:

>>>   Any suggestions? ;)
> 
>> gp/pari?
> 
>   How do you create a povray scene with it?

No idea; I don't know how it works...

-- 
http://blog.orphi.me.uk/


Post a reply to this message

From: scott
Subject: Re: Numerical Precision
Date: 20 Sep 2007 07:18:04
Message: <46f256ec$1@news.povray.org>
>> If that's all you want to do, then better to write/use some external 
>> program
>> to do the calculations then import to POV for rendering.
>
>  Any suggestions? ;)

Well I'd just write it in C, maybe look for some library if I needed some 
fairly complex calculations.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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