POV-Ray : Newsgroups : povray.beta-test : #write and float decimal places : #write and float decimal places Server Time
29 Jul 2024 22:29:27 EDT (-0400)
  #write and float decimal places  
From: Mark James Lewin
Date: 28 Feb 2002 19:13:48
Message: <3C7EC6EE.4AFE1A18@yahoo.com.au>
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

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