The value 123.4 cannot be represented exactly as a float64. See
https://golang.org/pkg/math/big/#NewFloat for the caveats involved in using
NewFloat() or SetFloat64(). Passing a string representation allows the
implementation to preserve the exact value without rounding.

On Sun, Feb 14, 2021 at 12:21 PM Santhosh Kumar T <santhosh.tek...@gmail.com>
wrote:

> I created:
>     one instance using big.NewFloat function
>     another instance using big.Float.SetString method
>
> when compared both these instances using big.Float.Cmp, it return non-zero
>
> code: https://play.golang.org/p/NhQ-klcph2z
>
> am I doing something wrong ?
> can some one explain why Cmp returns non-zero ?
>
> thanks
> Santhosh
>
>
> --
> 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/82e16a17-387e-41cb-a79c-723c2e8a772bn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/82e16a17-387e-41cb-a79c-723c2e8a772bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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/CABx2%3DD_vNfJu79roUazSatzVG9%3DQvB5WZ9w-sksxEppa8sY-tg%40mail.gmail.com.

Reply via email to