# PLUS+1 User Forum

## PLUS+1 Software => General controls => Topic started by: Emerson Zaionc on November 24, 2016, 05:26:04 PM

Title: Decimal Values
Post by: Emerson Zaionc on November 24, 2016, 05:26:04 PM
Hello guys;
Could you answer me if you can use this value in the image described as 'True Value'. I need to work with decimal values and I do not know how to do it. Today I'm working with 'False Value', but I need more precision.
Can you help me?
Title: Re: Decimal Values
Post by: Jakob on November 25, 2016, 07:57:38 AM
Hi,
What I usually do is to scale up the value before the division.
Meaning first multiply with 10000 and then divide by 21 (or what ever value you need).

I hope that helps

/Jakob
Title: Re: Decimal Values
Post by: Emerson Zaionc on November 25, 2016, 04:00:15 PM
Could you put a picture as an example?

Title: Re: Decimal Values
Post by: spittet on November 25, 2016, 06:51:11 PM
Taken from your example above :

10/6 = 2 (should be 1.67)

Assuming you want 2 decimal precision, then you should do the following :

10 x 100 = 1000 --> 1000/6 = 166. Then, you need to remember that this number (166) is 1.66 x 100. The next step would be to extract the integer part and the decimal part of this number to have 2 other numbers : 1 and 66. Then, in a text component, you can input the "1" as the integer part and the "66" as the decimal part after the point. to show the real number as "1"."66" .

Remember that you cannot use floating point values in PLUS1. They are all integers.

Also, make sure to use 16-bit or 32-bit data type because the first multiplication (by 100 or 1000) can increase the output a lot and you can fall into an overflow.

Sam