|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Pov version 3.5.beta.11.id.win32 running under Win98.
#write will write floats to a maximum of five decimal places, even though the
float can be specified to 6 d.p. A workaround is to use str(A,L,P) which creates
a string with the correct number of decimal places. Example code:
#declare I=2.623806;
#fopen Output "Output.txt" write
#write(Output,I,"\n") // written to file as 2.62381
#write(Output,str(I,0,-1),"\n") // written to file as 2.623806
#fclose Output
There is no warning in the help (as far as I can see) which documents this
behaviour.
MJL
--
text{ttf"timrom.ttf"concat(#local O=1;#while(O<7)chr(val(substr(concat(#local Q=
1;#while(Q<7)str(asc(substr("???<?>",Q,1))-56,0,0),#local Q=Q+1;#end""),O,2))),#
local O=O+2;#end"").1,0pigment{rgb 9}translate-<1,.3,-2>} // MJL
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Mark James Lewin <m_j### [at] yahoocomau> wrote:
> even though the float can be specified to 6 d.p.
This is the part I didn't understand.
Floats can have something like 15 decimals (and they can be all printed).
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> Floats can have something like 15 decimals (and they can be all printed).
Any float I specify with longer than 6dp will be rounded to 6dp when str is used,
or 5dp if I try to use #write with the float identifier. Eg. for me...
#declare I=1.0000003;
#fopen Output "Output.txt" write
#write(Output,I,"\n") // written to file as 1
#write(Output,str(I,0,-1),"\n") // written to file as 1.000000
#fclose Output
Am I missing something here?
MJL
--
text{ttf"timrom.ttf"concat(#local O=1;#while(O<7)chr(val(substr(concat(#local Q=
1;#while(Q<7)str(asc(substr("???<?>",Q,1))-56,0,0),#local Q=Q+1;#end""),O,2))),#
local O=O+2;#end"").1,0pigment{rgb 9}translate-<1,.3,-2>} // MJL
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Fri, 01 Mar 2002 14:20:57 +1100, Mark James Lewin <m_j### [at] yahoocomau>
wrote:
> Am I missing something here?
yes, parameters of str function
ABX
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Mark James Lewin <m_j### [at] yahoocomau> wrote:
> Any float I specify with longer than 6dp will be rounded to 6dp when str is used,
> #write(Output,str(I,0,-1),"\n") // written to file as 1.000000
Use 15, not -1.
(-1 is a system/compiler default, not a "print as many decimals as possible")
--
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> Use 15, not -1.
>
> (-1 is a system/compiler default, not a "print as many decimals as possible")
I feel pretty stupid missing this. Could there be a place in the manual (somewhere in
section 6.1.3) which states the number of dp for people like me?
MJL
--
text{ttf"timrom.ttf"concat(#local O=1;#while(O<7)chr(val(substr(concat(#local Q=
1;#while(Q<7)str(asc(substr("???<?>",Q,1))-56,0,0),#local Q=Q+1;#end""),O,2))),#
local O=O+2;#end"").1,0pigment{rgb 9}translate-<1,.3,-2>} // MJL
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
in news:3C82917C.9ECA8DAD@yahoo.com.au Mark James Lewin wrote:
> Could there be a place in the manual (somewhere in
> section 6.1.3) which states the number of dp for people like me?
>
6.1.7.3 String Functions
str()
Ingo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
ingo wrote:
> > Could there be a place in the manual (somewhere in
> > section 6.1.3) which states the number of dp for people like me?
> >
>
> 6.1.7.3 String Functions
>
> str()
Sorry, I should have been clearer. What I would have liked was a statement that
tells the user the maximum number of dp POV stores for floats (it's, as Warp
said, around 15 or 16).
The description of str() just says you can specify the number of decimal places.
Doing something such as str(FLOAT,0,20) is (usually) pointless if floats are only
stored with 16 dp. Likewise specifying a 20dp float in a file to be read is
usually pointless because POV will round it to 16 or so dp anyway.
MJL
Post a reply to this message
|
|
| |
| |
|
|
From: Thorsten Froehlich
Subject: Re: #write and float decimal places
Date: 4 Mar 2002 17:36:04
Message: <3c83f6d4@news.povray.org>
|
|
|
| |
| |
|
|
In article <3C83F30C.AB4C24FA@yahoo.com.au> , Mark James Lewin
<m_j### [at] yahoocomau> wrote:
> Sorry, I should have been clearer. What I would have liked was a statement
> that tells the user the maximum number of dp POV stores for floats (it's, as
> Warp said, around 15 or 16).
This is not about "maximum number of dp POV stores for floats".
Floating-point numbers are "stored" by your processor. POV-Ray doesn't have
any (real) influence regarding precision. And there is no exact limit for
floating-point precision, only a common upper bound for which precision is
guaranteed. You can read this up in your processor's reference manual and
some international standard specifications if you really want to. The POV-Ray
manual simply cannot make any statement about what you are looking for because
the rules are not as simple or general as you expect nor should you be
concerned about them:
Instead of asking how much precision you can get, you should ask how much
precision you _need_! In very few cases you will need more than five or six
decimal places when it comes to computer graphics, so what would be the point
in outputting more than you really need? -- Get the idea?
Thorsten
____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg
I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Sorry, rather than having someone telling me how many decimal places I need,
I'd like to have the following statement in the #write documentation:
Instead of
"Float expressions are evaluated and written as signed float literals. If
you require format control, you should use the str(VALUE,L,P) function to
convert it to a formatted string."
it should say:
"Float expressions are evaluated and written as signed float literals,
rounded to five decimal places. If you require format control or more
precision, you should use the str(VALUE,L,P) function to convert it to a
formatted string."
As this is not at all obvious! I'm working with fractals, and more than six
decimal places DO matter for me.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|