@@ -340,7 +340,7 @@ isguaranteed(::Number) = false
340
340
#
341
341
342
342
"""
343
- interval(T, a, b, d = com)
343
+ interval([T,] a, b, d = com; format = :infsup )
344
344
345
345
Create the interval ``[a, b]`` according to the IEEE Standard 1788-2015. The
346
346
validity of the interval is checked by [`is_valid_interval`](@ref): if `true`
386
386
interval (a, d:: Decoration = com; format:: Symbol = :infsup ) = interval (promote_numtype (numtype (a), numtype (a)), a, d; format = format)
387
387
388
388
# some useful extra constructor
389
- interval (:: Type{T} , a:: Tuple , d:: Decoration = com; format:: Symbol = :infsup ) where {T} = interval (T, a... , d; format = format)
390
- interval (a:: Tuple , d:: Decoration = com; format:: Symbol = :infsup ) = interval (a... , d; format = format)
391
389
interval (:: Type{T} , A:: AbstractArray , d:: Decoration = com; format:: Symbol = :infsup ) where {T} = interval .(T, A, d; format = format)
392
390
interval (A:: AbstractArray , d:: Decoration = com; format:: Symbol = :infsup ) = interval .(A, d; format = format)
393
391
interval (:: Type{T} , A:: AbstractArray , B:: AbstractArray , d:: Decoration = com; format:: Symbol = :infsup ) where {T} = interval .(T, A, B, d; format = format)
@@ -401,7 +399,7 @@ interval(T::Type, d::Decoration; format::Symbol = :infsup) = throw(MethodError(i
401
399
# standard format
402
400
403
401
"""
404
- _interval_infsup(T<:NumTypes, a, b, [ d::Decoration] )
402
+ _interval_infsup(T<:NumTypes, a, b, d::Decoration)
405
403
406
404
Internal constructor for intervals described by their lower and upper bounds,
407
405
i.e. of the form ``[a, b]``.
@@ -459,52 +457,52 @@ function _interval_infsup(::Type{T}, x, y::Union{BareInterval,Interval}, d::Deco
459
457
end
460
458
end
461
459
462
- _interval_infsup (:: Type{T} , a:: Complex , b:: Union{BareInterval,Interval} , d:: Decoration = com ) where {T<: NumTypes } =
460
+ _interval_infsup (:: Type{T} , a:: Complex , b:: Union{BareInterval,Interval} , d:: Decoration ) where {T<: NumTypes } =
463
461
complex (_interval_infsup (T, real (a), real (b), d), _interval_infsup (T, imag (a), imag (b), d))
464
- _interval_infsup (:: Type{T} , a:: Union{BareInterval,Interval} , b:: Complex , d:: Decoration = com ) where {T<: NumTypes } =
462
+ _interval_infsup (:: Type{T} , a:: Union{BareInterval,Interval} , b:: Complex , d:: Decoration ) where {T<: NumTypes } =
465
463
complex (_interval_infsup (T, real (a), real (b), d), _interval_infsup (T, imag (a), imag (b), d))
466
464
467
- _interval_infsup (:: Type{T} , a:: Complex , b:: Complex , d:: Decoration = com ) where {T<: NumTypes } =
465
+ _interval_infsup (:: Type{T} , a:: Complex , b:: Complex , d:: Decoration ) where {T<: NumTypes } =
468
466
complex (_interval_infsup (T, real (a), real (b), d), _interval_infsup (T, imag (a), imag (b), d))
469
- _interval_infsup (:: Type{T} , a:: Complex , b, d:: Decoration = com ) where {T<: NumTypes } =
467
+ _interval_infsup (:: Type{T} , a:: Complex , b, d:: Decoration ) where {T<: NumTypes } =
470
468
complex (_interval_infsup (T, real (a), real (b), d), _interval_infsup (T, imag (a), imag (b), d))
471
- _interval_infsup (:: Type{T} , a, b:: Complex , d:: Decoration = com ) where {T<: NumTypes } =
469
+ _interval_infsup (:: Type{T} , a, b:: Complex , d:: Decoration ) where {T<: NumTypes } =
472
470
complex (_interval_infsup (T, real (a), real (b), d), _interval_infsup (T, imag (a), imag (b), d))
473
471
474
472
# midpoint constructors
475
473
476
474
"""
477
- _interval_midpoint(T<:NumTypes, m, r, d = com )
475
+ _interval_midpoint(T<:NumTypes, m, r, d::Decoration )
478
476
479
477
Internal constructor for intervals described by their midpoint and radius, i.e.
480
478
of the form ``m \\ pm r``.
481
479
"""
482
- function _interval_midpoint (:: Type{T} , m, r, d:: Decoration = com ) where {T<: NumTypes }
480
+ function _interval_midpoint (:: Type{T} , m, r, d:: Decoration ) where {T<: NumTypes }
483
481
x = _interval_infsup (T, m, m, d)
484
482
r = _interval_infsup (T, r, r, d)
485
483
precedes (zero (r), r) && return _interval_infsup (T, x - r, x + r, d)
486
484
return throw (DomainError (r, " must be positive" ))
487
485
end
488
486
489
- _interval_midpoint (:: Type{T} , m:: Complex , r, d:: Decoration = com ) where {T<: NumTypes } =
487
+ _interval_midpoint (:: Type{T} , m:: Complex , r, d:: Decoration ) where {T<: NumTypes } =
490
488
complex (_interval_midpoint (T, real (m), r, d), _interval_midpoint (T, imag (m), r, d))
491
489
492
- function _interval_midpoint (:: Type{T} , m, r:: Complex{<:Interval} , d:: Decoration = com ) where {T<: NumTypes }
490
+ function _interval_midpoint (:: Type{T} , m, r:: Complex{<:Interval} , d:: Decoration ) where {T<: NumTypes }
493
491
isthinzero (imag (r)) || return throw (DomainError (r, " imaginary part must be zero" ))
494
492
return _interval_midpoint (T, m, real (r), d)
495
493
end
496
494
497
- function _interval_midpoint (:: Type{T} , m, r:: Complex , d:: Decoration = com ) where {T<: NumTypes }
495
+ function _interval_midpoint (:: Type{T} , m, r:: Complex , d:: Decoration ) where {T<: NumTypes }
498
496
iszero (imag (r)) || return throw (DomainError (r, " imaginary part must be zero" ))
499
497
return _interval_midpoint (T, m, real (r), d)
500
498
end
501
499
502
- function _interval_midpoint (:: Type{T} , m:: Complex , r:: Complex{<:Interval} , d:: Decoration = com ) where {T<: NumTypes }
500
+ function _interval_midpoint (:: Type{T} , m:: Complex , r:: Complex{<:Interval} , d:: Decoration ) where {T<: NumTypes }
503
501
isthinzero (imag (r)) || return throw (DomainError (r, " imaginary part must be zero" ))
504
502
return _interval_midpoint (T, m, real (r), d)
505
503
end
506
504
507
- function _interval_midpoint (:: Type{T} , m:: Complex , r:: Complex , d:: Decoration = com ) where {T<: NumTypes }
505
+ function _interval_midpoint (:: Type{T} , m:: Complex , r:: Complex , d:: Decoration ) where {T<: NumTypes }
508
506
iszero (imag (r)) || return throw (DomainError (r, " imaginary part must be zero" ))
509
507
return _interval_midpoint (T, m, real (r), d)
510
508
end
0 commit comments