…  
…  
15  $value = $value + 0; # format the value as a number 
15  $value = $value + 0; # format the value as a number 
16  $num = bless { 
16  $num = bless { 
17  value => $value, type => $Value::Type{number}, isConstant => 1, 
17  value => $value, type => $Value::Type{number}, isConstant => 1, 
18  ref => $ref, equation => $equation, 
18  ref => $ref, equation => $equation, 
19  }, $class; 
19  }, $class; 


20  my $x = Value::Real>make($value); 
20  $num>{isOne} = 1 if ($value == 1); 
21  $num>{isOne} = 1 if $x eq 1; 
21  $num>{isZero} = 1 if ($value == 0); 
22  $num>{isZero} = 1 if $x == 0; 
22  return $num; 
23  return $num; 
23  } 
24  } 
24  
25  
25  # 
26  # 
26  # We know the answers to these, so no need to compute them 
27  # We know the answers to these, so no need to compute them 
…  
…  
41  sub reduce { 
42  sub reduce { 
42  my $self = shift; 
43  my $self = shift; 
43  if ($self>{value} < 0) { 
44  if ($self>{value} < 0) { 
44  $self>{value} = ($self>{value}); 
45  $self>{value} = ($self>{value}); 
45  $self = Parser::UOP::Neg($self); 
46  $self = Parser::UOP::Neg($self); 
46  $self>{op}{isOne} = 1 if $self>{op}{value} == 1; 
47  $self>{op}{isOne} = 1 if Value::Real>make($self>{op}{value}) eq 1; 
47  } 
48  } 
48  return $self; 
49  return $self; 
49  } 
50  } 
50  
51  
51  # 
52  # 