Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 1c0522f
Merge: 4c239d5 ee93bd4
Author: Benoît Richard <[email protected]>
Date:   Sun Jul 23 23:13:48 2023 +0200

    Merge pull request #569 from vaerksted/master

    fix typos

commit ee93bd4
Author: spaette <[email protected]>
Date:   Sat Jul 22 12:11:01 2023 -0500

    typos

commit 4c239d5
Author: Benoît Richard <[email protected]>
Date:   Tue Jul 4 00:35:20 2023 +0200

    Bump version

commit 249040d
Merge: 4404658 7bef23e
Author: Benoît Richard <[email protected]>
Date:   Tue Jul 4 00:34:13 2023 +0200

    Merge pull request #525 from petvana/simplified-mod

    Simplified version of mod(x::Interval, y::Real)

commit 4404658
Author: Benoît Richard <[email protected]>
Date:   Wed Jun 14 14:03:14 2023 +0200

    Bump version for release

commit 7bef23e
Author: Petr Vana <[email protected]>
Date:   Fri May 27 11:11:53 2022 +0200

    Cleanup

commit f9f4733
Author: Petr Vana <[email protected]>
Date:   Fri May 27 11:10:05 2022 +0200

    Throw ArgumentError for Interval divisor for mod

commit 6fdc809
Merge: 439723f d2603d6
Author: Petr Vana <[email protected]>
Date:   Fri May 27 11:01:43 2022 +0200

    Merge branch 'simplified-mod' of github.com:petvana/IntervalArithmetic.jl into simplified-mod

commit 439723f
Author: Petr Vana <[email protected]>
Date:   Fri May 27 11:01:27 2022 +0200

    Disable divisor for mod to be an interval

commit d2603d6
Author: Petr Vana <[email protected]>
Date:   Thu May 26 11:34:04 2022 +0200

    Update docs

commit 45abc46
Author: Petr Vana <[email protected]>
Date:   Thu May 26 11:30:14 2022 +0200

    Implementation for strictly negative divisors for mod

commit ff47910
Author: Petr Vana <[email protected]>
Date:   Thu May 26 11:11:35 2022 +0200

    Add todo for mod with between two intervals

commit ea00b23
Author: Petr Vana <[email protected]>
Date:   Wed May 25 19:59:30 2022 +0200

    Imrpove test coverage + use zero()

commit b56f4be
Author: Petr Vana <[email protected]>
Date:   Wed May 25 13:44:24 2022 +0200

    Use ⊇ operator

commit d23df89
Author: Petr Vana <[email protected]>
Date:   Tue May 24 21:13:53 2022 +0200

    Update src/intervals/functions.jl

    Co-authored-by: lucaferranti <[email protected]>

commit 153d749
Author: Petr Vana <[email protected]>
Date:   Tue May 24 20:27:51 2022 +0200

    Improve testing

commit fea1b34
Author: Petr Vana <[email protected]>
Date:   Tue May 24 20:10:05 2022 +0200

    Introduce simplified version of mod
  • Loading branch information
Kolaru committed Sep 10, 2023
1 parent 91dede5 commit c2f66c5
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 6 deletions.
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- The package now supports only Julia v1.3 and later.

