now I understand it. why they are not same but why f2 printed as 123.40000000000000000139 f2 is constructed using SetString method, so it should be accurate and printed as 123.40000000000000000000.
- Santhosh On Monday, February 15, 2021 at 2:53:45 AM UTC+5:30 kortschak wrote: > On Sun, 2021-02-14 at 13:19 -0800, Santhosh Kumar T wrote: > > When I print both values, they print exactly same. so I am assuming > > no precision lost for this specific example 123.4. > > but still Cmp returns non-zero. > > This is not a good assumption to make, and is refuted by the result of > Cmp. > > https://play.golang.org/p/ROr6cHMzWIf > > > > > -- 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/b6a82206-6660-4a08-85bd-86e482b8527en%40googlegroups.com.