On Wed, Jul 8, 2020 at 11:24 AM Kurtis Rader <kra...@skepticism.us> wrote: > > On Wed, Jul 8, 2020 at 10:50 AM 'simon place' via golang-nuts > <golang-nuts@googlegroups.com> wrote: >> >> i understand, but think that since Go particularly allows these >> conversations transparently, consistency should be covered by language >> specification. it potentially causes bugs that doesn't fail fast, didn't for >> me anyway. > > > The spec is silent on this point: https://golang.org/ref/spec#Conversions. > Which makes sense since we do not want to pay the cost of the additional > logic for consistently handling NaN every time a float is converted to an int > since almost none of those conversions will involve NaN.
The spec is not particularly helpful, but it is not entirely silent. It says: "In all non-constant conversions involving floating-point or complex values, if the result type cannot represent the value the conversion succeeds but the result value is implementation-dependent." Ian -- 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/CAOyqgcVSN2qs5gVXPG4a-%3Dte--J9C6gAi1RiWaj8htq%2BvaMvtw%40mail.gmail.com.