[system] / trunk / pg / lib / Parser / BOP / power.pm Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# Diff of /trunk/pg/lib/Parser/BOP/power.pm

Revision 2558 Revision 2678
31# Return 1 for power of zero or base of 1. 31# Return 1 for power of zero or base of 1.
32# Return base if power is 1. 32# Return base if power is 1.
33# Return 1/base if power is -1. 33# Return 1/base if power is -1.
34# 34#
35sub _reduce { 35sub _reduce {
36 my \$self = shift; 36 my \$self = shift; my \$equation = \$self->{equation};
37 my \$parser = \$equation->{context}{parser};
37 return Parser::Number->new(\$self->{equation},1) 38 return \$parser->{Number}->new(\$equation,1)
38 if (\$self->{rop}{isZero} || \$self->{lop}{isOne}); 39 if (\$self->{rop}{isZero} || \$self->{lop}{isOne});
39 return \$self->{lop} if (\$self->{rop}{isOne}); 40 return \$self->{lop} if (\$self->{rop}{isOne});
40 if (\$self->{rop}->isNeg && \$self->{rop}->string eq '-1') { 41 if (\$self->{rop}->isNeg && \$self->{rop}->string eq '-1') {
41 \$self = Parser::BOP->new(\$self->{equation},'/', 42 \$self = \$parser->{BOP}->new(\$equation,'/',
42 Parser::Number->new(\$self->{equation},1),\$self->{lop}); 43 \$parser->{Number}->new(\$equation,1),\$self->{lop});
43 \$self = \$self->reduce; 44 \$self = \$self->reduce;
44 } 45 }
45 return \$self; 46 return \$self;
46} 47}
47 48

Legend:
 Removed from v.2558 changed lines Added in v.2678