Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
baf0747d
Commit
baf0747d
authored
Aug 09, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix minor bug uncovered by new constant evaluator
R=gri OCL=14025 CL=14025
parent
67c4cc47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
src/lib/fmt.go
src/lib/fmt.go
+4
-6
No files found.
src/lib/fmt.go
View file @
baf0747d
...
@@ -11,15 +11,13 @@ package fmt
...
@@ -11,15 +11,13 @@ package fmt
f.ud(^0).putnl(); // print string with automatic newline
f.ud(^0).putnl(); // print string with automatic newline
*/
*/
// import sys "sys"
// export Fmt, New;
//export Fmt, New;
const
NByte
=
64
;
const
NByte
=
64
;
const
NPows10
=
160
;
const
NPows10
=
160
;
var
ldigits
string
=
"0123456789abcdef"
;
// BUG: Should be const
var
ldigits
string
=
"0123456789abcdef"
// var not const because we take its address
var
udigits
string
=
"0123456789ABCDEF"
;
// BUG: Should be const
var
udigits
string
=
"0123456789ABCDEF"
var
pows10
[
NPows10
]
double
;
var
pows10
[
NPows10
]
double
;
func
init
()
{
func
init
()
{
...
@@ -355,7 +353,7 @@ func unpack(a double) (negative bool, exp int, num double) {
...
@@ -355,7 +353,7 @@ func unpack(a double) (negative bool, exp int, num double) {
// find g,e such that a = g*10^e.
// find g,e such that a = g*10^e.
// guess 10-exponent using 2-exponent, then fine tune.
// guess 10-exponent using 2-exponent, then fine tune.
g
,
e2
:=
sys
.
frexp
(
a
);
g
,
e2
:=
sys
.
frexp
(
a
);
e
:=
int
(
e2
*
.301029995663981
);
e
:=
int
(
double
(
e2
)
*
.301029995663981
);
g
=
a
*
pow10
(
-
e
);
g
=
a
*
pow10
(
-
e
);
for
g
<
1
{
for
g
<
1
{
e
--
;
e
--
;
...
...
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