ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting a Table

Solved!
Go to solution

Hmmm

I'm confused.  Supposedly, if you interpret the 64 bits of a double FP as a 64-bit signed integer, it will sort correctly.

But I observe this:

paul_a_cardinale_0-1768236660478.png

paul_a_cardinale_1-1768236693178.png

What am I missing?

 

 

0 Kudos
Message 31 of 36
(451 Views)

I haven't studies it in detail, but it might have to do with the fact that negative integers are in Two's complement.

0 Kudos
Message 32 of 36
(443 Views)

In both Double, and I64, the MSB is 1 for negative, 0 for positive.

Message 33 of 36
(431 Views)

I was talking about the remaining bits, which are in two-s complement for negative numbers.

 

For example in l8,

 

1 = b00000001

-1 = b11111111 (i.e. not b10000001)

Message 34 of 36
(411 Views)

@altenbach wrote:

I was talking about the remaining bits, which are in two-s complement for negative numbers.

 

For example in l8,

 

1 = b00000001

-1 = b11111111 (i.e. not b10000001)


Sure.  But I believed (and have read) that interpreting an (IEEE 754) floating point number as a (two's complement) signed integer would result in the same ordering as interpreting the floating point value.

0 Kudos
Message 35 of 36
(359 Views)

OK, I'll take another stab at this.  I fixed the numeric sorting, and added a new mode (Hierarchal).

It occurred to me that there may be a need to sort things such as paragraph identifiers that typically use hierarchal numbering: "1.1" < "1.10".

However instead of using a "Mode" input, I made a polymorphic VI.

0 Kudos
Message 36 of 36
(354 Views)