Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
f7e2266c
Commit
f7e2266c
authored
Feb 02, 2010
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected broken assertion.
Fixes #571. R=rsc CC=golang-dev
https://golang.org/cl/198045
parent
e3749536
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
bignum.go
src/pkg/bignum/bignum.go
+4
-2
bignum_test.go
src/pkg/bignum/bignum_test.go
+6
-0
No files found.
src/pkg/bignum/bignum.go
View file @
f7e2266c
...
@@ -565,16 +565,18 @@ func divmod(x, y []digit2) ([]digit2, []digit2) {
...
@@ -565,16 +565,18 @@ func divmod(x, y []digit2) ([]digit2, []digit2) {
t
:=
c
+
digit
(
x
[
i
+
j
])
-
digit
(
y
[
j
])
*
q
t
:=
c
+
digit
(
x
[
i
+
j
])
-
digit
(
y
[
j
])
*
q
c
,
x
[
i
+
j
]
=
digit
(
int64
(
t
)
>>
_W2
),
digit2
(
t
&
_M2
)
// requires arithmetic shift!
c
,
x
[
i
+
j
]
=
digit
(
int64
(
t
)
>>
_W2
),
digit2
(
t
&
_M2
)
// requires arithmetic shift!
}
}
x
[
k
]
=
digit2
((
c
+
digit
(
x
[
k
]))
&
_M2
)
// correct if trial digit was too large
// correct if trial digit was too large
if
c
+
digit
(
x
[
k
])
!=
0
{
if
x
[
k
]
!=
0
{
// add y
// add y
c
:=
digit
(
0
)
c
:=
digit
(
0
)
for
j
:=
0
;
j
<
m
;
j
++
{
for
j
:=
0
;
j
<
m
;
j
++
{
t
:=
c
+
digit
(
x
[
i
+
j
])
+
digit
(
y
[
j
])
t
:=
c
+
digit
(
x
[
i
+
j
])
+
digit
(
y
[
j
])
c
,
x
[
i
+
j
]
=
t
>>
_W2
,
digit2
(
t
&
_M2
)
c
,
x
[
i
+
j
]
=
t
>>
_W2
,
digit2
(
t
&
_M2
)
}
}
assert
(
c
+
digit
(
x
[
k
])
==
0
)
x
[
k
]
=
digit2
((
c
+
digit
(
x
[
k
]))
&
_M2
)
assert
(
x
[
k
]
==
0
)
// correct trial digit
// correct trial digit
q
--
q
--
}
}
...
...
src/pkg/bignum/bignum_test.go
View file @
f7e2266c
...
@@ -663,3 +663,9 @@ func TestNatPop(t *testing.T) {
...
@@ -663,3 +663,9 @@ func TestNatPop(t *testing.T) {
test
(
i
,
nat_one
.
Shl
(
i
)
.
Sub
(
nat_one
)
.
Pop
()
==
i
)
test
(
i
,
nat_one
.
Shl
(
i
)
.
Sub
(
nat_one
)
.
Pop
()
==
i
)
}
}
}
}
func
TestIssue571
(
t
*
testing
.
T
)
{
const
min_float
=
"4.940656458412465441765687928682213723651e-324"
RatFromString
(
min_float
,
10
)
// this must not crash
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment