Skip to content

Commit e24bf6e

Browse files
committed
update docstrings
1 parent 73cc938 commit e24bf6e

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/intervals/intervals.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ end
9595
"""
9696
interval(a, b)
9797
98-
`interval(a, b)` checks whether [a, b] is a valid `Interval`, which is the case if `-∞ <= a <= b <= ∞`, using the (non-exported) `is_valid_interval` function. If so, then an `Interval(a, b)` object is returned; if not, then an error is thrown.
98+
`interval(a, b)` checks whether [a, b] is a valid `Interval`, using the (non-exported) `is_valid_interval` function. If so, then an `Interval(a, b)` object is returned; if not, a warning is printed and the empty interval is returned.
9999
"""
100100
function interval(a::T, b::S) where {T<:Real, S<:Real}
101101
if !is_valid_interval(a, b)

src/intervals/macros.jl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
# This file is part of the IntervalArithmetic.jl package; MIT licensed
22

3-
"""The `@interval` macro is the main method to create an interval.
4-
It converts each expression into a narrow interval that is guaranteed to contain the true value passed by the user in the one or two expressions passed to it.
3+
"""The `@interval` macro converts an expression into a narrow interval that is guaranteed to contain the true value of the expression.
54
When passed two expressions, it takes the hull of the resulting intervals
65
to give a guaranteed containing interval.
76
87
Examples:
98
```
10-
@interval(0.1)
11-
12-
@interval(0.1, 0.2)
13-
14-
@interval(1/3, 1/6)
9+
@interval sin(0.1) + cos(0.2)
10+
```
1511
16-
@interval(1/3^2)
12+
is equivalent to
1713
```
14+
sin(0.1..0.1) + cos(0.2..0.2)
15+
```
16+
17+
NOTE! `@interval` should be used only to create intervals from an expression, as in the example
18+
before. To construct an interval from single numbers, the `..` is preferred, e.g. `0.1..0.2`
1819
"""
1920
macro interval(expr1)
2021
make_interval(:(parameters.precision_type), expr1, ())

0 commit comments

Comments
 (0)