You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ne...@apache.org on 2021/01/09 05:39:29 UTC

[arrow] branch master updated: ARROW-11169: [Rust] Add a comment explaining where float total_order algorithm came from

This is an automated email from the ASF dual-hosted git repository.

nevime pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 1f126ab  ARROW-11169: [Rust] Add a comment explaining where float total_order algorithm came from
1f126ab is described below

commit 1f126aba8c4eb888adf38635bad0e0975fa81d94
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Sat Jan 9 07:38:42 2021 +0200

    ARROW-11169: [Rust] Add a comment explaining where float total_order algorithm came from
    
    Follow up from https://github.com/apache/arrow/pull/8882
    
    Closes #9129 from alamb/alamb/doc-improvement
    
    Authored-by: Andrew Lamb <an...@nerdnetworks.org>
    Signed-off-by: Neville Dipale <ne...@gmail.com>
---
 rust/arrow/src/compute/kernels/sort.rs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/rust/arrow/src/compute/kernels/sort.rs b/rust/arrow/src/compute/kernels/sort.rs
index eabf420..ace560e 100644
--- a/rust/arrow/src/compute/kernels/sort.rs
+++ b/rust/arrow/src/compute/kernels/sort.rs
@@ -41,7 +41,9 @@ pub fn sort(values: &ArrayRef, options: Option<SortOptions>) -> Result<ArrayRef>
     take(values.as_ref(), &indices, None)
 }
 
-// sorts f32 in IEEE 754 total ordering
+// implements comparison using IEEE 754 total ordering for f32
+// Original implementation from https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp
+// TODO to change to use std when it becomes stable
 fn total_cmp_32(l: f32, r: f32) -> std::cmp::Ordering {
     let mut left = l.to_bits() as i32;
     let mut right = r.to_bits() as i32;
@@ -52,7 +54,9 @@ fn total_cmp_32(l: f32, r: f32) -> std::cmp::Ordering {
     left.cmp(&right)
 }
 
-// sorts f64 in IEEE 754 total ordering
+// implements comparison using IEEE 754 total ordering for f64
+// Original implementation from https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp
+// TODO to change to use std when it becomes stable
 fn total_cmp_64(l: f64, r: f64) -> std::cmp::Ordering {
     let mut left = l.to_bits() as i64;
     let mut right = r.to_bits() as i64;