### Breaking changes
- Changed from using `FastRounding.jl` to `RoundingEmulator.jl` for the defalt rounding mode. [#370](https://github.com/JuliaIntervals/IntervalArithmetic.jl/pull/370)
- Changed from using `FastRounding.jl` to `RoundingEmulator.jl` for the default rounding mode. [#370](https://github.com/JuliaIntervals/IntervalArithmetic.jl/pull/370)


## v0.15
Expand Down Expand Up @@ -293,7 +293,7 @@ v0.1 is the first public release of the package.

### Interval arithmetic
- Two methods for interval rounding are available:
(i) narrow/slow (which uses hardward rounding mode changes for `Float64` intervals, and (ii) wide/fast (which does not change the rounding mode)
(i) narrow/slow (which uses hardware rounding mode changes for `Float64` intervals, and (ii) wide/fast (which does not change the rounding mode)
- The current interval precision and rounding mode are stored in the `parameters` object
- The macro `@interval` generates intervals based on the current interval precision
- Trigonometric functions are "nearly" rigorous (for `Float64` intervals, correct rounding is not currently guaranteed)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/input_output.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
'u' Returns the interval with midpoint as lower bound and radius taken in upward direction.
'C' Returns upper case for Empty, Entire and Nai
'c' Returns lower case for Empty, Entire and Nai
'+' Returns postitve numbers with '+' sign before the number
'+' Returns positive numbers with '+' sign before the number
'0' Left-pads the numbers with zeros instead of spaces within the field width

- The field width specifies the length of midpoint string.
Expand Down
4 changes: 2 additions & 2 deletions examples/Range of 2-dimensional functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
"\t\tconsole.log.apply(console, arguments);\n",
"\t }\n",
"\t},\n",
"\t// a central way to initalize communication\n",
"\t// a central way to initialize communication\n",
"\t// for widgets.\n",
"\tcommInitializer: function (widget) {\n",
"\t widget.sendUpdate = function () {};\n",
Expand Down Expand Up @@ -435,7 +435,7 @@
" });\n",
"\t });\n",
"\n",
"\t // coordingate with Comm and redraw Signals\n",
"\t // coordinate with Comm and redraw Signals\n",
"\t // XXX: Test using Reactive here to improve performance\n",
"\t $([IPython.events]).on(\n",
"\t\t'output_appended.OutputArea', function (event, type, value, md, toinsert) {\n",
Expand Down
2 changes: 1 addition & 1 deletion src/multidim/intervalbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ length(::IntervalBox{N}) where {N} = N
Return a vector of the `mid` of each interval composing the `IntervalBox`.
See `mid(X::Interval, α=0.5)` for more informations.
See `mid(X::Interval, α=0.5)` for more information.
"""
mid(X::IntervalBox) = mid.(X)
scaled_mid(X::IntervalBox, α) = scaled_mid.(X, α)
Expand Down
41 changes: 41 additions & 0 deletions test/interval_tests/numeric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -386,3 +386,44 @@ end
@test nthroot(interval(BigFloat, -81, -16), -4)
@test nthroot(interval(BigFloat, -81, -16), 1) interval(BigFloat, -81, -16)
end

# approximation used for testing (not to rely on ≈ for intervals)
# ⪆(x, y) = (x ≈ y) && (x ⊇ y)
(x::Interval, y::Interval) = x.lo y.lo && x.hi y.hi && x y

@testset "`mod`" begin
r = 0.0625
x = r..(1+r)
@test mod(x, 1) == mod(x, 1.0) == 0..1
@test mod(x, 2) == mod(x, 2.0) x
@test mod(x, 2.5) x
@test mod(x, 0.5) == 0..0.5
@test mod(x, -1) == mod(x, -1.0) == -1..0
@test mod(x, -2) == mod(x, -2.0) -2+x
@test mod(x, -2.5) -2.5+x
@test mod(x, -0.5) == -0.5..0

x = (-1+r) .. -r
@test mod(x, 1) == mod(x, 1.0) 1+x
@test mod(x, 2) == mod(x, 2.0) 2+x
@test mod(x, 2.5) 2.5+x
@test mod(x, 0.5) == 0..0.5
@test mod(x, -1) == mod(x, -1.0) x
@test mod(x, -2) == mod(x, -2.0) x
@test mod(x, -2.5) x
@test mod(x, -0.5) == -0.5..0

x = -r .. 1-r
@test mod(x, 1) == mod(x, 1.0) == 0..1
@test mod(x, 2) == mod(x, 2.0) == 0..2
@test mod(x, 2.5) == 0..2.5
@test mod(x, 0.5) == 0..0.5
@test mod(x, -1) == mod(x, -1.0) == -1..0
@test mod(x, -2) == mod(x, -2.0) == -2..0
@test mod(x, -2.5) == -2.5..0
@test mod(x, -0.5) == -0.5..0

# TODO - implement mod for two intervals
@test_throws ArgumentError mod(1..2, 1.4..1.5)
@test_throws ArgumentError mod(1.0, 1.4..1.5)
end

0 comments on commit c2f66c5

Please sign in to comment.