Because 3.0 == 3 and the documentation for the fmt package says the default verb (%v) for floats prints only so much digits as needed, which also implies training zeros will be dropped until explicitly asked for by a different formatting verb, like %f3.1, for example.
On Thu, Dec 20, 2018, 18:29 Jiaye Tang <jt3...@nyu.edu> wrote: > This is the code I find when I read the a book about Golang. I have a > question why the result is 1,2,3,4 instead of 1, 2, 3.0 and 4.0 when bx and > by are float. Could anyone help me? Thanks a lot! > > [image: Screen Shot 2018-12-20 at 11.59.07 PM.png] > > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.