POV-Ray : Newsgroups : povray.beta-test : Command-line declare seems limited to 6 significant figures Server Time
22 Dec 2024 19:33:49 EST (-0500)
  Command-line declare seems limited to 6 significant figures (Message 1 to 5 of 5)  
From: Cousin Ricky
Subject: Command-line declare seems limited to 6 significant figures
Date: 1 Aug 2012 22:45:00
Message: <web.5019e866aa48f60685de7b680@news.povray.org>
When I use declare= on the command line or in a .ini file, only 6 significant
figures get passed in.
  _________________________________________________

  #version 3.7;
  #ifndef (Input) #declare Input = 12345.6789; #end
  #debug concat (str(Input,0,4), "\n")
  _________________________________________________

Rendering this scene file with no parameters prints 12345.6789 as expected.  But
rendering it with the command line option

  declare=Input=12345.6789

yields 12345.7000.  (POV-Ray 3.6.1 prints all 9 digits.)

POV-Ray version: 3.7.RC6
Operating system: openSUSE Linux 12.1


Post a reply to this message

From: Cousin Ricky
Subject: Re: Command-line declare seems limited to 6 significant figures
Date: 1 Aug 2012 22:55:01
Message: <web.5019eb3fb6f0659d85de7b680@news.povray.org>
"Cousin Ricky" <rickysttATyahooDOTcom> wrote:
> When I use declare= on the command line or in a .ini file, only 6 significant
> figures get passed in.
>   _________________________________________________
>
>   #version 3.7;
>   #ifndef (Input) #declare Input = 12345.6789; #end
>   #debug concat (str(Input,0,4), "\n")
>   _________________________________________________
>
> Rendering this scene file with no parameters prints 12345.6789 as expected.  But
> rendering it with the command line option
>
>   declare=Input=12345.6789
>
> yields 12345.7000.  (POV-Ray 3.6.1 prints all 9 digits.)
>
> POV-Ray version: 3.7.RC6
> Operating system: openSUSE Linux 12.1

POV-Ray 3.6.1 isn't perfect either.  The option declare=Input=123456789 yields
123456792.0000.


Post a reply to this message

From: Le Forgeron
Subject: Re: Command-line declare seems limited to 6 significant figures
Date: 2 Aug 2012 03:08:39
Message: <501a2777@news.povray.org>
Le 02/08/2012 04:51, Cousin Ricky a écrit :
> "Cousin Ricky" <rickysttATyahooDOTcom> wrote:
>> When I use declare= on the command line or in a .ini file, only 6 significant
>> figures get passed in.

> 
> POV-Ray 3.6.1 isn't perfect either.  The option declare=Input=123456789 yields
> 123456792.0000.

Nothing shoking, povray does not have an integer type, only float or
double.

Traditional float has 23 bits mantissa, that's about 7 significant digits.
Traditional double has 52 bits mantissa, that's about 15.
(expecting about 3 1/3 bits per decimal, or more exactly 10 bits per 3
digits, as 1024 is 2^10, with an implicit bit in the non degenerated
representation: float get value in 24, double in 53... yet )

"Declare" are stored in float (well, IIRC, the type of float in povray
can be customised via a macro, but you need to compile it yourself).


Post a reply to this message

From: Warp
Subject: Re: Command-line declare seems limited to 6 significant figures
Date: 2 Aug 2012 09:03:27
Message: <501a7a9f@news.povray.org>
Cousin Ricky <rickysttATyahooDOTcom> wrote:
> When I use declare= on the command line or in a .ini file, only 6 significant
> figures get passed in.

This should be trivial to fix because the accuracy of the ascii-to-double
conversion can be set up in the code that performs the reading.

-- 
                                                          - Warp


Post a reply to this message

From: Cousin Ricky
Subject: Re: Command-line declare seems limited to 6 significant figures
Date: 2 Aug 2012 10:55:00
Message: <web.501a93dbb6f0659d85de7b680@news.povray.org>
Le_Forgeron <lef### [at] freefr> wrote:
> Nothing shoking, povray does not have an integer type, only float or
> double.

But double is way more than enough to handle 9 significant digits.

> Traditional float has 23 bits mantissa, that's about 7 significant digits.
> Traditional double has 52 bits mantissa, that's about 15.
> (expecting about 3 1/3 bits per decimal, or more exactly 10 bits per 3
> digits, as 1024 is 2^10, with an implicit bit in the non degenerated
> representation: float get value in 24, double in 53... yet )

I was going to look up the IEEE specs on that, but you've confirmed what I
thought.

> "Declare" are stored in float (well, IIRC, the type of float in povray
> can be customised via a macro, but you need to compile it yourself).

Why should this be, since POV-Ray uses double internally anyway?

And how is it that 3.6 could handle 9 significant digits with numbers on the
order of 10^4, but not with numbers on the order of 10^8?


Post a reply to this message

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