10-29-2014 12:49 AM
Something I stumbled across today, but I'm not sure if this is intended behavior. I'm running LV2013 SP1.
I have a numeric constant with type U8 on the block digram, and the "Adapt To Entered Data" property checked. If I then enter a value well within the U8 range (1 for example), the constant type suddenly changes to I32. I would expect it should only change type if the number was outside the 0-255 range of a U8. And even then, I would expect it would only change to a larger unsigned type (assuming the number isn't negative), not a signed type.
Is this behavior expected?
10-29-2014 05:17 AM - edited 10-29-2014 05:19 AM
I don't think adapt to entered data was meant to adapt to various integer types. It is mainly there for more fundamental changes such as floats <-> integers. For any integer value the default datatype is actually an int32. Notice that entering a number like 12222222222222222222222222222222222 won't change it into an int64 either but that it will get a int32 and will be capped to INT32_MAX.
It's debatable if this is expected behaviour, but it is certainly not very surprising. Any other approach would only lead to even more discutable behaviour.