<p dir="auto">by <strong>benjamin.heatwole</strong>:</p>
<pre class="notranslate">$GOOS = linux
$GOARCH = amd64
hg identify = f7e1cbc5ce28 tip

Code demonstrating the problem:

func main() {
    var min float32 = math.MinFloat32
    var minPlusOne float32 = min + 1.0
    var negOne float32 = -1.0
    var zero float32 = 0.0
    var one float32 = 1.0
    
    // All these should be true, but only the comparison with a 
positive number works
    fmt.Println("Testing comparisons using math.MinFloat32 ... ")
    fmt.Printf("%v &gt; %v = %v\n", negOne, min, negOne &gt; min)
    fmt.Printf("%v &gt; %v = %v\n", zero, min, zero &gt; min)
    fmt.Printf("%v &gt; %v = %v\n", one, min, one &gt; min)
    fmt.Println()
    
    // Adding one to MinFloat32 doesn't help
    fmt.Println("Testing comparisons using math.MinFloat32 + 1 ... ")
    fmt.Printf("%v &gt; %v = %v\n", negOne, minPlusOne, negOne &gt; 
minPlusOne)
    fmt.Printf("%v &gt; %v = %v\n", zero, minPlusOne, zero &gt; minPlusOne)
    fmt.Printf("%v &gt; %v = %v\n", one, minPlusOne, one &gt; minPlusOne)
    fmt.Println()
    
    // Using another small value works
    var small float32 = -999999.0
    fmt.Println("Testing comparisons using -999999.0 ... ")
    fmt.Printf("%v &gt; %v = %v\n", negOne, small, negOne &gt; small)
    fmt.Printf("%v &gt; %v = %v\n", zero, small, zero &gt; small)
    fmt.Printf("%v &gt; %v = %v\n", one, small, one &gt; small)
    fmt.Println()
    
    // One final test
    fmt.Println("Testing 0 == MinFloat32 ... ")
    fmt.Printf("%v == %v = %v\n", zero, min, zero == min)
}


Output is:

Testing comparisons using math.MinFloat32 ...
-1 &gt; 1e-45 = false
0 &gt; 1e-45 = false
1 &gt; 1e-45 = true

Testing comparisons using math.MinFloat32 + 1 ...
-1 &gt; 1 = false
0 &gt; 1 = false
1 &gt; 1 = false

Testing comparisons using -999999.0 ...
-1 &gt; -999999 = true
0 &gt; -999999 = true
1 &gt; -999999 = true

Testing 0 == MinFloat32 ... 
0 == 1e-45 = false

As you can see from the tests, MinFloat32 is being printed as "1e-45" but 
internally its treating the value as "0" in some cases (the second test 
with MinFloat32+1 prints as "1"), but not in others (the last test of 0 == 
MinFloat32 is false).

I'm not sure entirely what's going on, but something is goofy.</pre>
<pre class="notranslate">What steps will reproduce the problem?

1.edit tt.go

package main

import "net"

func main() {
    cname, addrs, e := net.LookupHost("boromir");
    if e != nil {
        e2 := e.(*net.DNSError);
        println(cname, addrs, e2.Error, e2.Name, e2.Server);
    }
}

2.6g tt.go &amp;&amp; 6l tt.6 &amp;&amp; ./6.out

expected nothing, but got:

 [0/0]0x0 no such host boromir.

What is your $GOOS?  $GOARCH?

Linux, AMD64

Which revision are you using?  (hg identify)

5074575b745b+ tip

Please provide any additional information below.

davies@boromir ~/go $ 6g tt.go &amp;&amp; 6l tt.6 &amp;&amp; ./6.out
 [0/0]0x0 no such host boromir.
davies@boromir ~/go $ ping boromir
PING boromir (192.168.1.13) 56(84) bytes of data.
davies@boromir ~/go $ uname -a
Linux boromir 2.6.22-gentoo-r9 #7 SMP Wed Dec 2 11:46:00 CST 2009 x86_64 
Quad-Core AMD Opteron(tm) Processor 2344 HE AuthenticAMD GNU/Linux</pre>