From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Edit Cell Numeric Attributes may show strange default values

Solved!
Go to solution

Those values look a bit surprising... I did not type them myself... It happens if you change the data type let's say from unsigned char to double...

 

But it's not a meaningless number: if you now type -1e1000 as a new minimum value, CVI 'corrects' it to -9.2E+18...

It also can behave properly, sometimes, but shouldn't it always? Smiley Wink

 

It behaves better if instead of -1e1000 you first type -100. If you then enter -1e1000 it will correct the number to -1.0E+300

(well, it probably should be E+308...) but I'll better stop here  Smiley Very Happy

 

 

ATTRIBUTE.png

0 Kudos
Message 1 of 5
(4,408 Views)

It somehow appears that the values shown depend on the history, also on the format (decimal, scientific...).

 

So if NI is interested in reproducing the issue this can be done using the demo I have provided here:

 

Open the UI, double click the table to edit, click on edit cell (5/1), change data type to char and then to double...

0 Kudos
Message 2 of 5
(4,397 Views)
Solution
Accepted by topic author Wolfgang

Hi Wolfgang,

 

When I first open the Edit dialog, the cell's data type is int64 and the range is (-9223372036854775808, 9223372036854775807). Those happen to be the largest possible values that an int64 can hold, and they are probably there because they were coerced down from the default double range (-Inf,+Inf), in a previous editing session.

 

You then changed the data type to char, which changes the range to (-128,127), which is the coerced range of a char . But the dialog still remembers that your initial preference was (-9223372036854775808, 9223372036854775807), and so, when you then change the data type to double, in that same editing session, it restores this range again, since it is now valid for the new data type. Except that it displays it in scientific notation, since doubles automatically use this notation when the exponent goes above a certain size.

 

It looks as if you then tried to coerce it back to the largest possible range of a double by typing 1e1000. This is a reasonable assumption on your part, but unfortunately it is a limitation of CVI that it cannot coerce a double entered in scientific notation -- it doesn't recognize 1e1000 as a valid number. Therefore, it keeps whatever value was in the control beforehand. If you had typed 1e308 instead, it would have worked, since that is a valid number. I recognize that it is very inconvenient for you to "guess" what the maximum number might be, so that you can enter it. All I can say is that if you really want to enter the highest possible double value in the max/min controls, you should enter "-Inf" and "+Inf" instead.

 

Luis

 

Given what I wrote above, the following shouldn't happen (and I wasn't able to reproduce it): "It behaves better if instead of -1e1000 you first type -100. If you then enter -1e1000 it will correct the number to -1.0E+300". It should leave -100 in the control.

Message 3 of 5
(4,374 Views)

Hi Luis,

 

nice to have you back more frequently!

 

Thanks for the insight, with your explanation everything makes sense - CVI is smarter than expected Smiley Very Happy

 

So sorry for the noise...

 

(off topic, but if those controls would be one digit wider they could show even the full unsigned intptr_t)

0 Kudos
Message 4 of 5
(4,364 Views)

You're right, they're too small: 467070.

Message 5 of 5
(4,357 Views)