Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating strings of full precision arrays

Tags:

string

save

julia

I am creating a logging function and need to create a string for the values of a bunch of arrays at some intermediate points (to both print and save to a file). I was using the following to save the arrays Ai, Bi, α, and βi:

resString = """
  A₀ = $A0
  A₁ = $A1
  B₀ = $B0
  B₁ = $B1
  α  = $α
  β₁ = $β1
  β₂ = $β2
  β₃ = $β3
  β₄ = $β4
  """

but interpolation doesn't give you the full precision and I need to save the arrays at full precision. Is there an easy way to modify this so that way all of the strings show the full values for the numbers?

like image 631
Chris Rackauckas Avatar asked Jan 14 '17 16:01

Chris Rackauckas


1 Answers

Is this what you want?

join(string.(A0), ",")

or

"[$(join(string.(A0), ","))]" if you need the square brackets too.

If you have a look here (julia/base/strings/string.jl) you can probably work out why!

like image 188
Alexander Morley Avatar answered Sep 29 '22 05:09

Alexander Morley