andygrove commented on issue #353:
URL: 
https://github.com/apache/datafusion-comet/issues/353#issuecomment-2085981475

   Scala seems to take the sign into account during sorting and Rust does not. 
Perhaps we just need to document this as an edge case in the compatibility 
guide.
   
   ## Scala
   
   ```scala
   val x: Seq[Float] = Seq(0.0f, -0.0f, 0.0f, -0.0f, 1.0f, -1.0f)
   println(x.sorted)
   ```
   
   Output: `List(-1.0, -0.0, -0.0, 0.0, 0.0, 1.0)`
   
   ## Rust
   
   ```rust
   let mut v = vec![0.0_f32, -0.0_f32, 0.0_f32, -0.0_f32, 1.0_f32, -1.0_f32];
   v.sort_by(|a, b| a.partial_cmp(b).unwrap_or(std::cmp::Ordering::Greater));
   println!("{:?}", v);
   ```
   
   Output: `[-1.0, 0.0, -0.0, 0.0, -0.0, 1.0]`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to