Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1170)

Side by Side Diff: src/pkg/math/sin.go

Issue 156115: code review 156115: gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkg (Closed)
Patch Set: code review 156115: gofmt -r 'α[β:len(α)] -> α[β:]' -w src/cmd src/pkg Created 15 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/math/atan.go ('k') | src/pkg/net/fd.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package math 5 package math
6 6
7 7
8 func sinus(x float64, quad int) float64 { 8 func sinus(x float64, quad int) float64 {
9 // Coefficients are #3370 from Hart & Cheney (18.80D). 9 // Coefficients are #3370 from Hart & Cheney (18.80D).
10 const ( 10 const (
(...skipping 27 matching lines...) Expand all
38 38
39 if quad&1 != 0 { 39 if quad&1 != 0 {
40 y = 1 - y 40 y = 1 - y
41 } 41 }
42 if quad > 1 { 42 if quad > 1 {
43 y = -y 43 y = -y
44 } 44 }
45 45
46 yy := y * y; 46 yy := y * y;
47 temp1 := ((((P4*yy+P3)*yy+P2)*yy+P1)*yy + P0) * y; 47 temp1 := ((((P4*yy+P3)*yy+P2)*yy+P1)*yy + P0) * y;
48 » temp2 := ((((yy+Q3)*yy+Q2)*yy + Q1) * yy + Q0); 48 » temp2 := ((((yy+Q3)*yy+Q2)*yy+Q1)*yy + Q0);
49 return temp1 / temp2; 49 return temp1 / temp2;
50 } 50 }
51 51
52 // Cos returns the cosine of x. 52 // Cos returns the cosine of x.
53 func Cos(x float64) float64 { 53 func Cos(x float64) float64 {
54 if x < 0 { 54 if x < 0 {
55 x = -x 55 x = -x
56 } 56 }
57 return sinus(x, 1); 57 return sinus(x, 1);
58 } 58 }
59 59
60 // Sin returns the sine of x. 60 // Sin returns the sine of x.
61 func Sin(x float64) float64 { return sinus(x, 0) } 61 func Sin(x float64) float64 { return sinus(x, 0) }
OLDNEW
« no previous file with comments | « src/pkg/math/atan.go ('k') | src/pkg/net/fd.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b