Re: [go-nuts] Re: couldn't print numbers ordered with goroutine

2024-04-20 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2024-04-21 at 15:06 +1200, Justin Israel wrote: > And really I wasn't even commenting on the nature of the channel. > Only the scheduling of the goroutines. Buffered or not, they would > still be random order right?  Absolutely. Your answer was spot on. The issue is the ordering of the

Re: [go-nuts] Re: couldn't print numbers ordered with goroutine

2024-04-20 Thread Justin Israel
On Sun, Apr 21, 2024, 2:07 PM 'Dan Kortschak' via golang-nuts < golang-nuts@googlegroups.com> wrote: > On Sat, 2024-04-20 at 18:55 -0700, Robert Solomon wrote: > > channels are not queues, as Justin said > > They can be; buffered channels are queues. > > From https://go.dev/ref/spec#Channel_types

Re: [go-nuts] compiling go-1.22.2 and go-1.21.9 fail due to timeout during test of net/http package

2024-04-20 Thread Ian Lance Taylor
On Sat, Apr 20, 2024 at 7:34 PM Ron Hermsen wrote: > > compiling go-1.22.2 and go-1.21.9 fail due to timeout during test of net/http > package > > I tried a number of earlier releases but looks only the latest two fail. > (each build takes about 40min, so didn't try more options) > > > ok

[go-nuts] compiling go-1.22.2 and go-1.21.9 fail due to timeout during test of net/http package

2024-04-20 Thread Ron Hermsen
compiling go-1.22.2 and go-1.21.9 fail due to timeout during test of net/http package I tried a number of earlier releases but looks only the latest two fail. (each build takes about 40min, so didn't try more options) ok net 8.598s panic: test timed out after 9m0s running tests: FAIL

Re: [go-nuts] Re: couldn't print numbers ordered with goroutine

2024-04-20 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2024-04-20 at 18:55 -0700, Robert Solomon wrote: > channels are not queues, as Justin said They can be; buffered channels are queues. >From https://go.dev/ref/spec#Channel_types > Channels act as first-in-first-out queues. For example, if one > goroutine sends values on a channel and a

[go-nuts] Re: couldn't print numbers ordered with goroutine

2024-04-20 Thread Robert Solomon
channels are not queues, as Justin said On Saturday, April 20, 2024 at 8:18:18 PM UTC-4 Justin Israel wrote: > On Sunday, April 21, 2024 at 11:18:24 AM UTC+12 Taňryberdi Şyhmyradow > wrote: > > Hello guys, > For the following lines, I wanted to print numbers in ordered, but > couldn't. Could

[go-nuts] Re: couldn't print numbers ordered with goroutine

2024-04-20 Thread Justin Israel
On Sunday, April 21, 2024 at 11:18:24 AM UTC+12 Taňryberdi Şyhmyradow wrote: Hello guys, For the following lines, I wanted to print numbers in ordered, but couldn't. Could you please help me and explain the reason Thanks in advance ``` numbers := []int{1, 2, 3, 4, 5} // Create a buffered

[go-nuts] couldn't print numbers ordered with goroutine

2024-04-20 Thread Taňryberdi Şyhmyradow
Hello guys, For the following lines, I wanted to print numbers in ordered, but couldn't. Could you please help me and explain the reason Thanks in advance ``` numbers := []int{1, 2, 3, 4, 5} // Create a buffered channel to handle multiple values printed := make(chan int, len(numbers)) for _, n

Re: [go-nuts] why math.Pow gives different results depending on exp type

2024-04-20 Thread Dominik Honnef
Also, Staticcheck catches this: $ curl -Os https://go.dev/play/p/oIKGb_uyLb3.go $ staticcheck oIKGb_uyLb3.go oIKGb_uyLb3.go:9:38: the integer division '1 / 13' results in zero (SA4025) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] why math.Pow gives different results depending on exp type

2024-04-20 Thread Kurtis Rader
This has nothing to do with the math.Pow function. Dividing two ints (1/13) is not the same as dividing a float by an int (1.0/13). Replace your two `fmt.Printf()` calls with println(1 / 13) println(1.0 / 13) and observe the difference. The fact that both `math.Pow` arguments are of type

Re: [go-nuts] why math.Pow gives different results depending on exp type

2024-04-20 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-04-19 at 22:51 -0700, DrGo wrote: > ``` > package main > > import ( > "fmt" > "math" > ) > > func main() { > fmt.Printf("%g\n", 1-(math.Pow(0.6, 1/13)))   //result=0 > fmt.Printf("%g\n", 1-(math.Pow(0.6, 1.0/13))) // > result=0.038532272011602364 > } > ```