From d282785ac1f8c57eb0742830c7bb43eaa41f369a Mon Sep 17 00:00:00 2001 From: OlivierHnt <38465572+OlivierHnt@users.noreply.github.com> Date: Sun, 1 Oct 2023 22:20:59 +0200 Subject: [PATCH] Fix doctests --- docs/make.jl | 4 +++- docs/src/index.md | 2 +- src/intervals/construction.jl | 6 +++--- src/intervals/rounding.jl | 8 ++++---- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index b0675c521..5b5944a47 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,6 +1,8 @@ using Documenter, IntervalArithmetic -makedocs( +DocMeta.setdocmeta!(IntervalArithmetic, :DocTestSetup, :(using IntervalArithmetic)) + +makedocs(; modules = [IntervalArithmetic], authors = "David P. Sanders and Luis Benet", sitename = "IntervalArithmetic.jl", diff --git a/docs/src/index.md b/docs/src/index.md index aa91961a1..0aee95580 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -33,7 +33,7 @@ If you use the IntervalArithmetic library in your publication, research, teachin This project began in 2014 during a masters' course in the postgraduate programs of Mathematics and Physics at the Universidad Nacional Autónoma de México. It was initially written in Python, then reinitiated in 2015 and rewritten in Julia. We thank the participants of the courses for their contribution, energy and ideas. -### Support +## Support Financial support is acknowledged from DGAPA-UNAM PAPIME grants PE-105911 and PE-107114, and DGAPA-UNAM PAPIIT grant IN-117214. diff --git a/src/intervals/construction.jl b/src/intervals/construction.jl index 589a6e63b..0af6be428 100644 --- a/src/intervals/construction.jl +++ b/src/intervals/construction.jl @@ -21,7 +21,7 @@ Constructors compliant with the IEEE Standard 1788-2015: The internal constructor `unsafe_interval` is *not* compliant with the IEEE Standard 1788-2015. -See also: [`interval`](@ref), [`±`](@ref), [`..`](@ref) and [`@I_str`](@ref). +See also: [`interval`](@ref), [`±`](@ref), [`IntervalArithmetic.Symbols.:(..)`](@ref) and [`@I_str`](@ref). """ struct Interval{T<:NumTypes} <: Real lo::T @@ -121,7 +121,7 @@ empty interval is returned. rounded to the nearest when parsed (e.g. 0.1). In such cases, use the string macro [`@I_str`](@ref) to ensure tight enclosure around the typed numbers. -See also: [`±`](@ref), [`..`](@ref) and [`@I_str`](@ref). +See also: [`±`](@ref), [`IntervalArithmetic.Symbols.:(..)`](@ref) and [`@I_str`](@ref). # Examples ```jldoctest @@ -202,7 +202,7 @@ Despite using the midpoint-radius notation, the returned interval is still an rounded to the nearest when parsed (e.g. 0.1). In such cases, use the string macro [`@I_str`](@ref) to ensure tight enclosure around the typed numbers. -See also: [`interval`](@ref), [`..`](@ref) and [`@I_str`](@ref). +See also: [`interval`](@ref), [`IntervalArithmetic.Symbols.:(..)`](@ref) and [`@I_str`](@ref). # Examples ```jldoctest diff --git a/src/intervals/rounding.jl b/src/intervals/rounding.jl index 234d2d183..e0144786a 100644 --- a/src/intervals/rounding.jl +++ b/src/intervals/rounding.jl @@ -51,10 +51,10 @@ const rounding_types = (:fast, :tight, :accurate, :slow, :none) interval_rounding() = IntervalRounding{:tight}() # BigFloat conversion -# convert(::Type{BigFloat}, x, rounding_mode::RoundingMode) = -# setrounding(BigFloat, rounding_mode) do -# convert(BigFloat, x) -# end +Base.convert(::Type{BigFloat}, x, rounding_mode::RoundingMode) = + setrounding(BigFloat, rounding_mode) do + convert(BigFloat, x) + end # Parsing from string parse(::Type{T}, x::AbstractString, rounding_mode::RoundingMode) where T = setrounding(Float64, rounding_mode) do