summaryrefslogtreecommitdiff
path: root/src/math
Commit message (Collapse)AuthorAgeFilesLines
* all: power64 is now ppc64Russ Cox2014-12-053-3/+3
| | | | | | | | | Fixes issue 8654. LGTM=austin R=austin CC=golang-codereviews https://codereview.appspot.com/180600043
* [dev.power64] runtime: power64 fixes and ports of changesAustin Clements2014-10-271-1/+1
| | | | | | | | | | | | | | | Fix include paths that got moved in the great pkg/ rename. Add missing runtime/arch_* files for power64. Port changes that happened on default since branching to runtime/{asm,atomic,sys_linux}_power64x.s (precise stacks, calling convention change, various new and deleted functions. Port struct renaming and fix some bugs in runtime/defs_linux_power64.h. LGTM=rsc R=rsc, dave CC=golang-codereviews https://codereview.appspot.com/161450043
* [dev.power64] all: merge default into dev.power64Austin Clements2014-10-223-0/+151
|\ | | | | | | | | | | | | | | | | | | | | This brings dev.power64 up-to-date with the current tip of default. go_bootstrap is still panicking with a bad defer when initializing the runtime (even on amd64). LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/152570049
| * build: merge the great pkg/ rename into dev.power64Austin Clements2014-10-223-0/+151
| | | | | | | | | | | | | | | | | | This also removes pkg/runtime/traceback_lr.c, which was ported to Go in an earlier commit and then moved to runtime/traceback.go. Reviewer: rsc@golang.org rsc: LGTM
* | math/big: Allow non-prime modulus for ModInverseKeith Randall2014-10-142-17/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The inverse is defined whenever the element and the modulus are relatively prime. The code already handles this situation, but the spec does not. Test that it does indeed work. Fixes issue 8875 LGTM=agl R=agl CC=golang-codereviews https://codereview.appspot.com/155010043
* | math/big: Fixes issue 8920Casey Marshall2014-10-132-0/+4
| | | | | | | | | | | | | | | | | | | | | | (*Rat).SetString checks for denominator. LGTM=gri R=golang-codereviews, gri CC=golang-codereviews https://codereview.appspot.com/159760043 Committer: Robert Griesemer <gri@golang.org>
* | math/big: fix doc commentsRobert Griesemer2014-10-072-4/+4
| | | | | | | | | | | | | | | | | | Fixes issue 8904. TBR=iant R=iant CC=golang-codereviews https://codereview.appspot.com/148650043
* | math/big: math.Exp should return result >= 0 for |m| > 0Robert Griesemer2014-10-022-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The documentation states that Exp(x, y, m) computes x**y mod |m| for m != nil && m > 0. In math.big, Mod is the Euclidean modulus, which is always >= 0. Fixes issue 8822. LGTM=agl, r, rsc R=agl, r, rsc CC=golang-codereviews https://codereview.appspot.com/145650043
* | math: avoid assumption of denormalized math mode in SincosRuss Cox2014-09-261-8/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The extra-clever code in Sincos is trying to do if v&2 == 0 { mask = 0xffffffffffffffff } else { mask = 0 } It does this by turning v&2 into a float64 X0 and then using MOVSD $0.0, X3 CMPSD X0, X3, 0 That CMPSD is defined to behave like: if X0 == X3 { X3 = 0xffffffffffffffff } else { X3 = 0 } which gives the desired mask in X3. The goal in using the CMPSD was to avoid a conditional branch. This code fails when called from a PortAudio callback. In particular, the failure behavior is exactly as if the CMPSD always chose the 'true' execution. Notice that the comparison X0 == X3 is comparing as floating point values the 64-bit pattern v&2 and the actual floating point value zero. The only possible values for v&2 are 0x0000000000000000 (floating point zero) and 0x0000000000000002 (floating point 1e-323, a denormal). If they are both comparing equal to zero, I conclude that in a PortAudio callback (whatever that means), the processor is running in "denormals are zero" mode. I confirmed this by placing the processor into that mode and running the test case in the bug; it produces the incorrect output reported in the bug. In general, if a Go program changes the floating point math modes to something other than what Go expects, the math library is not going to work exactly as intended, so we might be justified in not fixing this at all. However, it seems reasonable that the client code might have expected "denormals are zero" mode to only affect actual processing of denormals. This code has produced what is in effect a gratuitous denormal by being extra clever. There is nothing about the computation being requested that fundamentally requires a denormal. It is also easy to do this computation in integer math instead: mask = ((v&2)>>1)-1 Do that. For the record, the other math tests that fail if you put the processor in "denormals are zero" mode are the tests for Frexp, Ilogb, Ldexp, Logb, Log2, and FloatMinMax, but all fail processing denormal inputs. Sincos was the only function for which that mode causes incorrect behavior on non-denormal inputs. The existing tests check that the new assembly is correct. There is no test for behavior in "denormals are zero" mode, because I don't want to add assembly to change that. Fixes issue 8623. LGTM=josharian R=golang-codereviews, josharian CC=golang-codereviews, iant, r https://codereview.appspot.com/151750043
* build: move package sources from src/pkg to srcRuss Cox2014-09-08172-0/+22062
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.