-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Questions about symmetry #23
Comments
Good question. The original PR may be of interest #6. A comparable |
Yeah, more thought could certainly be used here. We could define Base.promote_rule(::Type{<:StaticFloat64}, ::Type{Float32}) = Float32 so that runtime computations happen using |
Occasionally it's helpful to have a static float type for operations on @static if Int <: Int64
const Float = Float64
else
const Float = Float32
end
struct StaticFloat{N} <: AbstractFloat
StaticFloat{N}() where {N} = new{N::Float}()
end I'm a little nervous about this type of solution running into a bunch of unexpected issues and I'm not sure what benefit this would have beyond having consistency with
I thought we already promoted to |
Maybe I am misreading the intent of this package ...
If that is true .. is this package (at least the float part) all about supporting Octavian.jl and probably not relevant to other packages that do not have blocking logic? |
The benefits of this package aren't SciML or Octavian specific. A general rule for when this package is useful would be when you would need to use The reason we don't have distinct |
using any of these comparisons ( Is this the desired behavior? If it is, why the discrepancy? |
32 bit machines have 32 bit pointers, but should (hopefully) still support Because static operations are happening at compile time, and they can promote to smaller types, I'd think if anything (especially for floating point), that we'd want to move to larger precisions if possible (and then demote when interacting with dynamic values). Similarly, unless you're counting on overflow/underflow, I don't see why we'd want
You're correct. I use The asymmetry in comparison operators does seem unpleasant. Hence, why we have separate comparison operators for returning Maybe the operators should also return |
The package defines alternate comparison functions
|
If the static type structs were defined more similarly, it would be easier to reason about them. Is this sketched approach operationally correct (after any suggestions)?
|
Makes sense to me to have the alternate comparison operates the same across the board and just return
My only concern with |
indeed .. the logic for |
* make StaticBools compare like other StaticTypes Following on from #23, change makes comparisons (`==`, `!=`, `<`, `<=`, `>`, `>=`) of two StaticBools return either `true` or `false` (which the other StaticTypes do under the same comparisons). * reflect change in StaticBool comparisons This tests StaticBool comparisons (`==`, `<`, `<=`) return Bool values, as do other StaticTypes when compared * new version (all StaticType's compare --> Bool) restores StaticBool (`==`, `<`, `<=`) to yield Bool.
(a) Why is there no need for
StaticFloat32
orStaticInt32
?(b) Why is StaticInt idempotency & etc. defined
while
StaticFloat64
idempotentcy & etc is definedThe text was updated successfully, but these errors were encountered: