# JZ10-11-R16 : Using a float

## Recommended Posts

Hi,

I successfully figured out the way to do a linear conversion (using the SI 80-85). Thing is, when i tried to code it myself, I found out that I was losing precision because of the result of (y2-y1)/(x2-x1) to find 'm' because most of the time the result is going to be a float but all we can use is an integer. So for example, if the result of your equation is 4.356, you are going to have 4 into your integer address. So that when you multiply this result to the X in "mx+b", the error is just getting bigger.

4,356 * 2456 =  10 698.336

4 * 2456 = 9824

As you can see, this doesn't make any sense.

Now that I am trying to configure a Paddle Wheels wired on the HSC inputs, I need to find a way to use a float because of the K Factors.

I can't accept that big of an error. Any idea how i could "create" a float using signed integers with this module?

##### Share on other sites

• 2 weeks later...

You can use SB82 the long integer function bit.  In the sample lines here this is taking a high and low range of a pressure transducer tomake sure that I can maintain the precision of my calculations for decimal points.  In you case you would use the values 4356*2456 = 10698336  which will not fit in an interger but will fit in a long integer using the SB82 bit correctly.  Then take this number and divide by whateever number you needed to divide by.  At the end divide by say 100 (not 1000) to preserve your final answer as a value equal to XXXX.X which you will be able to show on screen.

While this is a patchwork solution that works you should really upgrade to a V130 or better vision model that can just perform floating point math directly and you will like much better.

Keith
##### Share on other sites

I´ve used GF Signet flowmeter with Jazz and used K factor multiplied by 100 or 1000. For instance, if meter gives 15.43 pulses/litre, I use 1543. This way I obtain a value in litre x 100.

## Create an account

Register a new account

×