You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alga implements the Lattice trait for primitive f32 and f64 types while providing infallible pair-wise meet and join operations. This seems to interact poorly with NaNs, which do not compare with other floating point values regardless of what they encode (the result is always false with the sole exception of !=).
Given this comparison and some floating point value x, (NaN ∨ x) produces x while (x ∨ NaN) produces NaN, because NaN >= x and x >= NaN are never true. Considering that NaN has no ordering w.r.t. any elements in the set of floating point values, can there be a greatest lower bound or least upper bound?
If the intention is to simply propagate NaNs as a sort of special case (rather than using a fallible API via Option or Result), then perhaps the implementation should produce NaN if either operand is NaN. "Garbage in, garbage out" probably applies here as well. :-) Do you have any thoughts on this?
The text was updated successfully, but these errors were encountered:
alga
implements theLattice
trait for primitivef32
andf64
types while providing infallible pair-wisemeet
andjoin
operations. This seems to interact poorly withNaN
s, which do not compare with other floating point values regardless of what they encode (the result is alwaysfalse
with the sole exception of!=
).Given this comparison and some floating point value
x
,(NaN ∨ x)
producesx
while(x ∨ NaN)
producesNaN
, becauseNaN >= x
andx >= NaN
are never true. Considering thatNaN
has no ordering w.r.t. any elements in the set of floating point values, can there be a greatest lower bound or least upper bound?If the intention is to simply propagate
NaN
s as a sort of special case (rather than using a fallible API viaOption
orResult
), then perhaps the implementation should produceNaN
if either operand isNaN
. "Garbage in, garbage out" probably applies here as well. :-) Do you have any thoughts on this?The text was updated successfully, but these errors were encountered: