Commit f464beb6 authored by Russ Cox's avatar Russ Cox

fix method use bug in powser1.

R=r
DELTA=7  (2 added, 2 deleted, 3 changed)
OCL=16495
CL=16499
parent 6499fbe7
...@@ -17,18 +17,18 @@ type rat struct { ...@@ -17,18 +17,18 @@ type rat struct {
num, den int64; // numerator, denominator num, den int64; // numerator, denominator
} }
func (u *rat) pr(){ type item *rat;
func (u item) pr(){
if u.den==1 { print(u.num) } if u.den==1 { print(u.num) }
else { print(u.num, "/", u.den) } else { print(u.num, "/", u.den) }
print(" ") print(" ")
} }
func (u *rat) eq(c *rat) bool { func (u item) eq(c item) bool {
return u.num == c.num && u.den == c.den return u.num == c.num && u.den == c.den
} }
type item *rat;
type dch struct { type dch struct {
req *chan int; req *chan int;
dat *chan item; dat *chan item;
...@@ -425,7 +425,7 @@ func Poly(a [] *rat) PS{ ...@@ -425,7 +425,7 @@ func Poly(a [] *rat) PS{
begin func(a [] *rat, Z PS){ begin func(a [] *rat, Z PS){
j:=0; j:=0;
done:=0; done:=0;
for j=len(a); !done&&j>0; j=j-1) for j=len(a); !done&&j>0; j=j-1)
if(a[j-1].num!=0) done=1; if(a[j-1].num!=0) done=1;
i:=0; i:=0;
for(; i<j; i=i+1) put(a[i],Z); for(; i<j; i=i+1) put(a[i],Z);
...@@ -610,7 +610,7 @@ func Init() { ...@@ -610,7 +610,7 @@ func Init() {
Twos = Rep(itor(2)); Twos = Rep(itor(2));
} }
func check(U PS, c *rat, count int, str string) { func check(U PS, c item, count int, str string) {
for i := 0; i < count; i++ { for i := 0; i < count; i++ {
r := get(U) r := get(U)
if !r.eq(c) { if !r.eq(c) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment