]> Cypherpunks repositories - gostls13.git/commitdiff
math: additional tests for Ldexp
authorThan McIntosh <thanm@google.com>
Wed, 9 Aug 2017 13:16:38 +0000 (09:16 -0400)
committerThan McIntosh <thanm@google.com>
Wed, 9 Aug 2017 15:33:37 +0000 (15:33 +0000)
Add test cases to verify behavior for Ldexp with exponents outside the
range of Minint32/Maxint32, for a gccgo bug.

Test for issue #21323.

Change-Id: Iea67bc6fcfafdfddf515cf7075bdac59360c277a
Reviewed-on: https://go-review.googlesource.com/54230
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/math/all_test.go

index 39a3a4986b8fdc903e41f3776d51e65064dcc094..4449228c1ea777a0238ad7ec4eca34972af54f2c 100644 (file)
@@ -8,6 +8,7 @@ import (
        "fmt"
        . "math"
        "testing"
+       "unsafe"
 )
 
 var vf = []float64{
@@ -1368,6 +1369,8 @@ var vfldexpSC = []fi{
        {Inf(-1), 0},
        {Inf(-1), -1024},
        {NaN(), -1024},
+       {10, int(1) << (uint64(unsafe.Sizeof(0)-1) * 8)},
+       {10, -(int(1) << (uint64(unsafe.Sizeof(0)-1) * 8))},
 }
 var ldexpSC = []float64{
        0,
@@ -1381,6 +1384,8 @@ var ldexpSC = []float64{
        Inf(-1),
        Inf(-1),
        NaN(),
+       Inf(1),
+       0,
 }
 
 var vflgammaSC = []float64{