|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>> 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
|
|
| |
| |
|
|
|
|
| |