From da8806772771ec0d5d222afa21419a6b6a465b20 Mon Sep 17 00:00:00 2001 From: OlivierHnt <38465572+OlivierHnt@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:40:54 +0200 Subject: [PATCH 1/2] Fix doctests --- src/intervals/construction.jl | 13 ++++++------- src/parsing.jl | 2 +- src/symbols.jl | 11 +++++++++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/intervals/construction.jl b/src/intervals/construction.jl index e405ad2c8..589a6e63b 100644 --- a/src/intervals/construction.jl +++ b/src/intervals/construction.jl @@ -65,19 +65,18 @@ function, however it should be set to a concrete subtype of `Rational` or # Examples ```jldoctest -julia> IntervalArithmetic.default_numtype() -Float64 +julia> IntervalArithmetic.default_numtype() = Float32 julia> typeof(interval(1, 2)) -Interval{Float64} +Interval{Float32} julia> typeof(interval(1, big(2))) Interval{BigFloat} -julia> IntervalArithmetic.default_numtype() = Float32 +julia> IntervalArithmetic.default_numtype() = Float64 julia> typeof(interval(1, 2)) -Interval{Float32} +Interval{Float64} julia> typeof(interval(1, big(2))) Interval{BigFloat} @@ -209,10 +208,10 @@ See also: [`interval`](@ref), [`..`](@ref) and [`@I_str`](@ref). ```jldoctest julia> setformat(:full); -julia> 0.0 ± π +julia> 0 ± π Interval{Float64}(-3.1415926535897936, 3.1415926535897936) -julia> Int64(0)//1 ± π +julia> 0//1 ± π Interval{Rational{Int64}}(-85563208//27235615, 85563208//27235615) ``` """ diff --git a/src/parsing.jl b/src/parsing.jl index f7f4d8651..affb4adab 100644 --- a/src/parsing.jl +++ b/src/parsing.jl @@ -11,7 +11,7 @@ decoration; otherwise, it is semantically equivalent to ```jldoctest julia> setformat(:full); -julia> I"[3.0, 4.0]" +julia> I"[3, 4]" Interval{Float64}(3.0, 4.0) julia> I"0.1" diff --git a/src/symbols.jl b/src/symbols.jl index 3ba7b5a8e..b0d939f33 100644 --- a/src/symbols.jl +++ b/src/symbols.jl @@ -11,6 +11,17 @@ Create an interval according to the IEEE Standard 1788-2015. This is semantically equivalent to [`interval(a, b)`](@ref). See also: [`interval`](@ref), [`±`](@ref) and [`@I_str`](@ref). + +# Examples +```jldoctest +julia> setformat(:full); + +julia> (1//1)..π +Interval{Rational{Int64}}(1//1, 85563208//27235615) + +julia> 0.1..0.3 +Interval{Float64}(0.1, 0.3) +``` ``` """ const .. = interval From b40e00c6f4d39532af3002b45c83f880f3996693 Mon Sep 17 00:00:00 2001 From: OlivierHnt <38465572+OlivierHnt@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:45:48 +0200 Subject: [PATCH 2/2] Fix doctests in symbols.jl --- src/symbols.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/symbols.jl b/src/symbols.jl index b0d939f33..00bbdad30 100644 --- a/src/symbols.jl +++ b/src/symbols.jl @@ -14,6 +14,10 @@ See also: [`interval`](@ref), [`±`](@ref) and [`@I_str`](@ref). # Examples ```jldoctest +julia> using IntervalArithmetic + +julia> using IntervalArithmetic.Symbols + julia> setformat(:full); julia> (1//1)..π