The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Format Value

SercoSteveB
Active Participant

What is String Array Out following execution of the VI?

Format String 12_12_2014.png

Format String Answers 12_12_2014.png

Comments
kasliwal
Member

C.

interesting one.

Format Value: The decimal input is being rounded off and then getting coverted.

Played around with last Format Value block, it seems default format string is %.6f

mini09
Active Participant

D.

I didn't knew that the round off will take for decimal value.

This is an nice example.

A.Bernau
Member

not C: because of %04x has to be 04D3
not A: because of %d rounds, so it has to be 1235
but how about %.2f ?
I would guess it does not round the argument
So B?
I have to code it to confirm B (if not B then D) ...

..... It is D not B (%f rounds too)

crossrulz
Knight of NI

D


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
kasliwal
Member

I made a mistake, D is correct.

4 significant digits in hex notation with zero padding. so 04D3 instead of 4D3. If it had been %4x, then 4D3 would be correct.

MrStevenUND
Member

D would be the only one with consistant rounding...

I was first thinking B, but element 0 founds up while element 1 rounds up.  A has the opposite. 

kasliwal, if you look close, %4x gives you [space]4D3 - padding to 4 characters with a space.  %04x pads with a zero.

rgbernatchez
Member

D

SercoSteveB
Active Participant

Answer: D.  Nice one gnshmrthy, crossrulz, kasliwal, MrStevenUND & rgbernatchez.

A couple of things to understand here; space padding when using %04x and what happens when you pass an empty string for the format string.

mssorters
Member

D