-
Notifications
You must be signed in to change notification settings - Fork 8
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
Inconsistency in arithmetic of infinites of different types #47
Comments
Thanks for spotting this. I guess somewhere assumes floats are finite... |
Yeah it is this code: for Typ in (:Number, :Real, :Integer, :AbstractFloat)
@eval begin
isless(x::RealInfinity, y::$Typ) = signbit(x) && y ≠ -∞
isless(x::$Typ, y::RealInfinity) = !signbit(y) && x ≠ ∞
+(::$Typ, y::RealInfinity) = y
+(y::RealInfinity, ::$Typ) = y
-(y::RealInfinity, ::$Typ) = y
-(::$Typ, y::RealInfinity) = -y
function *(a::$Typ, y::RealInfinity)
iszero(a) && throw(ArgumentError("Cannot multiply $a * $y"))
a > 0 ? y : (-y)
end
end
end |
fixed by #40 |
Merged
putianyi889
added a commit
to putianyi889/Infinities.jl
that referenced
this issue
Nov 26, 2024
dlfivefifty
added a commit
that referenced
this issue
Nov 29, 2024
* fix ambiguities * Update cardinality.jl * update * update * update * update * update * multiplication * Update ambiguities.jl * update * isinf and isfinite * mod * fld, cld, div * cleanup * cleanup and add a test * test ComplexInfinity promotion * Update Infinities.jl * Update runtests.jl * coverage * coverage * add a note * add tests for #47 --------- Co-authored-by: Sheehan Olver <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is fine:
This is also fine:
This is not:
The text was updated successfully, but these errors were encountered: