1
0
mirror of https://github.com/golang/go synced 2024-10-04 16:21:22 -06:00
Commit Graph

215 Commits

Author SHA1 Message Date
Charles L. Dorian
149d3f06d8 math: fix typo in all_test.go
Logb errors were reported as Ilogb errors.

R=rsc, golang-dev, gri
CC=golang-dev
https://golang.org/cl/5517045
2012-01-05 11:04:14 -08:00
Robert Griesemer
fc78c5aa00 math/big: Rand shouldn't hang if argument is also receiver.
Fixes #2607.

R=rsc
CC=golang-dev
https://golang.org/cl/5489109
2011-12-22 14:15:41 -08:00
Rob Pike
6b772462e4 panics: use the new facilities of testing.B instead
Lots of panics go away.
Also fix a name error in html/template.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5498045
2011-12-20 10:36:25 -08:00
Robert Griesemer
541b67d051 go/printer, gofmt: fine tuning of line spacing
- no empty lines inside empty structs and interfaces
- top-level declarations are separated by a blank line if
  a) they are of different kind (e.g. const vs type); or
  b) there are documentation comments associated with a
     declaration (this is new)
- applied gofmt -w misc src

The actual changes are in go/printer/nodes.go:397-400 (empty structs/interfaces),
and go/printer/printer.go:307-309 (extra line break). The remaining
changes are cleanups w/o changing the existing functionality.

Fixes issue  2570.

R=rsc
CC=golang-dev
https://golang.org/cl/5493057
2011-12-16 15:43:06 -08:00
Russ Cox
2572803899 math: delete non-Sqrt-based Hypot
I was confused by the existence of two portable Hypot
routines in the tree when I cleaned things up, and I made
ARM use the wrong (imprecise) one.  Use the right one,
and delete the wrong one.

Fixes arm build.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5485065
2011-12-13 17:08:56 -05:00
Russ Cox
dd8dc6f059 math: regularize build
This will be nicer to the automatic tools.
It requires a few more assembly stubs
but fewer Go files.

There are a few instances where it looks like
there are new blobs of code, but they are just
being copied out of deleted files.

There is no new code here.

Suppose you have a portable implementation for Sin
and a 386-specific assembly one.  The old way to
do this was to write three files

sin_decl.go
   func Sin(x float64) float64  // declaration only
sin_386.s
   assembly implementation

sin_port.go
   func Sin(x float64) float64 { ... }  // pure-Go impl

and then link in either sin_decl.go+sin_386.s or
just sin_port.go.  The Makefile actually did the magic
of linking in only the _port.go files for those without
assembly and only the _decl.go files for those with
assembly, or at least some of that magic.

The biggest problem with this, beyond being hard
to explain to the build system, is that once you do
explain it to the build system, godoc knows which
of sin_port.go or sin_decl.go are involved on a given
architecture, and it (correctly) ignores the other.
That means you have to put identical doc comments
in both files.

The new approach, which is more like what we did
in the later packages math/big and sync/atomic,
is to have

sin.go
   func Sin(x float64) float64  // decl only
   func sin(x float64) float64 {...}  // pure-Go impl

sin_386.s
   // assembly for Sin (ignores sin)
sin_amd64.s
   // assembly for Sin: jmp sin
sin_arm.s
   // assembly for Sin: jmp sin

Once we abandon Makefiles we can put all the assembly
stubs in one source file, so the number of files will
actually go down.

Chris asked whether the branches cost anything.
Given that they are branching to pure-Go implementations
that are not typically known for their speed, the single
direct branch is not going to be noticeable.  That is,
it's on the slow path.

An alternative would have been to preserve the old
"only write assembly files when there's an implementation"
and still have just one copy of the declaration of Sin
(and thus one doc comment) by doing:

sin.go
   func Sin(x float64) float64 { return sin(x) }

sin_decl.go
   func sin(x float64) float64 // declaration only
sin_386.s
   // assembly for sin

sin_port.go
   func sin(x float64) float64 { portable code }

In this version everyone would link in sin.go and
then either sin_decl.go+sin_386.s or sin_port.go.

This has an extra function call on all paths, including
the "fast path" to get to assembly, and it triples the
number of Go files involved compared to what I did
in this CL.  On the other hand you don't have to
write assembly stubs.  After starting down this path
I decided that the assembly stubs were the easier
approach.

As for generating the assembly stubs on the fly, much
of the goal here is to eliminate magic from the build
process, so that zero-configuration tools like goinstall
or the new go tool can handle this package.

R=golang-dev, r, cw, iant, r
CC=golang-dev
https://golang.org/cl/5488057
2011-12-13 15:20:12 -05:00
Charles L. Dorian
f5c211172b math: fix special cases in Nextafter
Nextafter(0, -1) != -0.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5467060
2011-12-12 15:51:11 -05:00
Russ Cox
a250f37cbc update tree for new default type rule
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5448091
2011-12-08 22:08:03 -05:00
Charles L. Dorian
2065b0a094 math: special cases for Pow10; delete BUG
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5477046
2011-12-08 22:06:33 -05:00
Charles L. Dorian
94b0342f17 math: document more special cases
Acosh, Asinh, Atanh, Ceil, Floor, Trunc, Mod and Remainder affected. These changes add some non-finite arguments and results (and -0.0 results).

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5469046
2011-12-08 17:07:13 -05:00
Charles L. Dorian
e4de2e7fd0 math: document special-cases behavior for Dim, Max and Min
Max returns +Inf if x or y is +Inf; else it returns NaN if either x or y is NaN. Max(-0, -0) returns -0.
Min returns -Inf if x or y is -Inf; else it returns NaN if either x or y is NaN. Min(+0, -0) returns -0.
Dim(+Inf, +Inf) = NaN, Dim(-Inf, -Inf) = NaN and Dim(NaN, anything) = NaN.
Also, change "conditions" to "cases" for Sin (missed it in previous CL).

R=rsc, dave
CC=golang-dev
https://golang.org/cl/5437137
2011-12-07 14:52:17 -05:00
Charles L. Dorian
abc7df9686 math: add special-cases comments to Sinh and Tanh.
Also change "Special conditions" to "Special cases" as in other functions.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5440078
2011-12-05 14:01:24 -05:00
Charles L. Dorian
06e635e46d math: faster Sincos
Sincos via sincos.go is 35.4 ns/op, via sincos_amd64.s is 37.4 ns/op on 2.53 GHz Intel Core 2 Duo (Mac OS X).

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5447045
2011-11-30 15:11:44 -05:00
Roger Peppe
ca6de008ba math/big: fix destination leak into result value
This code would panic:
z := big.NewInt(1)
z.SetBit(big.NewInt(0), 2, 1)
if z.Cmp(big.NewInt(1<<2)) != 0 {
        panic("fail")
}

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5437081
2011-11-30 09:29:58 -08:00
Russ Cox
03823b881c use new time API
R=bradfitz, gri, r, dsymonds
CC=golang-dev
https://golang.org/cl/5390042
2011-11-30 12:01:46 -05:00
Charles L. Dorian
c8d2544b26 math: update special-conditions comments to use ± symbol
R=rsc, golang-dev, r
CC=golang-dev
https://golang.org/cl/5445046
2011-11-28 13:04:52 -08:00
Charles L. Dorian
f1fecf8d2a math: fix typo in Log1p comments
Also note the special case of -0.0.

R=rsc, golang-dev, gri
CC=golang-dev
https://golang.org/cl/5435084
2011-11-27 18:01:08 -08:00
Michael T. Jones
4c113ffe16 math/big: use recursive subdivision for significant speedup
This change adds the second aspect to the conversion code, the
use of large divisiors (powers of big base) to greatly speed up
the divsion of large numbers. Speedups of 30x are common in the
large cases. Also includes new tests and tuning code for the
key internal parameters.

R=gri
CC=golang-dev
https://golang.org/cl/5438058
2011-11-27 11:10:59 -08:00
Charles L. Dorian
f3aa54e30d math: faster Cbrt
For amd64, from 127 to 105 ns/op; for 386, from 208 to 169 ns/op.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5412056
2011-11-21 09:56:07 -05:00
Robert Griesemer
f5cf0a486e math/big: replace nat{} -> nat(nil)
No need for creating a new nat each time.
Per Roger Peppe's suggestion; assuming
nat(nil) produces better code than nat{}.

R=rsc
CC=golang-dev
https://golang.org/cl/5375092
2011-11-14 13:35:22 -08:00
David G. Andersen
120f3b7b9d math/big: Correcting typo in SetBit() documentation
z is set to x+bit change, not z+bit change

R=golang-dev
CC=golang-dev
https://golang.org/cl/5374056
2011-11-10 14:41:24 -05:00
Charles L. Dorian
300b443ade math: faster Lgamma
Converting from polynomial constants to counted array speeds up Lgamma from 51.3 to 37.7 ns/op. Variables renamed in Gamma to avoid overlap in Lgamma.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5359045
2011-11-09 15:44:49 -05:00
Rob Pike
45e3bcb343 renaming_3: gofix -r go1pkgrename src/pkg/[m-z]*
R=rsc
CC=golang-dev
https://golang.org/cl/5345045
2011-11-08 15:41:54 -08:00
Rob Pike
6ab6c49fce renaming_1: hand-edited files for go 1 renaming
This contains the files that required handiwork, mostly
Makefiles with updated TARGs, plus the two packages
with modified package names.
html/template/doc.go needs a separate edit pass.
test/fixedbugs/bug358.go is not legal go so gofix fails on it.

R=rsc
CC=golang-dev
https://golang.org/cl/5340050
2011-11-08 15:38:47 -08:00
Charles L. Dorian
c171633780 math: faster Gamma
Having the compiler count the number of array elements speeds up Gamma from 63.7 to 56.6 ns/op.

R=rsc, golang-dev, r
CC=golang-dev
https://golang.org/cl/5362043
2011-11-05 12:25:36 -07:00
Charles L. Dorian
377ac335af math: improved high-angle test for Cos, Sin and Tan
Maximum error for 386 is "close" (1e-14). For amd64, it's "veryclose" (4e-16).

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5340042
2011-11-04 15:35:59 -04:00
Vincent Vanackere
eb1717e035 all: rename os.EOF to io.EOF in various non-code contexts
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5334050
2011-11-03 14:01:30 -07:00
Rob Pike
5cb4a15320 html,log,math: renamings
This is Go 1 package renaming CL #2.
This one merely moves the source; the import strings will be
changed after the next weekly release.

exp/template/html -> html/template
big -> math/big
cmath -> math/cmplx
rand -> math/rand
syslog -> log/syslog

The only edits are in Makefiles and deps.bash.

Note that this CL moves exp/template/html out of exp. I decided
to do that so all the renamings can be done together, even though
the API (and that of template, for that matter) is still fluid.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5332053
2011-11-03 12:42:57 -07:00
Charles L. Dorian
cefee3c919 math: improved accuracy for Tan
R=rsc
CC=golang-dev
https://golang.org/cl/5298087
2011-11-02 14:01:21 -04:00
Charles L. Dorian
739c442e42 math: Improved accuracy for Sin and Cos.
Fixes #1564.

R=rsc, dchest
CC=golang-dev
https://golang.org/cl/5320056
2011-10-31 14:26:05 -04:00
Mikio Hara
504963e6a4 build: clear execute bit from source files
R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5201042
2011-10-06 18:33:13 +09:00
Rob Pike
1a13f9b810 math: remove the leading F from Fabs etc.
The letter is a holdover from C and unnecessary in Go.
Gofix module included.
Fixes #2306.

R=golang-dev, gri, dsymonds
CC=golang-dev
https://golang.org/cl/5158043
2011-09-29 09:54:20 -07:00
Mike Rosset
8ddd66145e build: clear execute bit from Go files
R=golang-dev, rsc
CC=golang-dev, mike.rosset
https://golang.org/cl/4950062
2011-09-05 07:48:42 -04:00
Volker Dobler
f78e7d36a6 math: fix Pow10 loop
Pow10 failed for MinInt32 (endless loop until out of
memory).  Fix by returning 0 and +Inf for all arguments
where the result is not representable in a float64.
Fixes #2159.

R=rsc
CC=golang-dev
https://golang.org/cl/4930041
2011-08-24 13:59:52 -04:00
Robert Griesemer
90564a9256 go/printer: changed max. number of newlines from 3 to 2
manual changes in src/pkg/go/printer, src/cmd/gofix/signal_test.go
(cd src/cmd/gofix/testdata; gofmt -w *.in *.out)
(cd src/pkg/go/printer; gotest -update)
gofmt -w misc src

runs all tests

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4715041
2011-07-14 14:39:40 -07:00
Fan Hongjian
fc41e621e8 math: add sqrt_arm.s and sqrtGoC.go as fallback to soft fp emulation
5a: add SQRTF and SQRTD
5l: add ASQRTF and ASQRTD

Use ARMv7 VFP VSQRT instruction to speed up math.Sqrt

