10-01-2024 07:55 AM
@paul_a_cardinale wrote:
This works for any cluster:
Once a NaN is packaged in a variant, the rules about comparing NaNs are no longer applied; all NaNs are considered equal.
However this could be construed as a bug, and may be 'fixed' in the future.
I gotta see that more closely. Could you please elaborate! (Don't make me actually boot up the laptop - I honestly haven't even opened LabVIEW for over a year)
10-01-2024 07:59 AM
@softball wrote:
Hi Paul
You are right, and you are wrong.
'To Variant' works like 'Flatten To String'. It converts a NaN to a representation that can be compared directly.
However, if the NaN's involved are binary different as shown in the case above then a NaN comparison will still fail.
But interesting. Maybe a 'To Variant' is faster than 'Flatten To String'.
Regards
What's the bottom ÷ for? The output is not wired.
10-01-2024 08:21 AM
Hi JÞB
Sorry for confusing you. Just ignore the ÷. It isn't connected to anything as you noted. Just me being lazy when generating the example.
Regards
10-01-2024 09:28 AM
@softball wrote:
Hi Paul
You are right, and you are wrong.
'To Variant' works like 'Flatten To String'. It converts a NaN to a representation that can be compared directly.
However, if the NaN's involved are binary different as shown in the case above then a NaN comparison will still fail.
But interesting. Maybe a 'To Variant' is faster than 'Flatten To String'.
Regards
Good catch.
Flatten to XML works with any NaN.
10-01-2024 10:38 AM - edited 10-01-2024 10:47 AM
Hi Paul
Brilliant !
Different NaN values get converted to a generic 'NaN' string. Just like we want it.
Regards
PS : This behavior would be a nice candidate for a LabVIEW ini setting.
PPS : Except it would encourage some to compare floating point values for equal or not. Which is a bad idea.
10-01-2024 01:14 PM - edited 10-01-2024 01:18 PM
This has been a very interesting conversation. Before reading the last few entries I also tried the flatten to string comparison, and for my purpose it works, since I'm comparing two versions of the same (complex) cluster, and whose NaN values haae the same origin. It does sound like flattening to XML is even more reliable.