[erlang-questions] Fwd: Change in behaviour in 5.9
Michael Schreckenbauer
grimlog@REDACTED
Fri Jan 13 23:34:23 CET 2012
Hi,
Am Freitag, 13. Januar 2012, 23:21:46 schrieb Vlad Dumitrescu:
> ... and to the list ....
>
> Hi!
>
> On Fri, Jan 13, 2012 at 23:15, Bob Cowdery <bob@REDACTED> wrote:
> > In erl 5.8.2 I had this:
> > S = io_lib:format("~10.6.0f", [Freq]),
> > where Freq was a float, say 7.0 and this gave me
> > [["00","7.000000"]] so I concat the strings to get what I want which is
> > "007.000000"
> >
> > In 5.9 the code breaks because I get [["00",55,46,48,48,48,48,48,48]].
> >
> > Neither look right to me but I really don't understand the 5.9 result.
> >
> > If I do io:format("~10.6.0f", [7.0]). it gives me what I would expect
> > "007.000000".
> >
> > Can someone explain these behaviours please.
>
> io:format returns an iolist. The exact contents may vary, but they
> represent the same thing:
> 3> erlang:iolist_to_binary([["00",55,46,48,48,48,48,48,48]]).
> <<"007.000000">>
My (5.8.5) io:format returns ok.
Eshell V5.8.5 (abort with ^G)
1> A=io:format("lalala", []).
lalalaok
2> A.
ok
3>
> regards,
> Vlad
Best,
Michael
More information about the erlang-questions
mailing list