in Java, this is not case. BigDecimal v = new BigDecimal("123.4"); System.out.printf("%.20f\n", v); // prints 123.40000000000000000000 System.out.printf("%.40f\n", v); // prints 123.4000000000000000000000000000000000000000
you can see that it is represented exactly. I thought it was the same with big.Float in golang. thanks Santhosh On Tue, Feb 16, 2021 at 10:26 PM Brian Candler <b.cand...@pobox.com> wrote: > On Sunday, 14 February 2021 at 21:57:31 UTC kortschak wrote: > >> 123.4 cannot be represented in binary with a finite number of bits. >> >> > See: https://0.30000000000000004.com/ > > -- > You received this message because you are subscribed to a topic in the > Google Groups "golang-nuts" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/golang-nuts/3t9ao7qtrlM/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/721b9ad4-32f0-4aeb-93e6-4fe757174b5dn%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/721b9ad4-32f0-4aeb-93e6-4fe757174b5dn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABv5LKWzc-T2C-w%2BkngtRQc8MurSXB%2BwNTZsndJSyzSYovaTsA%40mail.gmail.com.