R=rsc, dave, m
CC=golang-dev
https://golang.org/cl/4551082
2011-06-09 17:19:08 -04:00
Robert Hencke
3fbd478a8a pkg: spelling tweaks, I-Z
also, a few miscellaneous fixes to files outside pkg

R=golang-dev, dsymonds, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/4517116
2011-05-30 18:02:59 +10:00
Nigel Tao
6a186d38d1 src/pkg: make package doc comments consistently start with "Package foo".
R=rsc
CC=golang-dev
https://golang.org/cl/4442064
2011-04-20 09:57:05 +10:00
Russ Cox
f2b5a07453 delete float, complex - code changes
also:
	cmplx -> complex
	float64(1.0) -> 1.0
	float64(1) -> 1.0

R=gri, r, gri1, r2
CC=golang-dev
https://golang.org/cl/3991043
2011-01-19 23:09:00 -05:00
Eoghan Sherry
13c2e62966 math: handle denormals in Frexp, Ilogb, Ldexp, and Logb
Also:
* document special cases for Frexp and Ldexp
* handle ±Inf in Ldexp
* correctly return -0 on underflow in Ldexp
* test special cases for Ldexp
* test boundary cases for Frexp, Ilogb, Ldexp, and Logb

R=rsc
CC=golang-dev
https://golang.org/cl/3676041
2011-01-19 14:23:59 -05:00
Eoghan Sherry
976e45726c math: change float64 bias constant from 1022 to 1023
This makes some subtle code easier to understand.

R=rsc
CC=golang-dev
https://golang.org/cl/3444043
2010-12-15 13:20:52 -05:00
Russ Cox
9282a768cf math: s/MinFloat/SmallestNonzeroFloat/
R=r, gri
CC=golang-dev
https://golang.org/cl/3547042
2010-12-10 11:39:09 -08:00
Eoghan Sherry
ff4e08f60d math: improve accuracy of Exp2
Note:
* Exp2 doesn't have a special case for very small arguments
* Exp2 hasn't been subject to a proper error analysis

Also:
* add tests for Exp2 with integer argument
* always test Go versions of Exp and Exp2

R=rsc
CC=Charlie Dorian, PeterGo, golang-dev
https://golang.org/cl/3481041
2010-12-06 16:24:51 -05:00
Robert Griesemer
3478891d12 gofmt -s -w src misc
R=r, rsc
CC=golang-dev
https://golang.org/cl/2662041
2010-10-22 10:06:33 -07:00
Charles L. Dorian
b233ac8f18 math: Fix off-by-one error in Ilogb and Logb.
Fixes #1141.

R=rsc
CC=adg, golang-dev
https://golang.org/cl/2194047
2010-09-28 10:15:21 -04:00
Rob Pike
1959c3ac5b tests: fix prints
- delete unnecessary newlines
- make sure formatted prints call the formatting routines

R=adg
CC=golang-dev
https://golang.org/cl/2225046
2010-09-23 13:48:56 +10:00
Russ Cox
6e6fc67425 math: make portable Tan(Pi/2) return NaN
The panic NaN was a translation error.
The earliest version said panic "return sys.NaN()",
and when sys.NaN came along, it changed
to "panic sys.NaN()" instead of "return sys.NaN()".

R=r
CC=golang-dev
https://golang.org/cl/2106049
2010-09-11 23:41:25 -04:00
Charles L. Dorian
bead166a7c math: amd64 version of Sincos
R=rsc
CC=golang-dev
https://golang.org/cl/1939042
2010-08-26 19:03:58 -04:00
Russ Cox
da392d9136 build: no required environment variables
R=adg, r, PeterGo
CC=golang-dev
https://golang.org/cl/1942044
2010-08-18 10:08:49 -04:00
Charles L. Dorian
c8c2bdbc59 math: fix amd64 Hypot.
Underflow/overflow tests for exp_amd64.s

Fixes #957.

R=rsc
CC=golang-dev
https://golang.org/cl/1817041
2010-08-06 16:50:48 -07:00
Charles L. Dorian
c28bd5445c math: amd64 version of log
Benchmarks 25ns/op (was 58ns/op) on 2.53GHz Intel Core 2 Duo.

R=rsc
CC=golang-dev
https://golang.org/cl/1740043
2010-07-12 11:30:11 -07:00
Charles L. Dorian
a0117bafa0 math: amd64 versions of exp and fabs
Benchmark of exp to 28 ns/op from 64 ns/op,
on 2.53GHz Intel Core 2 Duo.

R=rsc
CC=golang-dev
https://golang.org/cl/1594041
2010-06-30 14:44:27 -07:00
Russ Cox
565b5dc076 gc: new typechecking rules
* Code for assignment, conversions now mirrors spec.
* Changed some snprint -> smprint.
* Renamed runtime functions to separate
  interface conversions from type assertions:
  convT2I, assertI2T, etc.
* Correct checking of \U sequences.

Fixes #840.
Fixes #830.
Fixes #778.

R=ken2
CC=golang-dev
https://golang.org/cl/1303042
2010-06-08 18:50:02 -07:00
Charles L. Dorian
3fb8d2ad84 math: fix typo in Exp2 benchmark
Was timing Exp, not Exp2.

R=rsc, r
CC=golang-dev
https://golang.org/cl/1521042
2010-06-03 15:04:22 -07:00
Charles L. Dorian
3d4c97b82c math: Pow special cases (signed zero, IEEE 754-2008)
Also added more tests for acosh, hypot, log, log10, log2
in all_test.go.

R=rsc
CC=golang-dev
https://golang.org/cl/1417041
2010-06-02 20:55:47 -07:00
Charles L. Dorian
809479740f math: amd64 versions of fdim, fmax, fmin
Uses the SSE2 max, min instructions. Also shorter sqrt_amd64.s

R=rsc
CC=golang-dev
https://golang.org/cl/1216042
2010-05-18 22:33:50 -07:00
Charles L. Dorian
879241d819 math: signed zero Sqrt special case
IEEE 754 says: sqrt(-0) = -0

R=rsc
CC=golang-dev
https://golang.org/cl/1098041
2010-05-18 22:16:01 -07:00
Charles L. Dorian
37089cce67 math: fix typo in Cbrt description
R=rsc
CC=golang-dev
https://golang.org/cl/979043
2010-05-02 23:33:08 -07:00
Charles L. Dorian
22f84c5b2a math: more special cases for signed zero
R=rsc
CC=golang-dev
https://golang.org/cl/937042
2010-04-26 22:44:39 -07:00
Charles L. Dorian
3c3e68ba32 math: use ** for exponentiation in comments
R=rsc
CC=golang-dev
https://golang.org/cl/908041
2010-04-09 14:37:33 -07:00
Charles L. Dorian
9aa8f95ba8 math: atan2 special cases (negative zero)
Added Signbit(), revised Copysign()

R=rsc
CC=golang-dev
https://golang.org/cl/822045
2010-04-08 13:24:04 -07:00
Charles L. Dorian
1ec91c8d1d math: add J1, Y1, Jn and Yn (Bessel functions)
Also amend j0.go (variable name conflict, small corrections).

R=rsc
CC=golang-dev
https://golang.org/cl/769041
2010-03-26 14:09:39 -07:00
Charles L. Dorian
6b6c3993d5 math: add J0 and Y0 (Bessel functions)
R=rsc
CC=golang-dev
https://golang.org/cl/661044
2010-03-24 09:25:49 -07:00
Charles L. Dorian
26f0c83eb8 math: add Gamma function
R=rsc
CC=golang-dev
https://golang.org/cl/649041
2010-03-19 15:29:22 -07:00
Robert Griesemer
8107cad45a math, path: minor comment fixes
R=r
CC=golang-dev
https://golang.org/cl/444043
2010-03-11 16:40:32 -08:00
Robert Griesemer
2a62195153 math package: minor documentation fix
R=rsc
CC=golang-dev
https://golang.org/cl/424041
2010-03-10 17:04:43 -08:00
Charles L. Dorian
067fe2840b math: faster hypot
Use hardware sqrt for faster hypot; preserve software-only
hypot as hypotGo (like sqrtGo); enable benchmarking of
hypotGo.

R=rsc
CC=golang-dev
https://golang.org/cl/229049
2010-03-05 16:45:39 -08:00
Robert Griesemer
a145829873 frexp.go: remove html from comment
R=r
CC=golang-dev
https://golang.org/cl/250041
2010-03-05 10:30:50 -08:00
Charles L. Dorian
6b80a5fa6d math: added ilogb, logb, remainder, tests and special conditions
Also added expm1_386 and remainder_386; shortened exp_386

