LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert signed 32-bit hex string to ascii string



altenbach wrote:

Converting to a fractional format string is inappropriate for integers, use "number to decimal string".


Altenbach,
 
How bad is it to use Number to Fractional String over Number to Decimal String?  Any performance cost?  I believe he used that because that is what I used in my example.  I picked fractional string because usually when I need to do a conversion from number to string, I am using dealing with "fractional numbers" and not integers.  Even though he is using integers now, I felt there is always a possibility that he winds up doing some math on that number (scaling??) and it turns into a number with a "fractional" component.
 
I have one comment about the "number to decimal string".  I think it is poorly named.  When I read "decimal", I think of numbers that have a decimal point and digits to the right of that decimal point.  And if I have that kind of number, then "number to decimal string " is the wrong function to use and you just wind up with an integer or whole number in the resulting string.  Judging from other posts in the forums, it seems like others come across that problem a lot, where they used "decimal string" and should have chosen "fractional string".  I think NI should have actually named "decimal string" as "integer string", and "fractional string" either left alone or named "decimal string"
Message 11 of 18
(1,276 Views)


Ravens Fan wrote:
How bad is it to use Number to Fractional String over Number to Decimal String?  Any performance cost?  I believe he used that because that is what I used in my example.  I picked fractional string because usually when I need to do a conversion from number to string, I am using dealing with "fractional numbers" and not integers.  Even though he is using integers now, I felt there is always a possibility that he winds up doing some math on that number (scaling??) and it turns into a number with a "fractional" component.

No worries about performance. I just believe in using the right tool for the right job. 😉 Sure you can use a pair of pliers to loosen a nut or a butter knife to tighten a bolt 😄
Here you need to wire one additional input for the desired outcome (decimal places=0), cluttering up the code. Like Tiger Woods, I strongly believe that if things can be done in fewer strokes, it should be done in fewer strokes. While not an error, I would call using the "fractional" instead of the "integer" sibling for integers a bogey. 🙂


Ravens Fan wrote:
I have one comment about the "number to decimal string".  I think it is poorly named. 

Obviously You haven't been programming LabVIEW as long as I did. Many, (many!) versions ago, the naming of these conversion tools was much more confusing. How would you name them?
 
Decimal, (like octal, hexadecimal, etc) is a numeral system, so I think the usage here is correct.. The decimal seperator is just a cherry on top of it for the special case of formatting non-integer numbers in decimal format. 😄
Message 12 of 18
(1,271 Views)
Apparently that function seems to not be sure about itself. It's called Number to Decimal String, but its output is called decimal integer string. Smiley Happy
Message 13 of 18
(1,267 Views)


altenbach wrote:
 
No worries about performance. I just believe in using the right tool for the right job. 😉 Sure you can use a pair of pliers to loosen a nut or a butter knife to tighten a bolt 😄
Here you need to wire one additional input for the desired outcome (decimal places=0), cluttering up the code. Like Tiger Woods, I strongly believe that if things can be done in fewer strokes, it should be done in fewer strokes. While not an error, I would call using the "fractional" instead of the "integer" sibling for integers a bogey. 🙂
 
You're right.  And if Tiger had one less bogey yesterday, he wouldn't need to be playing 18 holes today.

Obviously You haven't been programming LabVIEW as long as I did. Many, (many!) versions ago, the naming of these conversion tools was much more confusing. How would you name them?

 

Only a few years, starting with 7.1.    I think like Smercurio said, Decimal Integer String like it calls its output, that way it is decimal for the number system, but integer to that it is obvious its result is an integer and not a fully decimal number where you have digits after the decimal point.  Is the fractional string function polymorphic in the background?  I realized looking at it again that its input terminal is naturally an orange double.  But if you hook up a blue I32 wire to it, it takes it and doesn't show a coercion dot.

 
Decimal, (like octal, hexadecimal, etc) is a numeral system, so I think the usage here is correct.. The decimal seperator is just a cherry on top of it for the special case of formatting non-integer numbers in decimal format. 😄





Message Edited by Ravens Fan on 06-16-2008 02:42 PM
Message 14 of 18
(1,258 Views)
I would assume that's because the integer can just be zero-padded to act as the mantissa of the double.  While it's still a type of conversion, there's no real manipulation necessary.
0 Kudos
Message 15 of 18
(1,252 Views)
It appears that Altenbach has been watching golf lately 😉  Plus good material for his LabToons
Message 16 of 18
(1,228 Views)


altenbach wrote:

Obviously You haven't been programming LabVIEW as long as I did. Many, (many!) versions ago, the naming of these conversion tools was much more confusing. How would you name them?


OK, I dusted off my old pentium with 5.1 still on it, and the names were as follows:

New: "Number to decimal string"  vs. Old: "To Decimal"
New: "Decimal string to number" vs. Old: "From Decimal"
 
... and so on for the others in hat palette. To laconic for my taste. 🙂
Message 17 of 18
(1,219 Views)

I have forgotten all about LV5.1...  Last time I saw it was in 1999-2000..  😮

Message 18 of 18
(1,216 Views)