| … | |
… | |
| 154 | |
154 | |
| 155 | # |
155 | # |
| 156 | # Addition forms unions |
156 | # Addition forms unions |
| 157 | # |
157 | # |
| 158 | sub add { |
158 | sub add { |
| 159 | my ($self,$l,$r) = Value::checkOpOrder(@_); |
159 | my ($self,$l,$r) = Value::checkOpOrderWithPromote(@_); |
| 160 | Value::Union::form($self->context,$l,$r); |
160 | Value::Union::form($self->context,$l,$r); |
| 161 | } |
161 | } |
| 162 | sub dot {my $self = shift; $self->add(@_)} |
162 | sub dot {my $self = shift; $self->add(@_)} |
| 163 | |
163 | |
| 164 | # |
164 | # |
| 165 | # Subtraction can split into a union |
165 | # Subtraction can split into a union |
| 166 | # |
166 | # |
| 167 | sub sub { |
167 | sub sub { |
| 168 | my ($self,$l,$r) = Value::checkOpOrder(@_); |
168 | my ($self,$l,$r) = Value::checkOpOrderWithPromote(@_); |
| 169 | Value::Union::form($self->context,subIntervalInterval($l,$r)); |
169 | Value::Union::form($self->context,subIntervalInterval($l,$r)); |
| 170 | } |
170 | } |
| 171 | |
171 | |
| 172 | # |
172 | # |
| 173 | # Subtract an interval from another |
173 | # Subtract an interval from another |
| … | |
… | |
| 207 | # |
207 | # |
| 208 | # Lexicographic order, but with type of endpoint included |
208 | # Lexicographic order, but with type of endpoint included |
| 209 | # in the test. |
209 | # in the test. |
| 210 | # |
210 | # |
| 211 | sub compare { |
211 | sub compare { |
| 212 | my ($self,$l,$r) = Value::checkOpOrder(@_); |
212 | my ($self,$l,$r) = Value::checkOpOrderWithPromote(@_); |
| 213 | my ($la,$lb) = $l->value; my ($ra,$rb) = $r->value; |
213 | my ($la,$lb) = $l->value; my ($ra,$rb) = $r->value; |
| 214 | my $cmp = $la <=> $ra; return $cmp if $cmp; |
214 | my $cmp = $la <=> $ra; return $cmp if $cmp; |
| 215 | my $ignoreEndpointTypes = $l->getFlag('ignoreEndpointTypes'); |
215 | my $ignoreEndpointTypes = $l->getFlag('ignoreEndpointTypes'); |
| 216 | $cmp = $l->{open} cmp $r->{open}; return $cmp if $cmp && !$ignoreEndpointTypes; |
216 | $cmp = $l->{open} cmp $r->{open}; return $cmp if $cmp && !$ignoreEndpointTypes; |
| 217 | $cmp = $lb <=> $rb; return $cmp if $cmp || $ignoreEndpointTypes; |
217 | $cmp = $lb <=> $rb; return $cmp if $cmp || $ignoreEndpointTypes; |