There are multiple bit-representations for NaN, so even then, you can't 
compare for equality.


On Monday, 15 April 2019 12:59:28 UTC-4, David Riley wrote:
>
> On Apr 15, 2019, at 12:47 PM, Miki Tebeka <miki....@gmail.com 
> <javascript:>> wrote: 
> > 
> > On Monday, April 15, 2019 at 2:12:18 PM UTC+3, Jan Mercl wrote: 
> > 
> > 1.1*1.1 and 1.21 are untyped constants and have much higher precision at 
> which they are not equal. 
> > Does that mean that the Go compiler is using floats with more precision 
> than the runtime? 
>
> Yes, but it's also worth remembering that in general, in computing, it's 
> not a great idea to compare floats for absolute equality except for 
> specific constants (e.g. +/- zero, +/- infinity, NaN). 
>
> Is there an in-built intrinsic in Go for comparing floats within an 
> epsilon, or does that have to be done manually? 
>
>
> - Dave 
>
>

-- 
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.

Reply via email to