@@ -30,20 +30,18 @@ are reset to the default display options.
30
30
31
31
Possible options:
32
32
- `format` can be:
33
- - `:standard`: `[1, 2]`
34
- - `:midpoint`: display `x::Interval` in the form "mid(x) ± radius(x)"
33
+ - `:standard`: `[1, 2]`.
34
+ - `:midpoint`: display `x::Interval` in the form "mid(x) ± radius(x)".
35
35
- `:full`: display the entire bounds regardless of `sigdigits`.
36
36
- `sigdigits`: number (greater or equal to 1) of significant digits to display.
37
37
- `decorations`: display the decorations or not.
38
38
39
- See also: `@format`.
40
-
41
39
# Example
42
40
```
43
41
julia> x = interval(0.1, 0.3) # Default display options
44
42
[0.0999999, 0.300001]
45
43
46
- julia> setformat(:full) # Equivalent to `@format full`
44
+ julia> setformat(:full)
47
45
Display parameters:
48
46
- format: full
49
47
- decorations: true
@@ -52,7 +50,7 @@ Display parameters:
52
50
julia> x
53
51
Interval(0.09999999999999999, 0.30000000000000004)
54
52
55
- julia> setformat(:standard; sigdigits = 3) # Equivalent to `@format standard 3`
53
+ julia> setformat(:standard; sigdigits = 3)
56
54
Display parameters:
57
55
- format: standard
58
56
- decorations: true
@@ -76,64 +74,6 @@ function setformat(format::Symbol = display_params.format;
76
74
return display_params
77
75
end
78
76
79
- """
80
- @format [format::Symbol] [decorations::Bool] [sigdigits::Integer]
81
-
82
- Change the format used by `show` to display intervals. These options are passed
83
- to the `setformat` function.
84
-
85
- Possible options:
86
- - `format` can be:
87
- - `:standard`: `[1, 2]`
88
- - `:midpoint`: display `x::Interval` in the form "mid(x) ± radius(x)"
89
- - `:full`: display the entire bounds regardless of `sigdigits`.
90
- - `sigdigits`: number (greater or equal to 1) of significant digits to display.
91
- - `decorations`: display the decorations or not.
92
-
93
- See also: `setformat`.
94
-
95
- # Example
96
- ```
97
- julia> x = interval(0.1, 0.3) # Default display options
98
- [0.0999999, 0.300001]
99
-
100
- julia> @format full # Equivalent to `setformat(:full)``
101
- Display parameters:
102
- - format: full
103
- - decorations: true
104
- - significant digits: 6
105
-
106
- julia> x
107
- Interval(0.09999999999999999, 0.30000000000000004)
108
-
109
- julia> @format standard true 3 # Equivalent to `setformat(:standard; decorations = true, sigdigits = 3)`
110
- Display parameters:
111
- - format: standard
112
- - decorations: true
113
- - significant digits: 3
114
-
115
- julia> x
116
- [0.0999, 0.301]
117
- ```
118
- """
119
- macro format (expr... )
120
- format = Meta. quot (display_params. format)
121
- decorations = display_params. decorations
122
- sigdigits = display_params. sigdigits
123
- for ex in expr
124
- if isa (ex, Symbol)
125
- format = Meta. quot (ex)
126
- elseif isa (ex, Bool)
127
- decorations = ex
128
- elseif isa (ex, Integer)
129
- sigdigits = ex
130
- else
131
- return :(throw (ArgumentError (" Only accept arguments of type `Symbol`, `Bool` or `Int` but received $($ ex) " )))
132
- end
133
- end
134
- return :(setformat ($ format; decorations = $ decorations, sigdigits = $ sigdigits))
135
- end
136
-
137
77
# Printing mechanism for various types of intervals
138
78
139
79
show (io:: IO , :: MIME"text/plain" , a:: Union{Interval,Complex{<:Interval},DecoratedInterval,IntervalBox} ) =
0 commit comments