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
33f7637d
Commit
33f7637d
authored
Jun 09, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix float lit to return 1, print error
SVN=121627
parent
5bccc6ac
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
46 deletions
+47
-46
float_lit.go
test/float_lit.go
+46
-46
golden.out
test/golden.out
+1
-0
No files found.
test/float_lit.go
View file @
33f7637d
...
@@ -29,65 +29,65 @@ close(a, b double) bool
...
@@ -29,65 +29,65 @@ close(a, b double) bool
return
false
;
return
false
;
}
}
func
main
()
{
func
main
()
int
{
if
!
close
(
0.
,
0.
)
{
p
anic
"0. is "
,
0.
,
" should be "
,
0.
,
"
\n
"
;
}
if
!
close
(
0.
,
0.
)
{
p
rint
"0. is "
,
0.
,
" should be "
,
0.
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
10.
,
+
10.
)
{
p
anic
"+10. is "
,
+
10.
,
" should be "
,
+
10.
,
"
\n
"
;
}
if
!
close
(
+
10.
,
+
10.
)
{
p
rint
"+10. is "
,
+
10.
,
" should be "
,
+
10.
,
"
\n
"
;
return
1
;
}
if
!
close
(
-
210.
,
-
210.
)
{
p
anic
"-210. is "
,
-
210.
,
" should be "
,
-
210.
,
"
\n
"
;
}
if
!
close
(
-
210.
,
-
210.
)
{
p
rint
"-210. is "
,
-
210.
,
" should be "
,
-
210.
,
"
\n
"
;
return
1
;
}
if
!
close
(
.0
,
.0
)
{
p
anic
".0 is "
,
.0
,
" should be "
,
.0
,
"
\n
"
;
}
if
!
close
(
.0
,
.0
)
{
p
rint
".0 is "
,
.0
,
" should be "
,
.0
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
.01
,
+
.01
)
{
p
anic
"+.01 is "
,
+
.01
,
" should be "
,
+
.01
,
"
\n
"
;
}
if
!
close
(
+
.01
,
+
.01
)
{
p
rint
"+.01 is "
,
+
.01
,
" should be "
,
+
.01
,
"
\n
"
;
return
1
;
}
if
!
close
(
-
.012
,
-
.012
)
{
p
anic
"-.012 is "
,
-
.012
,
" should be "
,
-
.012
,
"
\n
"
;
}
if
!
close
(
-
.012
,
-
.012
)
{
p
rint
"-.012 is "
,
-
.012
,
" should be "
,
-
.012
,
"
\n
"
;
return
1
;
}
if
!
close
(
0.0
,
0.0
)
{
p
anic
"0.0 is "
,
0.0
,
" should be "
,
0.0
,
"
\n
"
;
}
if
!
close
(
0.0
,
0.0
)
{
p
rint
"0.0 is "
,
0.0
,
" should be "
,
0.0
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
10.01
,
+
10.01
)
{
p
anic
"+10.01 is "
,
+
10.01
,
" should be "
,
+
10.01
,
"
\n
"
;
}
if
!
close
(
+
10.01
,
+
10.01
)
{
p
rint
"+10.01 is "
,
+
10.01
,
" should be "
,
+
10.01
,
"
\n
"
;
return
1
;
}
if
!
close
(
-
210.012
,
-
210.012
)
{
p
anic
"-210.012 is "
,
-
210.012
,
" should be "
,
-
210.012
,
"
\n
"
;
}
if
!
close
(
-
210.012
,
-
210.012
)
{
p
rint
"-210.012 is "
,
-
210.012
,
" should be "
,
-
210.012
,
"
\n
"
;
return
1
;
}
if
!
close
(
0E+1
,
0E+1
)
{
p
anic
"0E+1 is "
,
0E+1
,
" should be "
,
0E+1
,
"
\n
"
;
}
if
!
close
(
0E+1
,
0E+1
)
{
p
rint
"0E+1 is "
,
0E+1
,
" should be "
,
0E+1
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
10e2
,
+
10e2
)
{
p
anic
"+10e2 is "
,
+
10e2
,
" should be "
,
+
10e2
,
"
\n
"
;
}
if
!
close
(
+
10e2
,
+
10e2
)
{
p
rint
"+10e2 is "
,
+
10e2
,
" should be "
,
+
10e2
,
"
\n
"
;
return
1
;
}
if
!
close
(
-
210e3
,
-
210e3
)
{
p
anic
"-210e3 is "
,
-
210e3
,
" should be "
,
-
210e3
,
"
\n
"
;
}
if
!
close
(
-
210e3
,
-
210e3
)
{
p
rint
"-210e3 is "
,
-
210e3
,
" should be "
,
-
210e3
,
"
\n
"
;
return
1
;
}
if
!
close
(
0E-1
,
0E-1
)
{
p
anic
"0E-1 is "
,
0E-1
,
" should be "
,
0E-1
,
"
\n
"
;
}
if
!
close
(
0E-1
,
0E-1
)
{
p
rint
"0E-1 is "
,
0E-1
,
" should be "
,
0E-1
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
0e23
,
+
0e23
)
{
p
anic
"+0e23 is "
,
+
0e23
,
" should be "
,
+
0e23
,
"
\n
"
;
}
if
!
close
(
+
0e23
,
+
0e23
)
{
p
rint
"+0e23 is "
,
+
0e23
,
" should be "
,
+
0e23
,
"
\n
"
;
return
1
;
}
if
!
close
(
-
0e345
,
-
0e345
)
{
p
anic
"-0e345 is "
,
-
0e345
,
" should be "
,
-
0e345
,
"
\n
"
;
}
if
!
close
(
-
0e345
,
-
0e345
)
{
p
rint
"-0e345 is "
,
-
0e345
,
" should be "
,
-
0e345
,
"
\n
"
;
return
1
;
}
if
!
close
(
0E1
,
0E1
)
{
p
anic
"0E1 is "
,
0E1
,
" should be "
,
0E1
,
"
\n
"
;
}
if
!
close
(
0E1
,
0E1
)
{
p
rint
"0E1 is "
,
0E1
,
" should be "
,
0E1
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
10e23
,
+
10e23
)
{
p
anic
"+10e23 is "
,
+
10e23
,
" should be "
,
+
10e23
,
"
\n
"
;
}
if
!
close
(
+
10e23
,
+
10e23
)
{
p
rint
"+10e23 is "
,
+
10e23
,
" should be "
,
+
10e23
,
"
\n
"
;
return
1
;
}
// if !close(-210e345, -210e345) { p
anic "-210e345 is ", -210e345, " should be ", -210e345, "\n"
; }
// if !close(-210e345, -210e345) { p
rint "-210e345 is ", -210e345, " should be ", -210e345, "\n"; return 1
; }
if
!
close
(
0.E1
,
0.E1
)
{
p
anic
"0.E1 is "
,
0.E1
,
" should be "
,
0.E1
,
"
\n
"
;
}
if
!
close
(
0.E1
,
0.E1
)
{
p
rint
"0.E1 is "
,
0.E1
,
" should be "
,
0.E1
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
10.e+2
,
+
10.e+2
)
{
p
anic
"+10.e+2 is "
,
+
10.e+2
,
" should be "
,
+
10.e+2
,
"
\n
"
;
}
if
!
close
(
+
10.e+2
,
+
10.e+2
)
{
p
rint
"+10.e+2 is "
,
+
10.e+2
,
" should be "
,
+
10.e+2
,
"
\n
"
;
return
1
;
}
if
!
close
(
-
210.e-3
,
-
210.e-3
)
{
p
anic
"-210.e-3 is "
,
-
210.e-3
,
" should be "
,
-
210.e-3
,
"
\n
"
;
}
if
!
close
(
-
210.e-3
,
-
210.e-3
)
{
p
rint
"-210.e-3 is "
,
-
210.e-3
,
" should be "
,
-
210.e-3
,
"
\n
"
;
return
1
;
}
if
!
close
(
.0E1
,
.0E1
)
{
p
anic
".0E1 is "
,
.0E1
,
" should be "
,
.0E1
,
"
\n
"
;
}
if
!
close
(
.0E1
,
.0E1
)
{
p
rint
".0E1 is "
,
.0E1
,
" should be "
,
.0E1
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
.01e2
,
+
.01e2
)
{
p
anic
"+.01e2 is "
,
+
.01e2
,
" should be "
,
+
.01e2
,
"
\n
"
;
}
if
!
close
(
+
.01e2
,
+
.01e2
)
{
p
rint
"+.01e2 is "
,
+
.01e2
,
" should be "
,
+
.01e2
,
"
\n
"
;
return
1
;
}
if
!
close
(
-
.012e3
,
-
.012e3
)
{
p
anic
"-.012e3 is "
,
-
.012e3
,
" should be "
,
-
.012e3
,
"
\n
"
;
}
if
!
close
(
-
.012e3
,
-
.012e3
)
{
p
rint
"-.012e3 is "
,
-
.012e3
,
" should be "
,
-
.012e3
,
"
\n
"
;
return
1
;
}
if
!
close
(
0.0E1
,
0.0E1
)
{
p
anic
"0.0E1 is "
,
0.0E1
,
" should be "
,
0.0E1
,
"
\n
"
;
}
if
!
close
(
0.0E1
,
0.0E1
)
{
p
rint
"0.0E1 is "
,
0.0E1
,
" should be "
,
0.0E1
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
10.01e2
,
+
10.01e2
)
{
p
anic
"+10.01e2 is "
,
+
10.01e2
,
" should be "
,
+
10.01e2
,
"
\n
"
;
}
if
!
close
(
+
10.01e2
,
+
10.01e2
)
{
p
rint
"+10.01e2 is "
,
+
10.01e2
,
" should be "
,
+
10.01e2
,
"
\n
"
;
return
1
;
}
if
!
close
(
-
210.012e3
,
-
210.012e3
)
{
p
anic
"-210.012e3 is "
,
-
210.012e3
,
" should be "
,
-
210.012e3
,
"
\n
"
;
}
if
!
close
(
-
210.012e3
,
-
210.012e3
)
{
p
rint
"-210.012e3 is "
,
-
210.012e3
,
" should be "
,
-
210.012e3
,
"
\n
"
;
return
1
;
}
if
!
close
(
0.E+12
,
0.E+12
)
{
p
anic
"0.E+12 is "
,
0.E+12
,
" should be "
,
0.E+12
,
"
\n
"
;
}
if
!
close
(
0.E+12
,
0.E+12
)
{
p
rint
"0.E+12 is "
,
0.E+12
,
" should be "
,
0.E+12
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
10.e23
,
+
10.e23
)
{
p
anic
"+10.e23 is "
,
+
10.e23
,
" should be "
,
+
10.e23
,
"
\n
"
;
}
if
!
close
(
+
10.e23
,
+
10.e23
)
{
p
rint
"+10.e23 is "
,
+
10.e23
,
" should be "
,
+
10.e23
,
"
\n
"
;
return
1
;
}
if
!
close
(
-
210.e34
,
-
210.e34
)
{
p
anic
"-210.e34 is "
,
-
210.e34
,
" should be "
,
-
210.e34
,
"
\n
"
;
}
if
!
close
(
-
210.e34
,
-
210.e34
)
{
p
rint
"-210.e34 is "
,
-
210.e34
,
" should be "
,
-
210.e34
,
"
\n
"
;
return
1
;
}
if
!
close
(
.0E-12
,
.0E-12
)
{
p
anic
".0E-12 is "
,
.0E-12
,
" should be "
,
.0E-12
,
"
\n
"
;
}
if
!
close
(
.0E-12
,
.0E-12
)
{
p
rint
".0E-12 is "
,
.0E-12
,
" should be "
,
.0E-12
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
.01e23
,
+
.01e23
)
{
p
anic
"+.01e23 is "
,
+
.01e23
,
" should be "
,
+
.01e23
,
"
\n
"
;
}
if
!
close
(
+
.01e23
,
+
.01e23
)
{
p
rint
"+.01e23 is "
,
+
.01e23
,
" should be "
,
+
.01e23
,
"
\n
"
;
return
1
;
}
if
!
close
(
-
.012e34
,
-
.012e34
)
{
p
anic
"-.012e34 is "
,
-
.012e34
,
" should be "
,
-
.012e34
,
"
\n
"
;
}
if
!
close
(
-
.012e34
,
-
.012e34
)
{
p
rint
"-.012e34 is "
,
-
.012e34
,
" should be "
,
-
.012e34
,
"
\n
"
;
return
1
;
}
if
!
close
(
0.0E12
,
0.0E12
)
{
p
anic
"0.0E12 is "
,
0.0E12
,
" should be "
,
0.0E12
,
"
\n
"
;
}
if
!
close
(
0.0E12
,
0.0E12
)
{
p
rint
"0.0E12 is "
,
0.0E12
,
" should be "
,
0.0E12
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
10.01e23
,
+
10.01e23
)
{
p
anic
"+10.01e23 is "
,
+
10.01e23
,
" should be "
,
+
10.01e23
,
"
\n
"
;
}
if
!
close
(
+
10.01e23
,
+
10.01e23
)
{
p
rint
"+10.01e23 is "
,
+
10.01e23
,
" should be "
,
+
10.01e23
,
"
\n
"
;
return
1
;
}
if
!
close
(
-
210.012e34
,
-
210.012e34
)
{
p
anic
"-210.012e34 is "
,
-
210.012e34
,
" should be "
,
-
210.012e34
,
"
\n
"
;
}
if
!
close
(
-
210.012e34
,
-
210.012e34
)
{
p
rint
"-210.012e34 is "
,
-
210.012e34
,
" should be "
,
-
210.012e34
,
"
\n
"
;
return
1
;
}
if
!
close
(
0.E123
,
0.E123
)
{
p
anic
"0.E123 is "
,
0.E123
,
" should be "
,
0.E123
,
"
\n
"
;
}
if
!
close
(
0.E123
,
0.E123
)
{
p
rint
"0.E123 is "
,
0.E123
,
" should be "
,
0.E123
,
"
\n
"
;
return
1
;
}
if
!
close
(
+
10.e+234
,
+
10.e+234
)
{
p
anic
"+10.e+234 is "
,
+
10.e+234
,
" should be "
,
+
10.e+234
,
"
\n
"
;
}
if
!
close
(
+
10.e+234
,
+
10.e+234
)
{
p
rint
"+10.e+234 is "
,
+
10.e+234
,
" should be "
,
+
10.e+234
,
"
\n
"
;
return
1
;
}
// if !close(-210.e-345, -210.e-345) { p
anic "-210.e-345 is ", -210.e-345, " should be ", -210.e-345, "\n"
; }
// if !close(-210.e-345, -210.e-345) { p
rint "-210.e-345 is ", -210.e-345, " should be ", -210.e-345, "\n"; return 1
; }
if
!
close
(
.0E123
,
.0E123
)
{
p
anic
".0E123 is "
,
.0E123
,
" should be "
,
.0E123
,
"
\n
"
;
}
if
!
close
(
.0E123
,
.0E123
)
{
p
rint
".0E123 is "
,
.0E123
,
" should be "
,
.0E123
,
"
\n
"
;
return
1
;
}
// if !close(+.01e234, +.01e234) { p
anic "+.01e234 is ", +.01e234, " should be ", +.01e234, "\n"
; }
// if !close(+.01e234, +.01e234) { p
rint "+.01e234 is ", +.01e234, " should be ", +.01e234, "\n"; return 1
; }
// if !close(-.012e345, -.012e345) { p
anic "-.012e345 is ", -.012e345, " should be ", -.012e345, "\n"
; }
// if !close(-.012e345, -.012e345) { p
rint "-.012e345 is ", -.012e345, " should be ", -.012e345, "\n"; return 1
; }
if
!
close
(
0.0E123
,
0.0E123
)
{
p
anic
"0.0E123 is "
,
0.0E123
,
" should be "
,
0.0E123
,
"
\n
"
;
}
if
!
close
(
0.0E123
,
0.0E123
)
{
p
rint
"0.0E123 is "
,
0.0E123
,
" should be "
,
0.0E123
,
"
\n
"
;
return
1
;
}
// if !close(+10.01e234, +10.01e234) { p
anic "+10.01e234 is ", +10.01e234, " should be ", +10.01e234, "\n"
; }
// if !close(+10.01e234, +10.01e234) { p
rint "+10.01e234 is ", +10.01e234, " should be ", +10.01e234, "\n"; return 1
; }
// if !close(-210.012e345, -210.012e345) { p
anic "-210.012e345 is ", -210.012e345, " should be ", -210.012e345, "\n"
; }
// if !close(-210.012e345, -210.012e345) { p
rint "-210.012e345 is ", -210.012e345, " should be ", -210.012e345, "\n"; return 1
; }
}
}
test/golden.out
View file @
33f7637d
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
=========== ./char_lit.go
=========== ./char_lit.go
=========== ./float_lit.go
=========== ./float_lit.go
+10. is printfloat should be printfloat
BUG: known to fail incorrectly
BUG: known to fail incorrectly
=========== ./for.go
=========== ./for.go
...
...
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