Converting Float64 into String but in scientific notation

I’m trying to export some data onto a tex file. But, the numbers are often huge and I want to represent the using the scientific notation. I’ve been searching the forums for a solution, but couldn’t find one.

What I expect is simple

julia> convert_float2string(1234.23322)

I’m aware of the print function that is capable of printing in scientific notation format but I intend to store the converted value as a string.

1 Like

couldn’t sprintf work for you ?

julia> using Printf

julia> @sprintf("%.5E", 1E10)
julia> using Printf

julia> x=@sprintf("%.3E", 1E10)

julia> print(x)
1 Like

Gave this a try just a few seconds ago. Was about to update my reply but too late. Thanks a lot for the help.