Skip to content

Commit 4277040

Browse files
committed
Correct the NaN ordering in the primitive comparison docs
total_cmp sorts a NaN with the sign bit set below -inf, so NaN is not always the largest value. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 034f452 commit 4277040

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎vortex-array/src/scalar_fn/fns/binary/compare/primitive.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ use crate::scalar_fn::unstable::row::execute_row_inputs;
2828

2929
/// Compare two primitive arrays of the same [`PType`].
3030
///
31-
/// Floats compare with Vortex's total ordering: `NaN` is the largest value, `-0.0 < +0.0`, and
32-
/// equality is bitwise.
31+
/// Floats compare with Vortex's total ordering over their bit patterns: a `NaN` with the sign bit
32+
/// set sorts below `-inf`, any other `NaN` sorts above `+inf`, and `-0.0 < +0.0`. Equality is
33+
/// bitwise, so distinct `NaN` payloads are not equal.
3334
pub(super) fn compare_primitive(
3435
lhs: &ArrayRef,
3536
rhs: &ArrayRef,

0 commit comments

Comments
 (0)