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
15d472dd
Commit
15d472dd
authored
Jul 19, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add an eval function (written by ken)
SVN=128122
parent
85c85e2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
powser1.go
test/chan/powser1.go
+18
-0
No files found.
test/chan/powser1.go
View file @
15d472dd
...
...
@@ -233,6 +233,24 @@ type PS2 *[2] PS; // pair of power series
var
Ones
PS
var
Twos
PS
// print eval in floating point of PS at x=c to n terms
func
Evaln
(
c
*
rat
,
U
PS
,
n
int
)
{
xn
:=
float64
(
1
);
x
:=
float64
(
c
.
num
)
/
float64
(
c
.
den
);
val
:=
float64
(
0
);
for
i
:=
0
;
i
<
n
;
i
++
{
u
:=
get
(
U
);
if
end
(
u
)
!=
0
{
break
;
}
val
=
val
+
x
*
float64
(
u
.
num
)
/
float64
(
u
.
den
);
xn
=
xn
*
x
;
}
print
val
,
"
\n
"
;
}
func
mkPS
()
*
dch
{
return
mkdch
()
}
...
...
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