Go to file
Robert Griesemer 14cf5b0a28 go.tools/go/types: fun with Hilbert: a const arithmetic test
This test generates a program that declares the constant
elements of an n*n Hilbert matrix, its inverse, and the
constant elements of the explicit product of the two.
The product should be the identity matrix; that check is
also expressed as a constant expression. Type-checking
verifies that the product is indeed the identity matrix
by asserting the result of the identity check (using the
assert built-in which is available for type-check tests).

The test is run for n = 5. Other values can be tested via
the -H flag, say: go test -run=Hilbert -H=100

The generated program can be written to a file for testing
the constant arithmetic of a compiler: go test -out=test.go

Because of the mathematically precise constant arithmetic
of go/types, this test should always succeed and is only
limited by the size of the matrix. It does run successfully
from n = 0 to values larger than 100.

The Hilbert matrix is famous for being ill-conditioned and
thus exposes arithmetic imprecision very quickly. The gc
compiler only produces a correct result for n = 0 (trivially),
and n = 1 at the moment.

R=adonovan, rsc
CC=golang-dev
https://golang.org/cl/35840043
2013-12-03 13:36:57 -08:00
astutil go.tools: cleanups (added copyrights to astutil, clearer logic in go/types) 2013-11-19 09:07:02 -08:00
blog go.tools/blog: strip prefix when serving static content 2013-11-08 13:28:32 +11:00
call go.tools/pointer: use new callgraph API. 2013-09-25 17:17:42 -04:00
cmd godoc: add search results that point to documentation instead of source. 2013-11-21 11:55:42 -05:00
dashboard dashboard/app: do not send unnecessary data in todo response 2013-11-25 10:15:56 +04:00
go go.tools/go/types: fun with Hilbert: a const arithmetic test 2013-12-03 13:36:57 -08:00
godoc godoc: fix cmdline_test under Windows. Make sure the absolute path 2013-11-26 13:28:43 -05:00
importer go.tools/go/types: move gcimporter to its own package 2013-11-14 14:11:43 -08:00
oracle go.tools/ssa: opt: improve the "unused φ-node" check to eliminate self-refs, debug-refs. 2013-11-21 14:19:38 -05:00
playground go.tools/present: add support for non Go code execution 2013-10-14 14:14:08 -07:00
pointer go.tools/go/types: move gcimporter to its own package 2013-11-14 14:11:43 -08:00
present go.tools/present: add Raw content to Code for new go-tour. 2013-11-26 10:04:08 +01:00
ssa go.tools/ssa: fix builder crash in select { case n, _ := <-c: ... }. 2013-11-21 15:38:58 -05:00
.hgignore go.empty: prototype for new subrepository 2012-01-25 14:45:13 -05:00
AUTHORS go.empty: prototype for new subrepository 2012-01-25 14:45:13 -05:00
CONTRIBUTORS go.empty: prototype for new subrepository 2012-01-25 14:45:13 -05:00
LICENSE LICENSE: add 2012-03-17 15:20:58 +11:00
PATENTS go.empty: add PATENTS file to the subrepo. 2012-04-16 11:24:04 +10:00
README go.tools/README: minor correction. 2013-10-29 13:20:58 -04:00
codereview.cfg go.empty: prototype for new subrepository 2012-01-25 14:45:13 -05:00

README

This subrepository holds the source for various packages and tools that support
the Go programming language.

Some of the tools, godoc and vet for example, are included in binary Go distributions.
Others, including the Go oracle and the test coverage tool, can be fetched with "go get".

Packages include a type-checker for Go and an implementation of the
Static Single Assignment form (SSA) representation for Go programs.

To submit changes to this repository, see http://golang.org/doc/contribute.html.