julia> f = open("test.txt","w")

IOStream(<file test2.txt>) 

julia> @printf(f,"%0.2f",1/3) 

julia> close(f)


This should do the job

On Monday, June 15, 2015 at 9:50:17 AM UTC-4, Robert DJ wrote:
>
> Hi,
>
> I would like to write floating point numbers to a file and limit the 
> number of digits/decimals. With e.g.
>
> f = open("test.txt", "w")
> println(f, 1/3)
> close(f)
>
> test.txt contains 0.3333333333333333 and I would like it to be only 0.33.
>
> Is there a way to do this?
>
> Thanks,
>
> Robert
>
>

Reply via email to