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

bug with and operation and limit correlation #1

Open
tokamaster opened this issue Jul 15, 2020 · 1 comment
Open

bug with and operation and limit correlation #1

tokamaster opened this issue Jul 15, 2020 · 1 comment

Comments

@tokamaster
Copy link
Member

when trying to calculate:

x = 0.1
y = 0.2

and(x,y,getValidCorr(x,y,))

there is an error:

julia> and(0.1,0.2,getValidCorr(0.1,0.2))
ERROR: ArgumentError: Interval Boolean must be ⊆ [0, 1]. Provided = [-3.46945e-18, 0.100001]
Stacktrace:
[1] checkUncBool at /home/enmidol/Documents/UncLogic.jl/src/Checks.jl:28 [inlined]
[2] checkUncBool at /home/enmidol/Documents/UncLogic.jl/src/Checks.jl:18 [inlined]
[3] and(::Float64, ::Float64, ::Interval{Float64}) at /home/enmidol/Documents/UncLogic.jl/src/Operations.jl:30
[4] top-level scope at none:0

this is because -3.46945e-18 is essentially zero, but the code doesn't get it as zero.

our and operation is not continuous (it is discontinuous at getValidCorr(x,y))

@AnderGray
Copy link
Member

Very nice catch! And you're totally right that the operation is discontinuous just at the limit. Everything is fine in the adjacent floating point numbers :

julia> c = getValidCorr(0.1, 0.2)
[-0.166667, 0.666667]

julia> and(0.1, 0.2, nextfloat(c.lo))
0.0

julia> and(0.1, 0.2, prevfloat(c.lo)
0.0

How can we fix it? I guess a quick one would be to return max(ans,0) or min(ans,1)

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

No branches or pull requests

2 participants