1Number::Tolerant::UnionU(s3e)r Contributed Perl DocumentaNtuimobner::Tolerant::Union(3)
2
3
4

NAME

6       Number::Tolerant::Union - unions of tolerance ranges
7

VERSION

9       version 1.708
10

SYNOPSIS

12        use Number::Tolerant;
13
14        my $range1 = tolerance(10 => to => 12);
15        my $range2 = tolerance(14 => to => 16);
16
17        my $union = $range1 | $range2;
18
19        if ($11 == $union) { ... } # this will happen
20        if ($12 == $union) { ... } # so will this
21
22        if ($13 == $union) { ... } # nothing will happen here
23
24        if ($14 == $union) { ... } # this will happen
25        if ($15 == $union) { ... } # so will this
26

DESCRIPTION

28       Number::Tolerant::Union is used by Number::Tolerant to represent the
29       union of multiple tolerances.  A subset of the same operators that
30       function on a tolerance will function on a union of tolerances, as
31       listed below.
32

METHODS

34   new
35         my $union = Number::Tolerant::Union->new(@list_of_tolerances);
36
37       There is a "new" method on the Number::Tolerant::Union class, but
38       unions are meant to be created with the "|" operator on a
39       Number::Tolerant tolerance.
40
41       The arguments to "new" are a list of numbers or tolerances to be
42       unioned.
43
44       Intersecting ranges are not converted into a single range, but this may
45       change in the future.  (For example, the union of "5 to 10" and "7 to
46       12" is not "5 to 12.")
47
48   options
49       This method will return a list of all the acceptable options for the
50       union.
51
52   Overloading
53       Tolerance unions overload a few operations, mostly comparisons.
54
55       numification
56           Unions numify to undef.  If there's a better idea, I'd love to hear
57           it.
58
59       stringification
60           A tolerance stringifies to a short description of itself.  This is
61           a set of the union's options, parentheses-enclosed and joined by
62           the word "or"
63
64       equality
65           A number is equal to a union if it is equal to any of its options.
66
67       comparison
68           A number is greater than a union if it is greater than all its
69           options.
70
71           A number is less than a union if it is less than all its options.
72
73       union intersection
74           An intersection ("&") with a union is commutted across all options.
75           In other words:
76
77            (a | b | c) & d  ==yields==> ((a & d) | (b & d) | (c & d))
78
79           Options that have no intersection with the new element are dropped.
80           The intersection of a constant number and a union yields that
81           number, if the number was in the union's ranges and otherwise
82           yields nothing.
83

TODO

85       Who knows.  Collapsing overlapping options, probably.
86

AUTHOR

88       Ricardo Signes <rjbs@cpan.org>
89
91       This software is copyright (c) 2004 by Ricardo Signes.
92
93       This is free software; you can redistribute it and/or modify it under
94       the same terms as the Perl 5 programming language system itself.
95
96
97
98perl v5.32.0                      2020-07-28        Number::Tolerant::Union(3)
Impressum