Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add decorations for reverse functions #43

Closed
wants to merge 8 commits into from

Conversation

krish8484
Copy link

No description provided.

@krish8484
Copy link
Author

krish8484 commented May 22, 2020

ITF1788 Tests
Master

> julia> @test cosh_rev(Interval(0x1.8b07551d9f55p+0, 0x1.89bca168970c6p+432), Interval(-Inf, 0.0))[2] == Interval(-0x1.2c903022dd7abp+8, -0x1.fffffffffffffp-1)    
> Test Failed at REPL[4]:1
>   Expression: (cosh_rev(Interval(1.5430806348152437, 1.705784684221514e130), Interval(-Inf, 0.0)))[2] == Interval(-300.5632345000001, -0.9999999999999999)
>    Evaluated: ∅ == [-300.564, -0.999999]
> ERROR: There was an error during testing

Branch

> julia> @test cosh_rev(Interval(0x1.8b07551d9f55p+0, 0x1.89bca168970c6p+432), Interval(-Inf, 0.0))[2] == Interval(-0x1.2c903022dd7abp+8, -0x1.fffffffffffffp-1)    
> Test Passed

@krish8484
Copy link
Author

krish8484 commented May 23, 2020

ITF1788 Test

Master

> julia> @test mul_rev_IEEE1788(Interval(0.0, 1.1), Interval(0.0, 0.12)) == entireinterval(Float64)
Error During Test at REPL[4]:1
  Test threw exception
  Expression: mul_rev_IEEE1788(Interval(0.0, 1.1), Interval(0.0, 0.12)) == entireinterval(Float64)
  MethodError: no method matching mul_rev_IEEE1788(::Interval{Float64}, ::Interval{Float64})
  Closest candidates are:
    mul_rev_IEEE1788(::Any, ::Any, !Matched::Any) at C:\Users\ASUS\.julia\dev\IntervalContractors\src\arithmetic.jl:205
  Stacktrace:
   [1] top-level scope at REPL[4]:1
   [2] eval(::Module, ::Any) at .\boot.jl:330
   [3] eval_user_input(::Any, ::REPL.REPLBackend) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\REPL\src\REPL.jl:86
   [4] macro expansion at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.3\REPL\src\REPL.jl:118 [inlined]
   [5] (::REPL.var"26#27"{REPL.REPLBackend})() at .\task.jl:333
ERROR: There was an error during testing

Branch

> julia> @test mul_rev_IEEE1788(Interval(0.0, 1.1), Interval(0.0, 0.12)) == entireinterval(Float64)
Test Passed

src/arithmetic.jl Outdated Show resolved Hide resolved
src/arithmetic.jl Outdated Show resolved Hide resolved
src/decorations.jl Show resolved Hide resolved

for f in reverse_functions
@eval function $(f)(xx::DecoratedInterval, yy::DecoratedInterval)
x = interval_part(xx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use interval(xx) instead of interval_part.
This should be changed in IntervalArithmetic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will make a PR in IntervalArithmetic.jl addressing this

end
end

function mul_rev_IEEE1788(xx::DecoratedInterval, yy::DecoratedInterval)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this just be included in the previous piece of code?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we will need a separate tuple especially for mul_rev_IEEE1788 because this function is not accepting single intervals as input like other functions in the tuple reverse_functions.

@@ -27,12 +27,12 @@ end
@testset "cosh_rev_test" begin
@test isapprox(cosh_rev(∅, -∞..∞)[2], ∅)
@test isapprox(cosh_rev(Interval(-10.0, -1.0), -∞..∞)[2], ∅)
@test isapprox(cosh_rev(Interval(0.0, Inf), -∞..∞)[2], Interval(0.0, ∞))
@test isapprox(cosh_rev(Interval(0.0, Inf), -∞..∞)[2], Interval(-∞, ∞))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is isapprox being used here? We should be testing equality I think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests were not added by me, I have only edited them to return negative values as well.
Should I replace isapprox too?

This was referenced Jun 2, 2020
@krish8484 krish8484 requested a review from dpsanders June 3, 2020 12:09
@lucaferranti
Copy link
Member

supesed by #49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants