POV-Ray : Newsgroups : povray.advanced-users : Numerical Precision Server Time
5 Jul 2024 16:05:55 EDT (-0400)
  Numerical Precision (Message 1 to 10 of 29)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Woody
Subject: Numerical Precision
Date: 9 Sep 2007 12:00:00
Message: <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: Le Forgeron
Subject: Re: Numerical Precision
Date: 9 Sep 2007 12:36:57
Message: <46e42129$1@news.povray.org>
Le 09.09.2007 17:55, Woody nous fit lire :
> 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?

I think you need some lecture on computer float representation and
binaries.
Only things like Mathematica keep number as strings of text.

-- 
The superior man understands what is right;
the inferior man understands what will sell.
-- Confucius


Post a reply to this message

From: Orchid XP v3
Subject: Re: Numerical Precision
Date: 9 Sep 2007 12:45:15
Message: <46e4231b@news.povray.org>
Woody wrote:
> Does anybody know of a way, short of modifying the sourcecode, to increase
> the numerical precision that pov ray uses.

Question #1: Why would you want this?

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

Not quite.

POV-Ray (and most other computer programs) uses a system of 
floating-point numbers. So if you do something like

   X = 0.000000000000000000000000000000000000000000000000025

you'll probably get back what you put in. If, however, you do

   X = 7.000000000000000000000000000000000000000000000000025

you'll probably get just 7.

It's not how far from the decimal point it is, it's how far from the 
left-most non-zero digit it is. ;-)

Again, why do you want more precision? What's the problem?

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


Post a reply to this message

From: Warp
Subject: Re: Numerical Precision
Date: 9 Sep 2007 12:54:11
Message: <46e42533@news.povray.org>
Woody <nomail@nomail> wrote:
> Does anybody know of a way, short of modifying the sourcecode, to increase
> the numerical precision that pov ray uses.

  It's not possible.

  Even modifying the source code to add such support would be very
difficult and would probably break something (or at the very least
make everything *really* slow). In theory it could be done by using
an arbitrary precision arthmetic library (such as GMP), but it would
be quite a job to make POV-Ray use it, and to use it only where it
makes sense (ie. in #declared variables, but not eg. in tracing).

  If you want to calculate things using a huge amount of decimals,
use a mathematics software such as pari/gp. http://pari.math.u-bordeaux.fr/

-- 
                                                          - Warp


Post a reply to this message

From: Woody
Subject: Re: Numerical Precision
Date: 9 Sep 2007 13:45:00
Message: <web.46e43008f39078ca94e61a50@news.povray.org>
Le Forgeron
GTH!

I woudn't belittle the likes of you if you were to ask a question that I
thought was stupid.

If POV-Ray does not store numbers as text, then why if I use the command

#debug str(pi,1,50) is the output followed by so many 0s?


Post a reply to this message

From: Woody
Subject: Re: Numerical Precision
Date: 9 Sep 2007 13:50:01
Message: <web.46e4312bf39078ca94e61a50@news.povray.org>
By the way, I may need a lecture on computer float representation and
binaries but you need a lecture on proper english and grammar.

It is not that difficult to write:
"Only things like Mathematica keep numbers as strings of text."
or
"Only things like Mathematica keeps a number as strings of text."

I think someone needs to revisit highschool english.

> I think you need some lecture on computer float representation and
> binaries.
> Only things like Mathematica keep number as strings of text.
>


Post a reply to this message

From: Le Forgeron
Subject: Re: Numerical Precision
Date: 9 Sep 2007 13:51:25
Message: <46e4329d$1@news.povray.org>
Le 09.09.2007 19:40, Woody nous fit lire :
> Le Forgeron
> GTH!
> 
You're oversensitive.
And thank you, but your blessing is not needed for my travel, should
such thing happens.
Continue with your deceiver if you wish it so.



-- 
The superior man understands what is right;
the inferior man understands what will sell.
-- Confucius


Post a reply to this message

From: Le Forgeron
Subject: Re: Numerical Precision
Date: 9 Sep 2007 13:53:34
Message: <46e4331e$1@news.povray.org>
Le 09.09.2007 19:45, Woody nous fit lire :
> By the way, I may need a lecture on computer float representation and
> binaries but you need a lecture on proper english and grammar.
> 
> It is not that difficult to write:
> "Only things like Mathematica keep numbers as strings of text."
> or
> "Only things like Mathematica keeps a number as strings of text."
> 
> I think someone needs to revisit highschool english.
> 

I love you too. Have a nice day.

-- 
The superior man understands what is right;
the inferior man understands what will sell.
-- Confucius


Post a reply to this message

From: Warp
Subject: Re: Numerical Precision
Date: 9 Sep 2007 14:52:38
Message: <46e440f6@news.povray.org>
Woody <nomail@nomail> wrote:
> If POV-Ray does not store numbers as text, then why if I use the command

> #debug str(pi,1,50) is the output followed by so many 0s?

  What makes you think that printing dozens of characters '0' requires for
POV-Ray to store the number in memory as a string?

  What you are telling to str() is to print 50 decimals, and it does that:
It prints 50 decimals. The implementation of the C library function which
str() calls has a loop which prints as many decimals as you tell it to.
You can tell it to print 10000 decimals and it probably will do that.
  That doesn't mean that the other number is stored with 10000 decimals.
The function simply keeps printing decimals until the actual number has
no more data left, after which everything that is left to print is nothing.
Since printing zeros after the decimal point is equivalent to nothing, that's
exactly what the function does because you asked it to print so many decimals.

-- 
                                                          - Warp


Post a reply to this message

From: Grassblade
Subject: Re: Numerical Precision
Date: 9 Sep 2007 16:00:00
Message: <web.46e4504df39078cadb3441980@news.povray.org>
"Woody" <nomail@nomail> wrote:
> 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 depends if you want to have that kind of accuracy for ray-tracing or for
simulations. For ray-tracing it's impossible without modifying source code,
AFAIK; but there are methods for calculating values that are outside the
normal range of numerical precision, for example the 1001st digit of square
root of 2.
A simple explanation of how it's done can be found here:
http://digilander.libero.it/foxes/MultiPrecision.htm#How_to_store_long_number
It could be done in SDL, but every mathematical operator you plan on using
would have to be redefined.


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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