# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## frac/exp string to number - shifting decimal point, what's going on?

Trying to convert string to number, i.e. 1.234 string to 1.234 dbl. When I use the frac/exp string to number, sometimes the decimal point gets shifted and sometimes it does not. I pulled a small section out and uploaded it here. Can anyone figure out why it shifts the decimal in one case but not the other? I'm sure it's some simple thing I'm missing.

thanks!

-Matt

Message 1 of 8
(190 Views)

## Re: frac/exp string to number - shifting decimal point, what's going on?

It seems to work perfectly fine for me.

It would've helped if you had saved as default in the two strings the values that were and weren't giving you problems.  When I type in 1.234, it works fine.  But perhaps your issue is that you typed something in wrong, but not obvious.

Message 2 of 8
(176 Views)

## Re: frac/exp string to number - shifting decimal point, what's going on?

I'm not seeing any shift in decimal place. Can you perhaps save some default values that exhibit the problem and upload the vi again?

Edited to add: Looks like RavensFan beat me.

Message 3 of 8
(174 Views)

## Re: frac/exp string to number - shifting decimal point, what's going on?

It works for me.

Did you read the help for the function?

"Interprets the characters 0 through 9, plus, minus, e, E, and the decimal point" Perhaps your string is scientific representation?

EDIT: Guess I am too slow... 2 other people posted before me. LOL

Message 4 of 8
(163 Views)

## Re: frac/exp string to number - shifting decimal point, what's going on?

wow, thanks for the quick responses! I've entered in numbers that are giving me problems and made them default. Here is an updated vi.

thanks everyone!

Message 5 of 8
(154 Views)
Solution
Accepted by topic author mes291

## Re: frac/exp string to number - shifting decimal point, what's going on?

These numbers work fine on mine. The numbers are 1.23456 and 9.70695970695971E-02 (which corresponds to 0.0970695970695971).

Edited to add: You can change the Display Format of the numbers to scientific if you want the numbers to always be x.xxxxxxEy.

Message 6 of 8
(145 Views)
Solution
Accepted by topic author mes291

## Re: frac/exp string to number - shifting decimal point, what's going on?

Make String #2 wider.  You'll see it says.  9.70695970695971E-02  That would be 0.097....

So no problems!

Message 7 of 8
(143 Views)
Highlighted

## Re: frac/exp string to number - shifting decimal point, what's going on?

how embarrassing. Two hours of my life totally wasted on an undersized box.......ugh.

thanks again everyone.

Message 8 of 8
(134 Views)