R=rsc
CC=golang-dev
https://golang.org/cl/217109
2010-03-03 18:17:13 -08:00
Robert Griesemer
dbe0b57012 go/printer, gofmt: correct indentation after certain /*-style comments
- applied gofmt to src and misc

Note: This fix improved formatting of src/pkg/math/all_test.go but leads
to a degradation in src/pkg/exp/4s/xs.go. The latter happened to "work"
before accidentally. Fixing the alignment in that case in general will
be a separate CL.

Fixes #628.

R=rsc
CC=golang-dev
https://golang.org/cl/223054
2010-02-25 13:47:16 -08:00
Charles L. Dorian
78e918ccba math: add lgamma; in-line special cases of acosh, nextafter
Added lgamma.go, tests and special cases.

R=rsc
CC=golang-dev
https://golang.org/cl/217060
2010-02-22 17:12:48 -08:00
Charles L. Dorian
c3fa32c747 math: add Cbrt and Sincos; x87 versions of Sincos, Frexp, Ldexp
Added special condition and benchmarks for Cbrt, Sincos. Took Frexp and Ldexp out of bits.go.

R=rsc
CC=golang-dev
https://golang.org/cl/206084
2010-02-18 23:33:15 -08:00
Charles L. Dorian
aee1434193 math: add Exp2; 386 FPU versions of Exp2 and Log1p
Added tests and benchmarks for Exp2 (special cases same
as Exp). Log1p also enhances speed of inverse hyperbolics.

R=rsc
CC=golang-dev
https://golang.org/cl/206058
2010-02-10 00:06:41 -08:00
Charles L. Dorian
c465331262 math: add functions Log2, Nextafter, Fdim, Fmax, Fmin
Add functions, tests and benchmarks. Fix typos in comments
in expm1 and hypot_386.  Fix Acosh domain error in benchmark
test.

R=rsc
CC=golang-dev
https://golang.org/cl/204069
2010-02-09 13:33:12 -08:00
Charles L. Dorian
072b560ee6 math: Atan2 special cases and tests; atan2_386
Added special cases, tests and benchmarks for Atan2;
added 386 FPU version of Atan2.

R=rsc
CC=golang-dev
https://golang.org/cl/201068
2010-02-05 14:55:19 -08:00
Charles L. Dorian
04217ee54e math: special cases for Modf, Frexp and Ldexp; added Modf_386
Also moved Modf from bits.go into modf.go and added timing tests.

R=rsc
CC=golang-dev
https://golang.org/cl/202042
2010-02-05 00:41:30 -08:00
Russ Cox
b13b80e555 math: change Cosh test to close, not veryclose (needed on some x86 chips)
R=r
CC=Charlie Dorian, golang-dev
https://golang.org/cl/199054
2010-02-01 22:46:37 -08:00
Charles L. Dorian
a0690b69da math: add functions; update tests and special cases
Added special cases to comments for asin.go and fabs.go.
Added Trunc() to floor.go and floor_386.s.  Fixed formatting
error in hypot_386.s  Added new functions Acosh, Asinh,
Atanh, Copysign, Erf, Erfc, Expm1, and Log1p.  Added
386 FPU version of Fmod.  Added tests, benchmarks, and
precision to expected results in all_test.go.  Edited
makefile so it all compiles.

R=rsc
CC=golang-dev
https://golang.org/cl/195052
2010-02-01 22:21:40 -08:00
Devon H. O'Dell
4ffbff14b3 math: Change veryclose to close for Sinh and Exp tests.
Fixes #550.

R=rsc
CC=eds, golang-dev, jtomaschke
https://golang.org/cl/196063
2010-01-29 12:54:05 -08:00
Charles L. Dorian
d4ca006334 math: 386 FPU hypot
Added 386 FPU version of Hypot; modified all_test.go to test
Hypot with large arguments.  Also edited sqrt.go to remove
Sqrt(0) as a special case.

R=rsc
CC=golang-dev
https://golang.org/cl/186180
2010-01-26 12:53:02 -08:00
Russ Cox
718be3215f in C and asm, replace pkg·name with ·name
(eliminate assumption of package global name space,
make code easier to move between packages).

R=r
CC=golang-dev
https://golang.org/cl/194072
2010-01-25 18:52:55 -08:00
Charles L. Dorian
9a6b8e21e4 math: special cases for Hypot
Added special case tests to all_test.go. Added tests to hypot.go,
otherwise hangs.

R=rsc
CC=golang-dev
https://golang.org/cl/186118
2010-01-15 13:21:47 -08:00
Charles L. Dorian
7f11db5ea9 math: 386 FPU functions
sin, cos, tan, asin, acos, atan, exp, log, log10,
floor, ceil, and fabs

R=rsc
CC=golang-dev
https://golang.org/cl/189083
2010-01-15 13:21:36 -08:00
Charles L. Dorian
46206c52e3 math: special cases for Ceil, Exp, Floor, Log, Log10
Added special case tests to all_test.go. Added tests to Floor,
in-lined tests in Exp and Log.

R=rsc
CC=golang-dev
https://golang.org/cl/184081
2010-01-11 21:28:02 -08:00
Charles L. Dorian
3c7534104a math: special cases for Fmod
Added special case tests to all_test.go for Fmod. Fixed Fmod [hung
for Fmod(+/-Inf, <finite>)]. Also added test for Ceil in all_test.go.

R=rsc
CC=golang-dev
https://golang.org/cl/186076
2010-01-11 16:20:51 -08:00
Rob Pike
00e2cda624 Clean up and make consistent the comments in the math package.
R=rsc
CC=golang-dev
https://golang.org/cl/186042
2010-01-12 07:38:31 +11:00
Russ Cox
093146b920 math: fix pow10 comment, test portable Sqrt
R=r
CC= golang-dev, Charlie Dorian, golang-dev
https://golang.org/cl/184058
2010-01-11 11:25:37 -08:00
Charles L. Dorian
5336cd8f91 math: Sqrt using 386 FPU.
Note: sqrt_decl.go already in src/pkg/math/.

R=rsc
CC=golang-dev
https://golang.org/cl/183155
2010-01-10 15:41:07 -08:00
Charles L. Dorian
fd1db67e87 math: special cases for Atan, Asin and Acos
Added tests for NaN and out-of-range values.
Combined asin.go and atan.go into atan.go.

R=rsc
CC=golang-dev
https://golang.org/cl/180065
2010-01-08 14:12:10 -08:00
Charles L. Dorian
d5bcf7bf41 math: special cases for Pow
R=rsc
CC=golang-dev
https://golang.org/cl/176064
2009-12-15 20:43:12 -08:00
Russ Cox
1e9e7ec4b3 math: faster, easier to inline IsNaN, IsInf
R=r
CC=golang-dev
https://golang.org/cl/180046
2009-12-15 17:21:01 -08:00
Robert Griesemer
a3d1045fb7 1) Change default gofmt default settings for
parsing and printing to new syntax.

   Use -oldparser to parse the old syntax,
   use -oldprinter to print the old syntax.

2) Change default gofmt formatting settings
   to use tabs for indentation only and to use
   spaces for alignment. This will make the code
   alignment insensitive to an editor's tabwidth.

   Use -spaces=false to use tabs for alignment.

3) Manually changed src/exp/parser/parser_test.go
   so that it doesn't try to parse the parser's
   source files using the old syntax (they have
   new syntax now).

4) gofmt -w src misc test/bench

3rd set of files.

R=rsc
CC=golang-dev
https://golang.org/cl/180048
2009-12-15 15:35:38 -08:00
Ken Thompson
bd80b5a835 test case for large angles in trig functions
R=rsc
https://golang.org/cl/157160
2009-11-24 15:42:46 -08:00
Ken Thompson
b2bc1db9ac bad sin/cos for large angles.
fixes #326.

R=rsc
https://golang.org/cl/160059
2009-11-24 15:01:44 -08:00
Sergio Luis O. B. Correia
6fc820729e go: makes it build for the case $GOROOT has whitespaces
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.

this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.

Fixes #115.

R=rsc, dsymonds1
https://golang.org/cl/157067
2009-11-23 17:32:51 -08:00
Russ Cox
9ac4449cb2 gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkg
R=r, gri
CC=golang-dev
https://golang.org/cl/156115
2009-11-20 11:45:05 -08:00
Russ Cox
b4586a7429 math: fix argument names in Atan2
(error introduced converting from arg1, arg2)

Fixes #220.

R=r
https://golang.org/cl/156041
2009-11-17 08:39:56 -08:00
Russ Cox
a338231526 gc: five bug fixes, one better error.
* check for struct literal assignment to private fields.
* record, fix crash involving parallel map assignment.
* avoid infinite recursion in exportassignok.
* make floating point bounds check precise.
* avoid crash on invalid receiver.

* add context to error about implicit assignment.

Fixes #86.
Fixes #88.
Fixes #158.
Fixes #174.
Fixes #201.
Fixes #204.

R=ken2
https://golang.org/cl/154144
2009-11-15 12:57:09 -08:00
Robert Griesemer
3bb0032cd6 - replaced gofmt expression formatting algorithm with
rsc's algorithm
- applied gofmt -w misc src
- partial CL (last chunk)

R=rsc, r
http://go/go-review/1024041
2009-11-09 21:23:52 -08:00
Robert Griesemer
40621d5c0d remove semis after statements in one-statement statement lists
R=rsc, r
http://go/go-review/1025029
2009-11-09 12:07:39 -08:00
Robert Griesemer
368f8cbc75 - fine-tuning of one-line func heuristic (nodes.go)
- enabled for function declarations (not just function literals)
- applied gofmt -w $GOROOT/src
(look for instance at src/pkg/debug/elf/elf.go)

R=r, rsc
CC=go-dev
http://go/go-review/1026006
2009-11-06 14:24:38 -08:00
Robert Griesemer
3630bfbe9f gofmt-ify math, expvar, exp/spacewar
R=rsc
http://go/go-review/1018061
2009-11-05 09:08:08 -08:00
Russ Cox
488ca3c7a6 move math out of runtime.
a step toward enforcing package boundaries,
necessary to eliminate global package name space.

R=r
DELTA=581  (310 added, 271 deleted, 0 changed)
OCL=35805
CL=35823
2009-10-15 23:09:22 -07:00
Russ Cox
094f1d5990 more lgtm files from gofmt
R=gri
OCL=35485
CL=35488
2009-10-08 15:14:54 -07:00
Russ Cox
2c5ec1ebc0 apply gofmt to malloc math once os
R=gri
DELTA=566  (4 added, 14 deleted, 548 changed)
OCL=35410
CL=35419
2009-10-06 19:40:35 -07:00
Russ Cox
86b119f765 install assembly math.Sqrt on amd64
R=r
DELTA=33  (32 added, 0 deleted, 1 changed)
OCL=34983
CL=34986
2009-09-24 14:27:52 -07:00
Russ Cox
ca6a0fee1b more "declared and not used".
the last round omitted := range and only
checked 1 out of N vars in a multi-var :=

R=r
OCL=34624
CL=34638
2009-09-15 09:41:59 -07:00
Russ Cox
3b864e4195 convert low-level (used by testing) packages to
whole-package compilation.  new Makefiles,
tests now in separate package

	bytes
	flag
	fmt
	io
	math
	once
	os
	reflect
	strconv
	sync
	time
	utf8

delete import "xxx" in package xxx.

inside package xxx, xxx is not declared
anymore so s/xxx.//g

delete file and package level forward declarations.

note the new internal_test.go and sync
and strconv to provide public access to
internals during testing.  the installed version
of the package omits that file and thus does
not open the internals to all clients.

R=r
OCL=33065
CL=33097
2009-08-12 13:18:37 -07:00
Russ Cox
0496040bd6 remove unnecessary pkg. references
R=r
DELTA=95  (0 added, 0 deleted, 95 changed)
OCL=33012
CL=33012
2009-08-10 22:02:51 -07:00
Russ Cox
e50d3ba7e4 floating-point limits and equations
R=r
DELTA=13  (8 added, 2 deleted, 3 changed)
OCL=32291
CL=32322
2009-07-28 14:50:50 -07:00
Rob Pike
08b5b4843b constants for integer limits
R=rsc
DELTA=16  (16 added, 0 deleted, 0 changed)
OCL=32288
CL=32288
2009-07-28 12:57:33 -07:00
Rob Pike
326de9ca97 constants for floating point limits
R=rsc
DELTA=5  (5 added, 0 deleted, 0 changed)
OCL=32283
CL=32287
2009-07-28 11:53:16 -07:00
Robert Griesemer
eb815c0fa2 fixed typo
TBR=r
OCL=31647
CL=31647
2009-07-14 17:08:09 -07:00
Russ Cox
a50cbf6c73 style police: parens in if, for, switch, range
R=r
DELTA=32  (0 added, 3 deleted, 29 changed)
OCL=30718
CL=30725
2009-06-24 20:12:50 -07:00
Rob Pike
d90e7cbac6 mv src/lib to src/pkg
tests: all.bash passes, gobuild still works, godoc still works.

R=rsc
OCL=30096
CL=30102
2009-06-09 09:53:44 -07:00