# LabVIEW

cancel
Showing results for
Did you mean:

## how to extract till the first value after the decimal in a dbl

Hi Guys

I want to take a number upto its first significant  value after the decimal point.

For example. If I got a number as 11.1234. But I want this number as 11.1.

How can I convert this number in labVIEW?

Message 1 of 4
(1,723 Views)

## Re: how to extract till the first value after the decimal in a dbl

Hi trip,

did you try a format string of "%.1f"?

Or you may round after reading in your number: y := RoundToNearest(x*10)/10…

Best regards,
GerdW

using LV2020 on Win8.1+cRIO
Message 2 of 4
(1,712 Views)

## Re: how to extract till the first value after the decimal in a dbl

Multiple Possible Methods

Method 1.As suggested by Gerd (Format into string) and then Converting the string value to Numeric Value

Method 2.Convert Number to fractional String with precision1 and then convert back Fractional string  to Number

CertifiedLabVIEWArchitect|| CertifiedTestStandDeveloper,
Currently able to Access LV2015&LV2017
Message 3 of 4
(1,693 Views)

## Re: how to extract till the first value after the decimal in a dbl

Method 3: multiply number by 10, convert to integer, then divide by 10. (This truncates unwanted precision)

Method 4: same as Method 3, but use Round to Nearest in the middle. (Gives a rounded result)

Can you say a bit more about the whole problem? Do you have just a single number that you want to convert or is this value part of a data stream, list or array, where you have some number of sequential values you need to process?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 4
(1,675 Views)