Skip to content

Commit

Permalink
src, misc: apply gofmt
Browse files Browse the repository at this point in the history
This applies the new gofmt literal normalizations to the library.

Change-Id: I8c1e8ef62eb556fc568872c9f77a31ef236348e7
Reviewed-on: https://go-review.googlesource.com/c/162539
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
griesemer committed Feb 19, 2019
1 parent f8abdd6 commit fae44a2
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 75 deletions.
2 changes: 1 addition & 1 deletion src/archive/tar/strconv.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func formatPAXTime(ts time.Time) (s string) {
if secs < 0 {
sign = "-" // Remember sign
secs = -(secs + 1) // Add a second to secs
nsecs = -(nsecs - 1E9) // Take that second away from nsecs
nsecs = -(nsecs - 1e9) // Take that second away from nsecs
}
return strings.TrimRight(fmt.Sprintf("%s%d.%09d", sign, secs, nsecs), "0")
}
Expand Down
42 changes: 21 additions & 21 deletions src/archive/tar/strconv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,27 +303,27 @@ func TestFormatPAXTime(t *testing.T) {
{1350244992, 300000000, "1350244992.3"},
{1350244992, 23960100, "1350244992.0239601"},
{1350244992, 23960108, "1350244992.023960108"},
{+1, +1E9 - 1E0, "1.999999999"},
{+1, +1E9 - 1E3, "1.999999"},
{+1, +1E9 - 1E6, "1.999"},
{+1, +0E0 - 0E0, "1"},
{+1, +1E6 - 0E0, "1.001"},
{+1, +1E3 - 0E0, "1.000001"},
{+1, +1E0 - 0E0, "1.000000001"},
{0, 1E9 - 1E0, "0.999999999"},
{0, 1E9 - 1E3, "0.999999"},
{0, 1E9 - 1E6, "0.999"},
{0, 0E0, "0"},
{0, 1E6 + 0E0, "0.001"},
{0, 1E3 + 0E0, "0.000001"},
{0, 1E0 + 0E0, "0.000000001"},
{-1, -1E9 + 1E0, "-1.999999999"},
{-1, -1E9 + 1E3, "-1.999999"},
{-1, -1E9 + 1E6, "-1.999"},
{-1, -0E0 + 0E0, "-1"},
{-1, -1E6 + 0E0, "-1.001"},
{-1, -1E3 + 0E0, "-1.000001"},
{-1, -1E0 + 0E0, "-1.000000001"},
{+1, +1e9 - 1e0, "1.999999999"},
{+1, +1e9 - 1e3, "1.999999"},
{+1, +1e9 - 1e6, "1.999"},
{+1, +0e0 - 0e0, "1"},
{+1, +1e6 - 0e0, "1.001"},
{+1, +1e3 - 0e0, "1.000001"},
{+1, +1e0 - 0e0, "1.000000001"},
{0, 1e9 - 1e0, "0.999999999"},
{0, 1e9 - 1e3, "0.999999"},
{0, 1e9 - 1e6, "0.999"},
{0, 0e0, "0"},
{0, 1e6 + 0e0, "0.001"},
{0, 1e3 + 0e0, "0.000001"},
{0, 1e0 + 0e0, "0.000000001"},
{-1, -1e9 + 1e0, "-1.999999999"},
{-1, -1e9 + 1e3, "-1.999999"},
{-1, -1e9 + 1e6, "-1.999"},
{-1, -0e0 + 0e0, "-1"},
{-1, -1e6 + 0e0, "-1.001"},
{-1, -1e3 + 0e0, "-1.000001"},
{-1, -1e0 + 0e0, "-1.000000001"},
{-1350244992, 0, "-1350244992"},
{-1350244992, -300000000, "-1350244992.3"},
{-1350244992, -23960100, "-1350244992.0239601"},
Expand Down
18 changes: 9 additions & 9 deletions src/cmd/compile/internal/gc/testdata/fp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func integer2floatConversions(t *testing.T) {
}
{
// Check maximum values
a, b, c, d, e, f, g, h, i := conv2Float64_ssa(127, 255, 32767, 65535, 0x7fffffff, 0xffffffff, 0x7fffFFFFffffFFFF, 0xffffFFFFffffFFFF, 3.402823E38)
a, b, c, d, e, f, g, h, i := conv2Float64_ssa(127, 255, 32767, 65535, 0x7fffffff, 0xffffffff, 0x7fffFFFFffffFFFF, 0xffffFFFFffffFFFF, 3.402823e38)
expect64(t, "a", a, 127)
expect64(t, "b", b, 255)
expect64(t, "c", c, 32767)
Expand All @@ -188,11 +188,11 @@ func integer2floatConversions(t *testing.T) {
expect64(t, "f", f, float64(uint32(0xffffffff)))
expect64(t, "g", g, float64(int64(0x7fffffffffffffff)))
expect64(t, "h", h, float64(uint64(0xffffffffffffffff)))
expect64(t, "i", i, float64(float32(3.402823E38)))
expect64(t, "i", i, float64(float32(3.402823e38)))
}
{
// Check minimum values (and tweaks for unsigned)
a, b, c, d, e, f, g, h, i := conv2Float64_ssa(-128, 254, -32768, 65534, ^0x7fffffff, 0xfffffffe, ^0x7fffFFFFffffFFFF, 0xffffFFFFffffF401, 1.5E-45)
a, b, c, d, e, f, g, h, i := conv2Float64_ssa(-128, 254, -32768, 65534, ^0x7fffffff, 0xfffffffe, ^0x7fffFFFFffffFFFF, 0xffffFFFFffffF401, 1.5e-45)
expect64(t, "a", a, -128)
expect64(t, "b", b, 254)
expect64(t, "c", c, -32768)
Expand All @@ -201,11 +201,11 @@ func integer2floatConversions(t *testing.T) {
expect64(t, "f", f, float64(uint32(0xfffffffe)))
expect64(t, "g", g, float64(^int64(0x7fffffffffffffff)))
expect64(t, "h", h, float64(uint64(0xfffffffffffff401)))
expect64(t, "i", i, float64(float32(1.5E-45)))
expect64(t, "i", i, float64(float32(1.5e-45)))
}
{
// Check maximum values
a, b, c, d, e, f, g, h, i := conv2Float32_ssa(127, 255, 32767, 65535, 0x7fffffff, 0xffffffff, 0x7fffFFFFffffFFFF, 0xffffFFFFffffFFFF, 3.402823E38)
a, b, c, d, e, f, g, h, i := conv2Float32_ssa(127, 255, 32767, 65535, 0x7fffffff, 0xffffffff, 0x7fffFFFFffffFFFF, 0xffffFFFFffffFFFF, 3.402823e38)
expect32(t, "a", a, 127)
expect32(t, "b", b, 255)
expect32(t, "c", c, 32767)
Expand All @@ -214,11 +214,11 @@ func integer2floatConversions(t *testing.T) {
expect32(t, "f", f, float32(uint32(0xffffffff)))
expect32(t, "g", g, float32(int64(0x7fffffffffffffff)))
expect32(t, "h", h, float32(uint64(0xffffffffffffffff)))
expect32(t, "i", i, float32(float64(3.402823E38)))
expect32(t, "i", i, float32(float64(3.402823e38)))
}
{
// Check minimum values (and tweaks for unsigned)
a, b, c, d, e, f, g, h, i := conv2Float32_ssa(-128, 254, -32768, 65534, ^0x7fffffff, 0xfffffffe, ^0x7fffFFFFffffFFFF, 0xffffFFFFffffF401, 1.5E-45)
a, b, c, d, e, f, g, h, i := conv2Float32_ssa(-128, 254, -32768, 65534, ^0x7fffffff, 0xfffffffe, ^0x7fffFFFFffffFFFF, 0xffffFFFFffffF401, 1.5e-45)
expect32(t, "a", a, -128)
expect32(t, "b", b, 254)
expect32(t, "c", c, -32768)
Expand All @@ -227,7 +227,7 @@ func integer2floatConversions(t *testing.T) {
expect32(t, "f", f, float32(uint32(0xfffffffe)))
expect32(t, "g", g, float32(^int64(0x7fffffffffffffff)))
expect32(t, "h", h, float32(uint64(0xfffffffffffff401)))
expect32(t, "i", i, float32(float64(1.5E-45)))
expect32(t, "i", i, float32(float64(1.5e-45)))
}
}

Expand Down Expand Up @@ -1685,7 +1685,7 @@ func TestFP(t *testing.T) {
c := float32(3.0)
d := float32(4.0)

tiny := float32(1.5E-45) // smallest f32 denorm = 2**(-149)
tiny := float32(1.5e-45) // smallest f32 denorm = 2**(-149)
dtiny := float64(tiny) // well within range of f64

fail64("+", add64_ssa, a, b, 7.0)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/compress/flate/deflate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func TestVeryLongSparseChunk(t *testing.T) {
t.Errorf("NewWriter: %v", err)
return
}
if _, err = io.Copy(w, &sparseReader{l: 23E8}); err != nil {
if _, err = io.Copy(w, &sparseReader{l: 23e8}); err != nil {
t.Errorf("Compress failed: %v", err)
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/go/internal/gcimporter/testdata/exports.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
C1 = 3.14159265
C2 = 2.718281828i
C3 = -123.456e-789
C4 = +123.456E+789
C4 = +123.456e+789
C5 = 1234i
C6 = "foo\n"
C7 = `bar\n`
Expand Down
6 changes: 3 additions & 3 deletions src/math/cmplx/tan.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ func Tanh(x complex128) complex128 {
func reducePi(x float64) float64 {
const (
// extended precision value of PI:
DP1 = 3.14159265160560607910E0 // ?? 0x400921fb54000000
DP2 = 1.98418714791870343106E-9 // ?? 0x3e210b4610000000
DP3 = 1.14423774522196636802E-17 // ?? 0x3c6a62633145c06e
DP1 = 3.14159265160560607910e0 // ?? 0x400921fb54000000
DP2 = 1.98418714791870343106e-9 // ?? 0x3e210b4610000000
DP3 = 1.14423774522196636802e-17 // ?? 0x3c6a62633145c06e
)
t := x / math.Pi
if t >= 0 {
Expand Down
36 changes: 18 additions & 18 deletions src/math/sin.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,22 @@ package math

// sin coefficients
var _sin = [...]float64{
1.58962301576546568060E-10, // 0x3de5d8fd1fd19ccd
-2.50507477628578072866E-8, // 0xbe5ae5e5a9291f5d
2.75573136213857245213E-6, // 0x3ec71de3567d48a1
-1.98412698295895385996E-4, // 0xbf2a01a019bfdf03
8.33333333332211858878E-3, // 0x3f8111111110f7d0
-1.66666666666666307295E-1, // 0xbfc5555555555548
1.58962301576546568060e-10, // 0x3de5d8fd1fd19ccd
-2.50507477628578072866e-8, // 0xbe5ae5e5a9291f5d
2.75573136213857245213e-6, // 0x3ec71de3567d48a1
-1.98412698295895385996e-4, // 0xbf2a01a019bfdf03
8.33333333332211858878e-3, // 0x3f8111111110f7d0
-1.66666666666666307295e-1, // 0xbfc5555555555548
}

// cos coefficients
var _cos = [...]float64{
-1.13585365213876817300E-11, // 0xbda8fa49a0861a9b
2.08757008419747316778E-9, // 0x3e21ee9d7b4e3f05
-2.75573141792967388112E-7, // 0xbe927e4f7eac4bc6
2.48015872888517045348E-5, // 0x3efa01a019c844f5
-1.38888888888730564116E-3, // 0xbf56c16c16c14f91
4.16666666666665929218E-2, // 0x3fa555555555554b
-1.13585365213876817300e-11, // 0xbda8fa49a0861a9b
2.08757008419747316778e-9, // 0x3e21ee9d7b4e3f05
-2.75573141792967388112e-7, // 0xbe927e4f7eac4bc6
2.48015872888517045348e-5, // 0x3efa01a019c844f5
-1.38888888888730564116e-3, // 0xbf56c16c16c14f91
4.16666666666665929218e-2, // 0x3fa555555555554b
}

// Cos returns the cosine of the radian argument x.
Expand All @@ -118,9 +118,9 @@ func Cos(x float64) float64

func cos(x float64) float64 {
const (
PI4A = 7.85398125648498535156E-1 // 0x3fe921fb40000000, Pi/4 split into three parts
PI4B = 3.77489470793079817668E-8 // 0x3e64442d00000000,
PI4C = 2.69515142907905952645E-15 // 0x3ce8469898cc5170,
PI4A = 7.85398125648498535156e-1 // 0x3fe921fb40000000, Pi/4 split into three parts
PI4B = 3.77489470793079817668e-8 // 0x3e64442d00000000,
PI4C = 2.69515142907905952645e-15 // 0x3ce8469898cc5170,
)
// special cases
switch {
Expand Down Expand Up @@ -179,9 +179,9 @@ func Sin(x float64) float64

func sin(x float64) float64 {
const (
PI4A = 7.85398125648498535156E-1 // 0x3fe921fb40000000, Pi/4 split into three parts
PI4B = 3.77489470793079817668E-8 // 0x3e64442d00000000,
PI4C = 2.69515142907905952645E-15 // 0x3ce8469898cc5170,
PI4A = 7.85398125648498535156e-1 // 0x3fe921fb40000000, Pi/4 split into three parts
PI4B = 3.77489470793079817668e-8 // 0x3e64442d00000000,
PI4C = 2.69515142907905952645e-15 // 0x3ce8469898cc5170,
)
// special cases
switch {
Expand Down
6 changes: 3 additions & 3 deletions src/math/sincos.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ package math
// Sincos(NaN) = NaN, NaN
func Sincos(x float64) (sin, cos float64) {
const (
PI4A = 7.85398125648498535156E-1 // 0x3fe921fb40000000, Pi/4 split into three parts
PI4B = 3.77489470793079817668E-8 // 0x3e64442d00000000,
PI4C = 2.69515142907905952645E-15 // 0x3ce8469898cc5170,
PI4A = 7.85398125648498535156e-1 // 0x3fe921fb40000000, Pi/4 split into three parts
PI4B = 3.77489470793079817668e-8 // 0x3e64442d00000000,
PI4C = 2.69515142907905952645e-15 // 0x3ce8469898cc5170,
)
// special cases
switch {
Expand Down
22 changes: 11 additions & 11 deletions src/math/tan.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ package math

// tan coefficients
var _tanP = [...]float64{
-1.30936939181383777646E4, // 0xc0c992d8d24f3f38
1.15351664838587416140E6, // 0x413199eca5fc9ddd
-1.79565251976484877988E7, // 0xc1711fead3299176
-1.30936939181383777646e4, // 0xc0c992d8d24f3f38
1.15351664838587416140e6, // 0x413199eca5fc9ddd
-1.79565251976484877988e7, // 0xc1711fead3299176
}
var _tanQ = [...]float64{
1.00000000000000000000E0,
1.36812963470692954678E4, //0x40cab8a5eeb36572
-1.32089234440210967447E6, //0xc13427bc582abc96
2.50083801823357915839E7, //0x4177d98fc2ead8ef
-5.38695755929454629881E7, //0xc189afe03cbe5a31
1.00000000000000000000e0,
1.36812963470692954678e4, //0x40cab8a5eeb36572
-1.32089234440210967447e6, //0xc13427bc582abc96
2.50083801823357915839e7, //0x4177d98fc2ead8ef
-5.38695755929454629881e7, //0xc189afe03cbe5a31
}

// Tan returns the tangent of the radian argument x.
Expand All @@ -83,9 +83,9 @@ func Tan(x float64) float64

func tan(x float64) float64 {
const (
PI4A = 7.85398125648498535156E-1 // 0x3fe921fb40000000, Pi/4 split into three parts
PI4B = 3.77489470793079817668E-8 // 0x3e64442d00000000,
PI4C = 2.69515142907905952645E-15 // 0x3ce8469898cc5170,
PI4A = 7.85398125648498535156e-1 // 0x3fe921fb40000000, Pi/4 split into three parts
PI4B = 3.77489470793079817668e-8 // 0x3e64442d00000000,
PI4C = 2.69515142907905952645e-15 // 0x3ce8469898cc5170,
)
// special cases
switch {
Expand Down
12 changes: 6 additions & 6 deletions src/math/tanh.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ package math
//

var tanhP = [...]float64{
-9.64399179425052238628E-1,
-9.92877231001918586564E1,
-1.61468768441708447952E3,
-9.64399179425052238628e-1,
-9.92877231001918586564e1,
-1.61468768441708447952e3,
}
var tanhQ = [...]float64{
1.12811678491632931402E2,
2.23548839060100448583E3,
4.84406305325125486048E3,
1.12811678491632931402e2,
2.23548839060100448583e3,
4.84406305325125486048e3,
}

// Tanh returns the hyperbolic tangent of x.
Expand Down

0 comments on commit fae44a2

Please sign in to comment.