1
0
mirror of https://github.com/golang/go synced 2024-11-21 20:14:52 -07:00

missed a couple of files in test

R=rsc, r
https://golang.org/cl/172045
This commit is contained in:
Robert Griesemer 2009-12-09 21:39:20 -08:00
parent 542099d78f
commit 4d44d6a3d6
2 changed files with 27 additions and 18 deletions

View File

@ -28,8 +28,11 @@ type item interface {
} }
func (u *rat) pr(){ func (u *rat) pr(){
if u.den==1 { print(u.num) } if u.den==1 {
else { print(u.num, "/", u.den) } print(u.num)
} else {
print(u.num, "/", u.den)
}
print(" ") print(" ")
} }
@ -273,8 +276,7 @@ func inv(u *rat) *rat{ // invert a rat
} }
// print eval in floating point of PS at x=c to n terms // print eval in floating point of PS at x=c to n terms
func Evaln(c *rat, U PS, n int) func Evaln(c *rat, U PS, n int) {
{
xn := float64(1); xn := float64(1);
x := float64(c.num)/float64(c.den); x := float64(c.num)/float64(c.den);
val := float64(0); val := float64(0);
@ -294,8 +296,11 @@ func Printn(U PS, n int){
done := false; done := false;
for ; !done && n>0; n-- { for ; !done && n>0; n-- {
u := get(U); u := get(U);
if end(u) != 0 { done = true } if end(u) != 0 {
else { u.pr() } done = true
} else {
u.pr()
}
} }
print(("\n")); print(("\n"));
} }
@ -357,8 +362,11 @@ func Cmul(c *rat,U PS) PS{
for !done { for !done {
<-Z.req; <-Z.req;
u := get(U); u := get(U);
if end(u) != 0 { done = true } if end(u) != 0 {
else { Z.dat <- mul(c,u) } done = true
} else {
Z.dat <- mul(c,u)
}
} }
Z.dat <- finis; Z.dat <- finis;
}(c, U, Z); }(c, U, Z);
@ -474,8 +482,9 @@ func Diff(U PS) PS{
done:=false; done:=false;
for i:=1; !done; i++ { for i:=1; !done; i++ {
u = get(U); u = get(U);
if end(u) != 0 { done=true } if end(u) != 0 {
else { done=true
} else {
Z.dat <- mul(itor(int64(i)),u); Z.dat <- mul(itor(int64(i)),u);
<-Z.req; <-Z.req;
} }
@ -569,8 +578,11 @@ func Subst(U, V PS) PS {
u := get(U); u := get(U);
Z.dat <- u; Z.dat <- u;
if end(u) == 0 { if end(u) == 0 {
if end(get(VV[0])) != 0 { put(finis,Z); } if end(get(VV[0])) != 0 {
else { copy(Mul(VV[0],Subst(U,VV[1])),Z); } put(finis,Z);
} else {
copy(Mul(VV[0],Subst(U,VV[1])),Z);
}
} }
}(U, V, Z); }(U, V, Z);
return Z; return Z;

View File

@ -9,14 +9,12 @@ package main
var a,b,c,d,e,f,g,h,i int; var a,b,c,d,e,f,g,h,i int;
func func
printit() printit() {
{
println(a,b,c,d,e,f,g,h,i); println(a,b,c,d,e,f,g,h,i);
} }
func func
testit(permuteok bool) bool testit(permuteok bool) bool {
{
if a+b+c+d+e+f+g+h+i != 45 { if a+b+c+d+e+f+g+h+i != 45 {
print("sum does not add to 45\n"); print("sum does not add to 45\n");
printit(); printit();
@ -40,8 +38,7 @@ swap(x, y int) (u, v int) {
} }
func func
main() main() {
{
a = 1; a = 1;
b = 2; b = 2;
c = 3; c = 3;