06-11-2009 11:25 AM
Colleagues,
As "LabVIEW-oriented" engineers we are more and more far away from text-based programming languages. LabVIEW is cool, but sometimes you can get some "side effects", like I've got today.
So, for saving few wiring I have programmed simple formula node:
Looks simple, isn't? But result was not expected, because this was interpreted as V_mm = Offset + Cal * ( 5 * Size);
The problem occur because the Formula Node accepts only the period (.) as a decimal separator.
No errors, warnings, etc!
Correct syntax should be:
Take a note, that on the BD constants looks like "0,2", not "0.2".
Well, technically both code above are OK.
Here another discussion about this.
Just for fun I checked this with CVI:
No warnings, and results absolutely the same as above:
V_mm 14950.800000
V_mm 15992.000000
And the Intel C compiler only said me, that
TEST.c - 2 warnings
55, 1 (55): remark #174: expression has no effect
55, 1 V_mm = Offset + Cal * (V_pix - 0,5 * Size);
Just would like to share this "very basic knowledge", because you may get the same trouble, which can't be easily recognized immediately...
with best regards,
Andrey
06-11-2009 01:11 PM
Let's convince our countries to make a trade. We'll adopt the metric system and you guys switch over from the comma to the period decimal separator.
06-11-2009 01:23 PM
It's a fair deal... 😉
That's how it works in Canada...
23.8 deg C
🙂
06-11-2009 02:55 PM - edited 06-11-2009 02:57 PM
I don't think a trade is needed. How did some countries come into the habit of doing something as stupid as making a comma the decimal separator.
It is known as a decimal "point". I've never heard anyone say "decimal comma".
By the way, is it the same countries that when they write the numeral one (1), it always looks like a seven (7)?
06-11-2009 03:19 PM
06-11-2009 03:25 PM
Neener neener neener, we have metric AND decimal point......
3.14 is really spoken "three comma one four" in german ("Drei comma eins vier" to be exact).
Shane.
06-11-2009 03:25 PM
06-11-2009 03:54 PM
PaulG. wrote:
You nailed it Ravens Fan. The first time I saw a comma as a separator I said to myself "WT_?"
The Metric system has only 7 basic measures, plus a substantial number of measures using various combinations of these base measures. The imperial system (prior to the UK converting to metric) and the USA system have over 300 different measures which many are ambiguous. For example, there are eight different definitions of ton (including the 'short ton' and the 'long ton'), all of which differ in weight. There are also eight different definitions of barrel, five different definitions of bushel, three different definitions of mile (international, nautical, and US Survey). The USA gallon is smaller than the Imperial gallon, and all measures which are multiples or subdivisions of the gallon (e.g.. pint, quart) likewise are inconsistent between the USA and the UK. Not only are the USA and UK pints different in size, but there are also differences between 'dry pints' and 'liquid pints'. All the units in the metric system are multiplied by 10 (to make larger units) or divided by 10 (to make smaller units). For example a kilometer is 1000 meters (10 * 10 * 10). It's nearest equivalent is a mile which is 5280 feet (8 * 10 * 22 * 3; based on the calculation that a mile is 8 furlongs, 10 chains to a furlong, 22 yards to a chain, 3 feet to a yard). ( At this point I actually gave a huge yawn) Although complex calculations can be done using the Imperial or USA system, almost all calculations can be done easier and faster in the metric system.
With the exception of the USA, all major countries have converted to the metric system (although in some countries, such as the UK, the conversion to metric is not yet complete). Consequently, for any international communication (trade, science, etc.) the metric system is the most widely used and accepted.
So let us have our to you strange decimal point. And as last nail in the coffin. Why do you Americans name a national sports league hardly noticed by other than Americans for the "World Series" That is spooky if you ask me;)
06-11-2009 04:01 PM
Ravens Fan wrote:
It is known as a decimal "point". I've never heard anyone say "decimal comma".
Well, but again, for me "decimal comma" is fully OK. Used everywhere here. "EUR 1,49", not "EUR 1.49". Comma is just standard in Germany. On the Block diagram all constants - with comma separator, and I just typed comma in the formula node and got slightly incorrect result.
But sometimes such mistyping may cause big troubles...
What may happened if you will type "DO 5 K = 1. 3" instead of "DO 5 K = 1, 3"? — Mariner 1 crash
PaulG. wrote:Let's convince our countries to make a trade. We'll adopt the metric system and you guys switch over from the comma to the period decimal separator.
Well, some of us measuring vodka in litres, another people measuring whisky in gallons... When both things are mixed, then the Gimli Glider incident may happened. Also Mars Climate Orbiter was crashed my metric/imperial mixup...
What I would like to say - just one warning message from LabVIEW (like Intel compiler does) may save lot of time. In my case that was no messages, and I was absolutely sure that the given code is correct. And result was nearby correct, but I was more than hour in hard debug session before figuring out what is wrong. Also be very careful and accurate.
Andrey.
06-11-2009 04:01 PM