[system] / trunk / pg / lib / Value / Infinity.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Value/Infinity.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2608 Revision 2609
35sub value {shift->{data}[0]} 35sub value {shift->{data}[0]}
36 36
37################################################## 37##################################################
38 38
39# 39#
40# Return a complex if it already is one, otherwise make it one 40# Return an infinity or real
41# (Guarantees that we have both parts in an array ref)
42# 41#
43sub promote { 42sub promote {
44 my $x = shift; 43 my $x = shift; $x = [$x,@_] if scalar(@_) > 0;
45 return $x if (ref($x) eq $pkg && scalar(@_) == 0); 44 $x = Value::makeValue($x);
46 return $x if Value::isReal($x); 45 return $x if ref($x) eq $pkg || Value::isReal($x);
47 return Value::Real->new($x) if !ref($x) && Value::matchNumber($x);
48 Value::Error("Can't convert '$x' to Infinity"); 46 Value::Error("Can't convert '$x' to Infinity");
49} 47}
50 48
51############################################ 49############################################
52# 50#

Legend:
Removed from v.2608  
changed lines
  Added in v.2609

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9