On Friday, September 9, 2016 at 12:15:53 AM UTC+8, T L wrote:
>
> Although x and y's possible types include float32, there are two steps in 
> "var f float32 = x / y".
> The first one is "x / y", for both default type of x and y is int, so the 
> result is 1.
> The second step is "var f float32 = 1". 
> This is it.
>
> If you change 5 to 5.0, or change 3 to 3.0,
> then the first step will operate on two Float values, the intersection 
> possible types of 5.0 and 3 (or 5 and 3.0) are float types.
>
sorry, the possible types of 3.0 and 5.0 also include int.
So here should be "the preferred possible types of 5.0 and 3 (or 5 and 3.0) 
are float types".
 

>
> On Thursday, September 8, 2016 at 11:31:55 PM UTC+8, Uvelichitel wrote:
>>
>>     package main 
>>
>>      import "fmt" 
>>
>>      func main() { 
>>          const x, y = 5, 3 
>>          var f float32 = x / y 
>>          fmt.Println(f) 
>>      } 
>>
>> output 
>> 1 
>> https://play.golang.org/p/FH1f793gWI 
>> How this doesn't produce 1.66666 
>> Would be thankful for explanation. 
>> __ 
>> Ilya Kostarev 
>>
>>

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