05-10-2013 07:10 PM
Found in this piece of diagram:
The constant 2 is of type I32, so why is there a coercion dot at the "Inverted" connector of the Compound Arithmetic function?
The interesting thing is that if I uncheck the "Invert", the coercion dot disappears, and if I check it off again:
Gone!
Full Disclosure: I inserted the I32 conversion function before I noticed the remnent coercion dot... And if I undo all these steps, I am unable to reproduce the coercion dot.
Mysteries of LV...
05-10-2013 08:28 PM
inverting a 2 produces a dbl, no? then you're adding two different types. Not sure why it isn't reproducible, as it should happen every time.
05-10-2013 08:52 PM
I meant the "invert" option of the Addition, which is a subtraction, perfectly within the scope of an I32.
Not sure why there was a coercion dot in the first place, even less why the repeated Ctrl-Z cleared it...
05-13-2013 04:17 AM
Hi,
I was able to reproduce it by playing a bit with LabView...
Step1 : I use a double and a U 32 as inputsa -> as expected, there is a coercion dot at the inverted input.
Step2 : I "insert" a conversion on the double line (when I deleted it first, I could not reproduce the behaviour... it only worked when I inserted it). The types should now be ok, without coercion dots.
Step3 : I save my VI... The coercion dot disappeared. (Same effect when I clicked on "run")
It seems that when we "insert" the conversion, LabView does not update the coercion dots... however, it is not forgotten, as they are updated as soon as we save or run the VI ...
Aurelie
05-13-2013 04:37 AM
What we have here is a somehow inconsistant behavior regarding type checks of inputs of the compound arithmetics block. Obviously, some checkes are done during editing, some only occur during compilation.
When are checks made for all inputs of the compound arithmetic during editing:
- Connecting a new wire
- Modifying compound arithmetics itself (invert, add/remove input, change mode, ...)
Checks made only during compilation of the VI:
- Modification of existing wires (insert type cast)
This later behavior btw matches the "constant folding" check of the compiler, which is only done during compilation.
When does the VI compile?
- Running it
- Saving it (and compiled code included in the VI-file)
- Force Compile (Press Ctrl+Click Run Button with mouse)
So all in all, it is arguable if this is a cosmetic misbehavior. For my part, i wouldn't even bother on that since only the compiled code is relevant. So looking for coercion dots is best done on compiled versions of the code rather than any "uncompiled one".
Norbert
05-13-2013 09:15 AM
I had thought of trying the Ctrl-Run button trick later after my last post... That's what happens when you stop practicing the fundamentals for a while.
Repeat 100 times: when in doubt, Ctrl-Run button.